From c3325bf31ed71db4b40953bb350e743d44ea4e91 Mon Sep 17 00:00:00 2001 From: mehmetyz Date: Mon, 1 Aug 2022 15:29:46 +0300 Subject: [PATCH 1/7] add foresight workflow --- .github/workflows/foresight.yml | 11 ++-- .../guava/generator/OptionalGenerator.java | 9 ++++ pom.xml | 51 +++++++++++++------ 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index a243e2570..121dab4d6 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -21,15 +21,14 @@ jobs: with: api_key: ${{ secrets.FORESIGHT_API_KEY }} - - name: Set up JDK 11 + - name: Set up JDK 8 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '8' distribution: 'temurin' cache: maven - - name: Build with Maven - run: mvn clean install + run: mvn clean -fn install - name: Analyze Test and/or Coverage Results @@ -37,5 +36,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: cobertura/xml + coverage_path: "**/target/site/cobertura/*.xml" diff --git a/guava/src/main/java/com/pholser/junit/quickcheck/guava/generator/OptionalGenerator.java b/guava/src/main/java/com/pholser/junit/quickcheck/guava/generator/OptionalGenerator.java index 9d05f3929..5ef8b40b4 100644 --- a/guava/src/main/java/com/pholser/junit/quickcheck/guava/generator/OptionalGenerator.java +++ b/guava/src/main/java/com/pholser/junit/quickcheck/guava/generator/OptionalGenerator.java @@ -36,6 +36,8 @@ a copy of this software and associated documentation files (the import java.util.ArrayList; import java.util.List; +import java.util.Arrays; + /** * Produces values of type {@link Optional}. */ @@ -85,4 +87,11 @@ public OptionalGenerator() { .map(componentGenerators().get(0)::magnitude) .orElse(ZERO); } + private void sum() { + int a[] = {2, 6, 1, 4}; + int b[] = {2, 1, 4, 4}; + + int result[] = new int[a.length]; + Arrays.setAll(result, i -> a[i] + b[i]); + } } diff --git a/pom.xml b/pom.xml index db7e26025..c39666ae9 100644 --- a/pom.xml +++ b/pom.xml @@ -371,6 +371,35 @@ + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + 0 + 0 + true + 0 + 0 + 0 + 0 + + + xml + + true + + + + post-integration-test + + check + cobertura + + + + org.apache.maven.plugins maven-source-plugin @@ -409,28 +438,17 @@ - org.apache.maven.plugins - maven-project-info-reports-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin + org.codehaus.mojo + cobertura-maven-plugin + 2.7 - default - javadoc + cobertura - - - org.jacoco - jacoco-maven-plugin - - - org.apache.maven.plugins - maven-pmd-plugin + @@ -449,6 +467,7 @@ + github-pages-site From 40aaab19e533ae487fb4efe96310d79e71108f90 Mon Sep 17 00:00:00 2001 From: mehmetyz Date: Mon, 1 Aug 2022 16:38:40 +0300 Subject: [PATCH 2/7] Upload 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 121dab4d6..a85c37e38 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 332e6d891b2f541af055c8cab4a8203e7061c750 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:33 +0300 Subject: [PATCH 3/7] Update foresight.yml --- .github/workflows/foresight.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/foresight.yml b/.github/workflows/foresight.yml index a85c37e38..96d924922 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -10,6 +10,7 @@ on: env: FORESIGHT_UPLOADER_SIGNER_URL: https://upload.thundra.us + WORKFLOW_TELEMETRY_BASE_URL: https://foresight.service.thundra.us jobs: build: From 4d3f3a1f3c518e6c2b976fa0fd51401127bdd1f3 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:15 +0300 Subject: [PATCH 4/7] 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 96d924922..ddf0f5f25 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: @@ -37,7 +37,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: cobertura/xml From f3b0ccb352365f9c64d322c1e64c85911fa41446 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:26 +0300 Subject: [PATCH 5/7] 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 f2f9b214ddb2156ae9b2ebac9271e085fb49fa88 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:10 +0300 Subject: [PATCH 6/7] 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 ddf0f5f25..ea7e20e50 100644 --- a/.github/workflows/foresight.yml +++ b/.github/workflows/foresight.yml @@ -6,7 +6,8 @@ on: pull_request: branches: [ "master" ] workflow_dispatch: - + schedule: + - cron: "0 1 * * *" env: FORESIGHT_UPLOADER_SIGNER_URL: https://upload.service.runforesight.us From 23a862a3a6fde2e948e2bc77bf1aa53e13967492 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:39:57 +0300 Subject: [PATCH 7/7] Update README.md (#5) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 931c3dde6..06f971240 100644 --- a/README.md +++ b/README.md @@ -1,14 +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 |