- Fixed the issue that test classes had to be compiled with the -parameters option of javac when using Java 8. This was fixed by upgrading to the newest version of the Paranamer library that now fully supports Java 8 #106
- Fixed an issue where different formatted parameters having the same value in all cases were collapsed to a single parameter #104
- Fixed issue introduced with v0.8.0 that tag descriptions that differ depending on a tag value are not correctly reported
Hierarchical Tags #99
Tags can now have parent tags by tagging a tag annotation. This allows you to define tag hierarchies.
The following example tags the FeatureHtml5Report
annotation with the FeatureReport
annotation:
@FeatureReport
@IsTag( name = "HTML5 Report" )
@Retention( RetentionPolicy.RUNTIME )
public @interface FeatureHtml5Report { }
Enhanced Spring Support #94
- The Spring support has been greatly improved. JGiven Stages can now be directly managed by the Spring framework, resulting in a much better Spring integration.
- Note that the usage of Spring is optional and is provided by the
jgiven-spring
module.
- Note that the usage of Spring is optional and is provided by the
- Introduced
@JGivenStage
to ease writing spring beans that act as JGiven stage - Thanks to TripleNail for providing this enhancement!
- Classes are shown now in hierarchical navigation tree and scenarios can be listed by package #91
- Durations are now shown in appropriate units instead of only showing them in seconds #92
- The navigation bar can now be hidden and resized #96
- Failed scenarios are now colored in red, pending scenarios are greyed out
- In the Summary section, the number of scenarios for each status are shown
- The new
style
attribute allows you to define arbitrary inline styles for tags that will be applied to the tag in the HTML5 report
- With this rule it is now easier to use JGiven without inheriting from
ScenarioTest
. Just put this rule as a@Rule
and theScenarioReportRule
as a@ClassRule
into your test class and you can use JGiven by injecting stages with@ScenarioStage
.
Removed the old static HTML report generator #101
- As the HTML5 report supports all the features of the static HTML report, the static HTML report has been completely removed to avoid duplicate efforts when implementing new features.
- HTML5 Report: fixed issue with duplicate entries in tables when used as step parameters #89
- HTML5 Report: fixed navigation and added searching in the mobile version
- HTML5 Report: fixed slow scrolling in case of large lists of scenarios
- Fixed an issue that the
@Description
annotation was not regarded for methods with the@IntroWord
#87 - TestNG: fixed missing support for injection of stages into the test class using the
@ScenarioStage
annotation - TestNG: fixed missing support for
@ScenarioState
annotation in test classes - Removed unneeded ICU dependency
- Introduced the
@As
annotation that replaces the@Description
annotation when used on step methods and test methods. The@Description
annotation should only be used for descriptions of test classes. - Added
@Pending
annotation to replace the@NotImplementedYet
annotation. #100
- The field
notImplementedYet
of theScenarioModel
was renamed topending
- The
StepStatus
NOT_IMPLEMENTED_YET
was renamed toPENDING
.
Note: in general, backwards incompatible model changes should be no problem, as long as you use the same version for all JGiven modules (core, html5-report, maven-plugin).
- Fixed major issue with Java 8 that prevented the usage of lambda expressions inside Stage classes #85
Note that due to this fix you have to compile your test classes with the
-parameters
flag of javac if you are using Java 8. - Fixed an issue in the HTML5 report which shows only attachments of the first case when having a parameterized scenario with multiple cases #77
Intro words are not necessary anymore #74
The following example is now a valid JGiven scenario, i.e. intro words are not required anymore:
given().frozen_strawberries()
.a_banana()
.milk();
when().mixing_everything_in_a_mixer();
then().you_get_a_delicious_smoothie();
The report will then look as follows:
Given frozen_strawberries
a banana
milk
When mixing everything in a mixer
Then you get a delicious smoothie
In previous versions of JGiven you would have to add an and()
before a_banana()
and milk()
- The HTML5 report now supports grouping, sorting, and filtering of result lists PR #81
- Added
cssClass
andcolor
attributes to@IsTag
to customize tags in HTML reports #69
- Custom CSS files are now copied to the target folder when generating HTML5 reports #70
- Introduce
columnTitles
attribute for the@Table
annotation #64 - Ignore
null
values of POJOs by default when using the@Table
annotation. This behavior can be overridden with theincludeNullColumns
attribute. - Allow $ to be escaped in step descriptions when using the
@Description
tag #19 - Speed-up the overall performance of JGiven by caching reflection-based look-ups
- Support for attachments on steps (Pull Request #56)
- Descriptions for tags can be dynamically created (Issue #55)
- Custom annotations can now be used to format arguments when they are annotated with the
@Format
annotation - Introduced a new
@Quoted
annotation to surround arguments with double quotes (" ") in reports
- String arguments are no longer put into single quotes (' ') when printed to the console
- Methods annotated with
@Hidden
see now injected values from the previous stage if they are the first method called on a stage - Fixes issue with IntelliJ JUnit runner that stays yellow when executing JGiven tests (Issue #58)
- Step parameters can now be annotated with
@Table
. - Such parameters are stored as a table instead of a plain string in the report model.
- Reporters present these parameters as data tables instead of plain strings.
- The type of these parameters can be
- A list of list (actually all types implementing Iterable are supported)
- A two-dimensional array
- A list or array of POJOs. In this case each POJO represents a single row and the fields of the POJOs are taken as columns
class CoffeeWithPrice {
String name;
double price_in_EUR;
CoffeeWithPrice(String name, double priceInEur) {
this.name = name;
this.price_in_EUR = priceInEur;
}
}
public SELF the_prices_of_the_coffees_are( @Table CoffeeWithPrice... prices ) {
...
}
given().the_prices_of_the_coffees_are(
new CoffeeWithPrice("Espresso", 2.0),
new CoffeeWithPrice("Cappuccino", 2.5));
Given the prices of the coffees are
| name | price in EUR |
+------------+--------------+
| Espresso | 2.0 |
| Cappuccino | 2.5 |
The same effect can be achieved without a POJO by using a two-dimensional array or a list of list.
given().the_prices_of_the_coffees_are( new Object[][] {
{ "name", "price in EUR" },
{ "Espresso", 2.0 },
{ "Cappuccino", 2.5}});
The HTML5 report now allows you to make bookmarks of arbitrary pages. The bookmarks are stored in the local storage of the browser.
@Hidden
annotation can be applied to step parameters
Step parameters can now be hidden in the report if they are annotated with the @Hidden
annotation.
- Core: Exceptions that are thrown after a scenario has been executed, e.g., in
@After
-annotated methods in JUnit, are not hiding the original exception thrown in the scenario (#49). - HTML5 Report: Split the JSON model into multiple files to avoid
script too large
errors in Firefox (#51) - HTML5 Report: Fixed issue with the encoding of tag URLs (#47)
There is a new HTML5 report that is completely written from scratch. Instead of mutliple static HTML pages it only consists of a single HTML page that dynamically loads its content from a single jsonp file that contains the model of the scenario report. As a result the overall size of the generated files is much smaller. In addition, the new report is based on Foundation, which is a modern CSS framework, so the new report also looks much nicer then the old static one. One of the main new features is also that the HTML5 report has a full text search built in that works without having to open all scenarios in a single HTML page. As it heavily relies on JavaScript, don't expect that it works on old Browsers.
- Core: An issue has been fixed where methods annotated with
@AfterStage
and@AfterScenario
could accidentally appear in the report when they have been overriden and not annotated again. - Core: An issue has been fixed where methods annotated with
@AfterStage
and@AfterScenario
have not been executed when an exception has been thrown (#46)
So far JGiven only reported public step methods. This behavior can lead to confusion, because it is not obvious that methods that are actually executed do not appear in the report. For this reason this behavior has been changed so that the visibility modifier is not taken into account anymore when reporting step methods.
If you have relied on the fact that non-public methods actually do not appear in the report, you can easily port your existing code by adding the @Hidden
annotation to the corresponding method to explicitly state that the method should be hidden in the report.
Use Stufe
class instead
As data tables are the default this annotation had no effect anymore, you can safely delete all usages.
The annotation is now just called @Description
.
tbd
- Text Report: Added status column to data tables #34
- HTML Report: Added expand all and collapse all buttons #37
- HTML Report: Correctly show status of failed scenarios where all steps have been successful #33
- HTML Report: Fix issue where in certain cases the content of a scenario was not expandable (no issue number)
- Step methods can now have extended descriptions with the
@ExtendedDescription
tag. The extended description can be shown in the HTML report. #30
- The scenario content can now be searched
- A page with all scenarios is now generated
- Fixed bug concerning duplicate parameters in data tables #32
- A page for all failed scenarios is now generated #29
- Classes and tags are shown in a hierarchical structure that can be searched #28
- The front page now contains statistics about the overall report instead of tags #8
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.
- 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
- JGiven creates null.json files for test classes where all tests are ignored #25
- Printed reports should not have collapsed scenarios #23
- 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.
- made scenarios and cases in HTML reports collapsible #18
- slightly changed layout and appearance of HTML reports
- measure duration of each step and include in reports #13
- scenarios are sorted by name in HTML reports
- fix issue with intercepting methods of stages during construction
- fix issue when multiple exceptions are thrown to throw the first one instead of the last one
- @ScenarioDescription is now deprecated, instead just use @Description #16
- @Description now also works on test classes
- fixed case generation for parameterized JUnit runner #21
- Arguments from JUnit Parameterized and JUnitParams runner can now be read
- Arguments from JUnit Dataprovider runner are now read directly instead of parsing them
- Schritte-class is deprecated and has been replaced with Stufe-class (only relevant for german scenarios)
- the HTML report now escapes HTML in step arguments #9
- print style of HTML report is nicer
- steps following failed steps are now reported as skipped
- @NotImplementedYet annotation has new attributes failIfPass and executeSteps #4