Skip to content

innogames/junit5-scenario-builder

Repository files navigation

release license publish

Scenario Builder for Integration Tests

A Junit 5 extension that introduces a "Scenario Builder" to your tests giving you the following benefits:

  • Test scenarios are very easy to define, using a builder-like fluent API
  • Tests are more readable and easy to understand
  • Reduces the general maintenance effort

Documentation

Quick Example

Here's a simple example how a "login" test could look like:

@Test
public void testLogin() {
    // Prepare test scenario by creating a user
    scenarioBuilder.build(scenario -> scenario
        .withUser(user -> user
            .withUsername("Christian")
            .withPassword("MySecretPassword")
        )
    );
    
    // ... Call login endpoint
    
    // ... Assert that login was successful
}

See more examples in the test folder.

About

Junit5 extension that introduces a Scenario Builder to your tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages