From 2831a77437b5eee6acb9302318fa6c2d32c282ef Mon Sep 17 00:00:00 2001 From: mehmetyz Date: Mon, 1 Aug 2022 15:27:00 +0300 Subject: [PATCH 1/8] Update foresight workflow --- .github/workflows/foresight.yml | 5 +++-- .../internal/FakeAnnotatedTypeFactory.java | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index a243e2570..ec9cf0975 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -15,6 +15,7 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Collect Workflow Telemetry if: always() uses: runforesight/foresight-workflow-kit-action@v1 @@ -37,5 +38,5 @@ jobs: uses: thundra-io/foresight-test-kit-action@v1 with: api_key: ${{ secrets.FORESIGHT_API_KEY }} - test_framework: junit - test_path: "**/target/surefire-reports/**" + coverage_format: jacoco/xml + coverage_path: "**/target/site/jacoco/*.xml" diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactory.java b/core/src/main/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactory.java index 67f5ac715..9fabd8577 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactory.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactory.java @@ -47,6 +47,25 @@ private static AnnotatedType makePlainType(Class type) { return new FakeAnnotatedType(type); } + private static void testUpdate(int v) { + if(v > 0) { + System.out.println("v > 0"); + } + else if(v < 0) { + System.out.println("v < 0"); + } + else { + System.out.println("v == 0"); + } + } + + private static int testDemo(int x, int y) { + int sum = x+y; + int div = y != 0 ? x/y : 1; + + return sum * sum + div * div; + } + private static final class FakeAnnotatedArrayType implements AnnotatedArrayType { From 94883d0d3658b804bff46c73c91ca11b1a4ed0bc Mon Sep 17 00:00:00 2001 From: mehmetyz Date: Mon, 1 Aug 2022 16:38:07 +0300 Subject: [PATCH 2/8] Update foresight upload url --- .github/workflows/foresight.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index ec9cf0975..7e5176f7e 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -8,6 +8,9 @@ on: workflow_dispatch: +env: + FORESIGHT_UPLOADER_SIGNER_URL: https://upload.thundra.us + jobs: build: From e383c4824b8acdee8cbb6891f4ce05b3a9fdddf7 Mon Sep 17 00:00:00 2001 From: mehmetyz Date: Mon, 1 Aug 2022 16:43:08 +0300 Subject: [PATCH 3/8] add mvn configuration --- .github/workflows/foresight.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index 7e5176f7e..06803fe3e 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -33,7 +33,7 @@ jobs: cache: maven - name: Build with Maven - run: mvn clean install + run: mvn clean -fn install - name: Analyze Test and/or Coverage Results From 66f18fe3d645cf77ce85331f52afc1cb67961ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Y=C4=B1ld=C4=B1z?= <48569605+mehmetyz@users.noreply.github.com> Date: Fri, 19 Aug 2022 09:44:48 +0300 Subject: [PATCH 4/8] Update foresight.yml --- .github/workflows/foresight.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index 06803fe3e..934e83838 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -10,7 +10,8 @@ on: env: FORESIGHT_UPLOADER_SIGNER_URL: https://upload.thundra.us - + WORKFLOW_TELEMETRY_BASE_URL: https://foresight.service.thundra.us + jobs: build: From 6f61a01bb9df3c5ae0b9a7dc8ed757206b6fe03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Y=C4=B1ld=C4=B1z?= <48569605+mehmetyz@users.noreply.github.com> Date: Mon, 12 Sep 2022 15:53:57 +0300 Subject: [PATCH 5/8] Update foresight.yml --- .github/workflows/foresight.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index 934e83838..30deae340 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -9,8 +9,8 @@ on: env: - FORESIGHT_UPLOADER_SIGNER_URL: https://upload.thundra.us - WORKFLOW_TELEMETRY_BASE_URL: https://foresight.service.thundra.us + FORESIGHT_UPLOADER_SIGNER_URL: https://upload.service.runforesight.us + WORKFLOW_TELEMETRY_BASE_URL: https://api.service.runforesight.us jobs: build: @@ -39,7 +39,7 @@ jobs: - name: Analyze Test and/or Coverage Results if: always() - uses: thundra-io/foresight-test-kit-action@v1 + uses: runforesight/foresight-test-kit-action@v1 with: api_key: ${{ secrets.FORESIGHT_API_KEY }} coverage_format: jacoco/xml From 62719cdb5c46d28cb9e625f6c1c3bbc87257a24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Y=C4=B1ld=C4=B1z?= <48569605+mehmetyz@users.noreply.github.com> Date: Mon, 12 Sep 2022 16:44:36 +0300 Subject: [PATCH 6/8] Update README.md --- README.md | 65 +++++++++++++------------------------------------------ 1 file changed, 15 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 9e2c3aebb..931c3dde6 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,20 @@ -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.pholser/property-binder/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/com.pholser/junit-quickcheck) -[![Build Status](https://travis-ci.org/pholser/junit-quickcheck.svg?branch=master)](https://travis-ci.org/pholser/junit-quickcheck) -[![Code Quality: Java](https://img.shields.io/lgtm/grade/java/g/pholser/junit-quickcheck.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pholser/junit-quickcheck/context:java) -[![Total Alerts](https://img.shields.io/lgtm/alerts/g/pholser/junit-quickcheck.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pholser/junit-quickcheck/alerts) - - Software Quality Award 2016 - - -# junit-quickcheck: Property-based testing, JUnit-style - -junit-quickcheck is a library that supports writing and running property-based -tests in JUnit, inspired by QuickCheck for Haskell. - -Property-based tests capture characteristics, or "properties", of the output -of code that should be true given arbitrary inputs that meet certain criteria. -For example, imagine a function that produces a list of the prime factors of -a positive integer `n` greater than 1. Regardless of the specific value of -`n`, the function must give a list whose members are all primes, must -equal `n` when all multiplied together, and must be different from the -factorization of a positive integer `m` greater than 1 and not equal to -`n`. - -Rather than testing such properties for all possible inputs, junit-quickcheck -and other QuickCheck kin generate some number of random inputs, and verify -that the properties hold at least for the generated inputs. This gives us -some reasonable assurance upon repeated test runs that the properties -hold true for any valid inputs. +## runforesight.com Demo Projects - Junit Quickcheck -## Documentation - -[Documentation for the current stable version](https://pholser.github.io/junit-quickcheck/index.html) - -## Basic example - -```java - import com.pholser.junit.quickcheck.Property; - import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; - import org.junit.runner.RunWith; - - import static org.junit.Assert.*; + + see it on foresight + - @RunWith(JUnitQuickcheck.class) - public class StringProperties { - @Property public void concatenationLength(String s1, String s2) { - assertEquals(s1.length() + s2.length(), (s1 + s2).length()); - } - } -``` +--- +![Success Details](https://api-public.service.runforesight.us/api/v1/badge/success?repoId=ff4c627a-dfe6-48b1-9407-f6e513618d0d) +![Test Result](https://api-public.service.runforesight.us/api/v1/badge/test?repoId=ff4c627a-dfe6-48b1-9407-f6e513618d0d) +![Utilization](https://api-public.service.runforesight.us/api/v1/badge/utilization?repoId=ff4c627a-dfe6-48b1-9407-f6e513618d0d) -## Other examples -After browsing the [documentation](#documentation), have a look at some -[examples](examples) in module `junit-quickcheck-examples`. These are built -with junit-quickcheck. +| Report Attribute | Value | +|---|---| +| Language | Java | +| Test Framework | Junit | +| Test Report Format | JUnit | +| Coverage Format | Jacoco / XML | +| Coverage Format 2 | Cobertura / XML | From 781c5475ad77cf949dfa82391db1c27e55187d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Y=C4=B1ld=C4=B1z?= <48569605+mehmetyz@users.noreply.github.com> Date: Tue, 15 Nov 2022 15:28:20 +0300 Subject: [PATCH 7/8] Update foresight.yml --- .github/workflows/foresight.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index 30deae340..11931106c 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -6,6 +6,8 @@ on: pull_request: branches: [ "master" ] workflow_dispatch: + schedule: + - cron: "0 1 * * *" env: From 10ca1112388c5d1a8c1f127102e55f45481eec7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Y=C4=B1ld=C4=B1z?= <48569605+mehmetyz@users.noreply.github.com> Date: Tue, 31 Jan 2023 16:08:51 +0300 Subject: [PATCH 8/8] Update README.md (#6) --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 931c3dde6..076127a1d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,14 @@ ## runforesight.com Demo Projects - Junit Quickcheck - + see it on foresight --- -![Success Details](https://api-public.service.runforesight.us/api/v1/badge/success?repoId=ff4c627a-dfe6-48b1-9407-f6e513618d0d) -![Test Result](https://api-public.service.runforesight.us/api/v1/badge/test?repoId=ff4c627a-dfe6-48b1-9407-f6e513618d0d) -![Utilization](https://api-public.service.runforesight.us/api/v1/badge/utilization?repoId=ff4c627a-dfe6-48b1-9407-f6e513618d0d) - +![Success Details](https://api-public.service.runforesight.com/api/v1/badge/success?repoId=5c43d0bb-71db-429f-a5b5-ebf7d5622aef) +![Test Result](https://api-public.service.runforesight.com/api/v1/badge/test?repoId=5c43d0bb-71db-429f-a5b5-ebf7d5622aef) +![Utilization](https://api-public.service.runforesight.com/api/v1/badge/utilization?repoId=5c43d0bb-71db-429f-a5b5-ebf7d5622aef) | Report Attribute | Value | |---|---|