junit-quickcheck-core

Property-based testing, JUnit-style: core functionality

License

License

Categories

Categories

JUnit Unit Testing
GroupId

GroupId

com.pholser
ArtifactId

ArtifactId

junit-quickcheck-core
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

junit-quickcheck-core
Property-based testing, JUnit-style: core functionality
Project URL

Project URL

http://github.com/pholser/junit-quickcheck

Download junit-quickcheck-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.pholser/junit-quickcheck-core/ -->
<dependency>
    <groupId>com.pholser</groupId>
    <artifactId>junit-quickcheck-core</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.pholser/junit-quickcheck-core/
implementation 'com.pholser:junit-quickcheck-core:1.0'
// https://jarcasting.com/artifacts/com.pholser/junit-quickcheck-core/
implementation ("com.pholser:junit-quickcheck-core:1.0")
'com.pholser:junit-quickcheck-core:jar:1.0'
<dependency org="com.pholser" name="junit-quickcheck-core" rev="1.0">
  <artifact name="junit-quickcheck-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.pholser', module='junit-quickcheck-core', version='1.0')
)
libraryDependencies += "com.pholser" % "junit-quickcheck-core" % "1.0"
[com.pholser/junit-quickcheck-core "1.0"]

Dependencies

compile (6)

Group / Artifact Type Version
junit : junit jar 4.13.1
org.hamcrest : hamcrest-core jar 1.3
org.javaruntype : javaruntype jar 1.3
ognl : ognl jar 3.1.12
ru.vyarus : generics-resolver jar 3.0.1
org.slf4j : slf4j-api jar 1.7.25

test (5)

Group / Artifact Type Version
org.hamcrest : hamcrest-library jar 1.3
org.mockito : mockito-all jar 1.10.19
com.google.guava : guava jar 29.0-jre
com.google.guava : guava-testlib jar 29.0-jre
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

Build Status Code Quality: Java Total 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.

Documentation

Documentation for the current stable version

Basic example

    import com.pholser.junit.quickcheck.Property;
    import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
    import org.junit.runner.RunWith;

    import static org.junit.Assert.*;

    @RunWith(JUnitQuickcheck.class)
    public class StringProperties {
        @Property public void concatenationLength(String s1, String s2) {
            assertEquals(s1.length() + s2.length(), (s1 + s2).length());
        }
    }

Other examples

After browsing the documentation, have a look at some examples in module junit-quickcheck-examples. These are built with junit-quickcheck.

Versions

Version
1.0
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9
0.8.2
0.8.1
0.8
0.8-beta-2
0.8-beta-1
0.8-alpha-8
0.8-alpha-7
0.8-alpha-6
0.8-alpha-5
0.8-alpha-4
0.8-alpha-3
0.8-alpha-2
0.8-alpha-1
0.7
0.7-beta-2
0.7-beta-1
0.7-alpha-2
0.7-alpha-1
0.6.1
0.6
0.6-beta-1
0.6-alpha-3
0.6-alpha-2
0.6-alpha-1
0.5
0.5-beta-1
0.5-alpha-4
0.5-alpha-3
0.5-alpha-2
0.5-alpha-1
0.4
0.4-beta-3
0.4-beta-2
0.4-beta-1
0.3
0.2
0.1