JGiven v0.5.0 Release Notes

  • ๐Ÿ†• New Features

    Derived Parameters #15

    Derived parameters are parameters of step methods that are not directly passed to the scenario as a parameter, but are derived from them.

    โœ… Consider the following example that tests that a simple calculator can add 1 to some input number:

    @Test
    @DataProvider( { "0", "1", "3" })
    public void the_calculator_should_be_able_to_add_one(int input) {
       given().a_calculator()
       when().adding_$_and_$( input, 1 );
       then().the_result_is( input + 1 );
    }
    

    The parameter of the last step the_result_is is not explicitly given as a parameter of the test method. Instead it is just derived from the input. In v0.4.0, JGiven would then not be able to generate a data table ๐Ÿ–จ and fall back to print every case individually in the report. In v0.5.0, JGiven will treat this derived parameter just like a normal parameter and will generate a data table for it. The name of the placeholder is then taken from parameter name of the step method. In addition, if an explicitly parameter is not used at all (but only derived values) it will not even appear in the data table.

    Highlighting of case differences #14

    If multiple cases of the same scenario are structurally different, JGiven cannot generate a data table for them. ๐Ÿ–จ Instead each case is printed individually in the report. The problem is that the differences between the cases are often hard to spot. To help the reader, the differences are now highlighted in the HTML report.

    Smaller enhancements

    • ๐Ÿ‘‰ Show number of cases in the scenario headline of the HTML report #26
    • Elapsed time in HTML report should be shown in a convenient unit #24
    • โœ… Test against different JUnit versions #22

    ๐Ÿ›  Fixed Bugs

    • โœ… JGiven creates null.json files for test classes where all tests are ignored #25
    • ๐Ÿ–จ Printed reports should not have collapsed scenarios #23

    Backwards incompatible changes

    JSON Model

    • ๐Ÿ‘ The JSON model has been changed to support #15. This means that JSON models generated with v0.4.0 will not work with the report generator of v0.5.0. This is in general no problem, because new JSON files are generated each time you execute your tests.