junit-quickcheck-guava

Property-based testing, JUnit-style: generators for Guava types

License

License

Categories

Categories

JUnit Unit Testing Guava General Purpose Libraries Utility
GroupId

GroupId

com.pholser
ArtifactId

ArtifactId

junit-quickcheck-guava
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

junit-quickcheck-guava
Property-based testing, JUnit-style: generators for Guava types
Project URL

Project URL

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

Download junit-quickcheck-guava

How to add to project

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

Dependencies

compile (3)

Group / Artifact Type Version
junit : junit jar 4.13.1
com.pholser : junit-quickcheck-generators jar 1.0
com.google.guava : guava jar 29.0-jre

test (5)

Group / Artifact Type Version
org.hamcrest : hamcrest-core jar 1.3
org.hamcrest : hamcrest-library jar 1.3
org.mockito : mockito-all jar 1.10.19
ch.qos.logback : logback-classic jar 1.2.3
com.pholser : junit-quickcheck-core test-jar 1.0

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