Skip to content

Cuppa - A test framework for Java 8

License

Apache-2.0, CC-BY-4.0 licenses found

Licenses found

Apache-2.0
LICENSE
CC-BY-4.0
LICENSE-docs
Notifications You must be signed in to change notification settings

phillcunnington/cuppa

 
 

Cuppa is a testing framework for Java 8. It makes writing tests productive and fun.

  • Be descriptive: Use strings – not identifiers – to clearly describe the behaviour you are testing. Test reports produced by Cuppa read like good documentation.
  • Group tests together: Create structure in your test files to reduce repetition and improve readability. Groups of tests can share setup and teardown steps.
  • Define tests at runtime: Cuppa makes it trivial to write parameterised tests. It's as simple as a for loop. Cuppa is also easy to extend - there's no need to write annotations.

Example

@Test
public class ListTest {
    {
        describe("List", () -> {
            describe("#indexOf", () -> {
                it("returns -1 when the value is not present", () -> {
                    List<Integer> list = Arrays.asList(1, 2, 3);
                    assertThat(list.indexOf(5)).isEqualTo(-1);
                });
            });
        });
    }
}

Check out the website for more examples.

Getting Started

For full details see the getting started guide on the website.

Maven

Add a test dependency for Cuppa in your project's POM:

<dependency>
    <groupId>org.forgerock.cuppa</groupId>
    <artifactId>cuppa</artifactId>
    <version>1.3.1</version>
    <scope>test</scope>
</dependency>

See the Maven integration guide for details on how to get Maven to run the tests automatically.

Plain Old Jar File

Alternatively, you can download binaries for the latest release.

To run your Cuppa tests, use the Cuppa API:

public class EntryPoint {
    public static void main(String[] args) {
        Runner runner = new Runner();
        TestBlock rootBlock = runner.defineTests(Collections.singletonList(MyTestClass.class));
        runner.run(rootBlock, new DefaultReporter());
    }
}

Contribute

Prerequisites

You'll need JDK 8 installed and available on the path.

Building

Cuppa is built using Gradle:

$ cd cuppa
$ ./gradlew build

Run ./gradlew tasks to see a list of all available tasks.

License

Cuppa is licensed under an Apache 2.0 license. The documentation is licensed under a Creative Commons license.

Cuppa is inspired by the wonderful Mocha, a testing framework for JavaScript.

About

Cuppa - A test framework for Java 8

Resources

License

Apache-2.0, CC-BY-4.0 licenses found

Licenses found

Apache-2.0
LICENSE
CC-BY-4.0
LICENSE-docs

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%