quickcheckng

A TestNG @DataProvider generator for QuickCheck Generators

License

License

Apache License
GroupId

GroupId

com.theoryinpractise
ArtifactId

ArtifactId

quickcheckng
Last Version

Last Version

1.1.4
Release Date

Release Date

Type

Type

jar
Description

Description

quickcheckng
A TestNG @DataProvider generator for QuickCheck Generators
Project URL

Project URL

http://maven.apache.org
Source Code Management

Source Code Management

http://github.com/talios/quickcheckng

Download quickcheckng

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
com.squareup : javapoet jar 1.2.0
net.java.quickcheck : quickcheck jar 0.6
io.reactivex : rxjava jar 1.0.13
org.testng : testng jar 6.9.4

test (1)

Group / Artifact Type Version
com.google.truth : truth jar 0.27

Project Modules

There are no modules declared in this project.

QuickCheckNG

Introduction

QuickCheckNG is a Java Annotation Processor to generate TestNG @DataProvider methods for a set of QuickCheck generators.

Building

mvn clean install

Usage

Include in your project a class named *Generators.java with a set of public static methods returning Generator instances:

package com.theoryinpractise.quickcheckng.example;

import com.theoryinpractise.quickcheckng.DataProviders;
import net.java.quickcheck.Generator;

import static net.java.quickcheck.generator.CombinedGenerators.uniqueValues;
import static net.java.quickcheck.generator.PrimitiveGenerators.strings;

@DataProviders
public class PasswordGenerators {

  public static Generator<String> validPasswords() {
    return strings("ABCDEFG123456", 6, 60);
  }

}

When compiling, the following class will be generated for you:

package com.theoryinpractise.quickcheckng.example;

import java.util.Iterator;
import org.testng.annotations.DataProvider;
import static com.theoryinpractise.quickcheckng.testng.GeneratorProvider.toObjectArrayIterator;

public final class PasswordGeneratorsDataProviders {

  /**
   * A TestNG @DataProvider for the validPasswords quickcheck generator
   */
  @DataProvider
  public static final Iterator<Object[]> validPasswords() {
    return toObjectArrayIterator(PasswordGenerators.validPasswords());
  }

}

The generated @DataProvider method simply wraps the QuickCheck Generator, wrapping each generated value in a 1 element object array to be passed to a TestNG test:

@Test(dataProviderClass = PasswordGeneratorsDataProviders.class, dataProvider = "validPasswords")
public void testPasswordLengths(String password) {
  try {
    UserManagerImpl.validatePassword(password);
  } catch (SmxValidationFailureException e) {
    fail("Valid length password should not fail: " + password + " - " + e.getMessage());
  }
}

License

Apache 2.0

Versions

Version
1.1.4
1.1.3
1.1.2
1.1.1
1.0.1