- Java 7 is not supported anymore
- Make it easier to copy the stack trace from an error message #380
- Fix NPE when having @Disabled test in JUnit 5 #376
- Java 11 is supported now #370
- Fixed an issue with JUnit 5 and parameterized tests to get the argument values #372
- First release of the Spock integration #358 (thanks to mustaine)
- TestNG SkipExceptions are now recognized #355
- Fixed a bug that prevented the use of the PowerMockRunner #365
- Fixed a NPE that was thrown when the
@Table
annotations was used with an empty list #341
- Java 10 is supported now #345
- Fixed an IllegalArgumentException when creating thumbnails for very small images #329 (thanks to maccluca)
- Fixed NPE when using JUnit 5 and one test class has only disabled method #338
- Fixed minor issue in JUnit 5 example that did not generate the HTML 5 report #340
- Java 6 is not supported anymore
- Removed usages of
javax.xml.bind
, so that JGiven can be used with Java 9 without hassle #324
- Fixed a
NullPointerException
in the PojoFormatter when passed object isnull
#318 - Fixed JUnit 5.0.0 compilation issue due to API changes #326
The JGiven HTML5 App is extracted into its own project. This allows us to develop the HTML5 App independently of JGiven as it is also used by jsGiven. However, the App will also be delivered together with JGiven so for users of JGiven nothing should change.
- Fixed a
NullPointerException
when using@Table(includeNullColumns = true)
and columns with null values #315
- Thumbnail preview for image attachments added #299
- The ReportGenerator now uses the HTML5 report as default, doesn't silently misinterprets wrong arguments and flags and offers suggestions #299
- Formatting POJOs has been greatly improved, by allowing to specify custom formatters for fields #297 (thanks to dgrandemange)
- @ExtendedDescription supports parameter place holders now #283
- The HTML App has been extracted into a separate project and has been refactored internally. The functionality should not have been changed. #287
- Upgraded to ByteBuddy 1.6.x to fix backwards-incompatibility issues when JGiven is used with Mockito 2.7.19 #309
- Introduced CaseAs annotation to replace the CaseDescription annotation #301
- Removed ambiguity between parsing of As, CaseAs and ExtendedDescription. Argument enumeration starts from 1, internal count of how often placeholders are used, see docs to As for every feature. All argument reference types are interoperable #301
- Performance: Caching the classes generated with ByteBuddy introduced with v0.14.0 to decrease the memory consumption and performance of creating stage classes #294
- OSGi: Using class loader of the stage class instead of the current thread when creating classes with ByteBuddy #302
- HTML Report: Long exception messages of failed Scenarios are now wrapped #292
The internal JGiven interception mechanism was changed to use ByteBuddy instead of cglib. The main reason for this change is support for Android (see below). From a users perspective, JGiven should behave as before.
In order to fix issue #259 the Spring integration was largely rewritten. If you only had used the @EnableJGiven
and @JGivenStage
annotations, nothing should change.
If you had a custom Spring configuration for JGiven you have to change the following:
- The classes
SpringStepMethodInterceptor
andJGivenStageAutoProxyCreator
do not exist anymore, you have to remove all references - As a replacement the new class
JGivenBeanFactoryPostProcessor
exists now. You have to register this bean in your Spring configuration
- Experimental support for JUnit 5 has been added #277
- Tags with the same name, but different packages are now correctly distinguished #242 (thanks to ahus1)
- Scenario states can be marked as required to make scenarios fail quickly and with a clear message if the state hasn't been provided #255 (thanks to Airblader)
- Added prefined Spanish JGiven classes for writing JGiven Scenarios in Spanish #284 (thanks to elenagarcia5)
JGiven can now be used together with JUnit 5, by using the JGivenExtension
. Refer to the user guide for additional details. #277
There is a new experimental module called jgiven-android
, which enables JGiven support for tests executed on the device or simulator.
This makes it possible to combine JGiven with Espresso tests and even integrate screenshots in the JGiven report.
For details of how to setup and use the Android support have a look at the jgiven-android-test
project.
Also see #258
Special thanks to orginx
- Spring Integration: Nested Steps are now supported when using Spring #259
- Maven Plugin: The default values of the Maven plugin now work again #276
In order to fix issue #239, a backwards incompatible change had to be done:
- The
ScenarioBase
class is now abstract, because the methodgetScenario()
was made abstract. Thus, subclasses have to implement thegetScenario()
method. As, in general, you should have inherited either fromScenarioTest
orSimpleScenarioTest
the change should most likely not effect you. If you have directly inherited fromScenarioBase
, have a look at theScenarioTest
class of how to implement thegetScenario()
method.
- Custom annotations can now also be defined for the
@Table
annotation #235 - In addition to text and images, all kinds of media types can now be used as attachments #228 (thanks to ahus1)
- Assertion errors shown in the HTML report respect line breaks now. #234
- TestNG: executing test methods in parallel is now possible. #239
- Correctly handle nested steps in parametrized scenarios. #248
- Correctly report pending status of parametrized scenarios. #200
- Spring: added support for executing Spring tests with the Spring JUnit rules instead of the Spring test runner. #250
- Fixed an issue in the HTML5 report to correctly show the value instead of an unresolved funtion #233
- Added possibility to use JGiven in JUnit by just using two rules. No deriving from ScenarioTest is necessary anymore, see #232
- Allow multiple formatter annotations on arguments, e.g., "@Quoted @YesNo", see #204.
- Added a new comment() method to provide further information on specific step method invocations, see #50.
- Steps can now have multiple attachments #194.
- Tags can now be hidden from the navigation bar in the HTML report by setting the
showInNavigation
attribute tofalse
#211. - Added a new CurrentScenario interface similar to CurrentStep.
- The CurrentScenario interface allows adding tags programmatically, see #172.
- Allow tag annotations on step methods and step classes.
- Extended the @As annotation with a provider mechanism, see #189.
- Due to the introduction of multiple attachments per step, the JSON model had to be changed in an backwards-incompatible way. Instead of a single field
attachment
that holds a single attachment object, a step has now anattachments
field that holds an array of attachment objects.
- Fixed an issue that step methods that are all uppercase are formatted in an unexpected way #221
- Fixed an issue that newlines of formatted arguments have not been formatted in the HTML5 report #226
- Don't show multiple indexed attachments when cases are not shown as tables #207 (thanks to ahus1)
- The @CaseDescription annotation can now also be applied to the test class #198
- Fixed an issue introduced with v0.11.1 that made the report generation dependent on the locale of the system instead of using utf-8 PR#196 (thanks to ahus1)
- Fixed an issue introduced with v0.11.1 that for scenarios with attachments and multiple cases, only the attachment of the first case was shown in the HTML report #191
- The size of the HTML report has been greatly reduced by compressing the scenario data with gzip. This significantly reduces the load time of large reports on slow network connections. #186
- HTML Report: fixed an issue with the search input in the mobile menu that was hidden on mobile devices when the virtual keyboard appeared. #182
- JUnit: throwing an AssumptionViolationException will not lead to a failed scenario anymore. Instead, the scenario will be ignored and will not appear in the report at all. #185
Scenarios can have sections now. This allows you to structure larger scenarios into several parts with a title. PR#181
Example:
section("This is a section title");
given().something();
when().something();
section("This is another section title");
when().something_else();
then().something();
Sections appear in the console output as well as the HTML report.
The color used in the console output has been changed. It is now less colorful and usable on dark and light backgrounds. Setting the system property jgiven.report.text.color
to true
now always enables the color output, even if the output is not a TTY.
- Fixed an issue with carriage returns messing up the cases table. #178
- Fixed an issue with certain characters used in a
@CaseDescription
annotation. #177
Steps can now have nested steps that are shown in the report. This is done by annotating parent steps with the new @NestedSteps
annotation. #17, PR#174. Thanks to @albertofaci!
The @Table
annotation to format step parameters as tables has been extended with several options to further customize the formatting of the resulting tables. #122
- HTML Report: case tables have sortable columns #175
- HTML Report: case tables can be grouped by values #168
- Exception type is now added to the error message of a failed step #154
- Fixed the issue that tags of subclasses would not be visible on scenarios of superclasses #171
- Fixed the issue that exceptions thrown in methods called within step methods are captured #173
- This version was published in a broken state to maven central, please use version v0.10.1 instead
- Fixed issue with primitive arrays and the @Table annotation #162
- Fixed an issue when using the
@Table
parameter that could lead to unwanted parameters in the data table #161 - Fixed an issue with the Maven Plugin where the customJsFile parameter actually set the customCssFile parameter #167
- Fixed an issue with the @Table annotation when combining numberedRows with columnTitles #166
- Fixed an issue in the console report that new lines a data table messed up the layout of the table #152
- Fixed an issue that blank values could not be formatted #157
- Fixed an issue that the total duration of a scenario was shown as the duration of the first case instead of the sum of all case #155
- HTML Report: fixed the minor issue that clicking the status doughnot does not work when the report has just been opened #149
- Spring support has been simplified by a new annotation
@EnableJGiven
and XML element <jgiven:annotation-driven />. Special thanks to TripleNail for this contribution. #153 - Scenarios without steps can now be excluded from the report by using the new
--exclude-empty-scenarios
report generator option #151 - Underlines in parameter names are now replaced with spaces in the report #147
- HTML Report: highlight failing cases of a scenario #150
- HTML Report: indicate the number of failed cases #156
- HTML Report: limit the width of columns in the data table #141
- HTML Report: fixed an issue that inline attachments are shown multiple times #145
- HTML Report: fixed an issue with attachments that could lead to the generation of attachments with identical names, overriding attachments of other scenarios #144
- Attachments can now have a custom filename #144
- HTML Report: allow arbitrary protocols in custom navigation links #146
- Cases can now have custom descriptions by using the new annotation
@CaseDescription
#139. - Custom test class suffixes can now be configured using the
@AbstractJGivenConfiguration
annotation.
- Global formatter now apply also to subtypes of the types they are configured for #137
- Fixed an issue with TestNG that when using a data provider and one case fails the TestNG status was still reported as success. #138
It is now not possible anymore to have spaces/underlines in placeholder variables. The rational behind this change is that the old behavior was hard to understand and did not really give much additional value.
The old behavior allowed placeholder variables to have spaces/underlines if the variable was terminated with another$
. Consider the following example:
given().a_step_with_a_$placeholder_variable$_with_spaces( "foobar" );
Before v0.9.0 this resulted in the following report:
Given a step with a foobar with spaces
I.e. the complete string $placeholder_variable$
was replaced. From v0.9.0 on this will not be possible anymore. In fact, the terminating $
will be treated as a new placeholder variable.
A placeholder variable must match the regular expression \$[a-zA-Z0-9]*
. In particular, it cannot contain the _
character. The above example, will now even throw a JGivenWrongUsageException
because the number of arguments do not match the number of placeholders anymore.
If you relied on the fact that placeholders can contains spaces or underlines, you have to rename your variables to camelCase. In addition, you have to remove the trailing $
. So the above example becomes:
given().a_step_with_a_$placeholderVariable_with_spaces( "foobar" );
- The name of the test class is now used by JGiven to group scenarios. The
@As
annotation can be used to define a different name. #133 - Scenarios can now have an extended description by annotated the test method with
@ExtendedDescription
. #35 - The stack trace of a failing scenario is now stored and shown in the HTML report #95
- Formatter for step parameters can now be defined by using the
@JGivenConfiguration
annotation on a test class. - HTML Report: made title of the HTML report configurable using the new
--title
parameter of the report generator #131 - HTML Report: added possibility to provide a
custom.js
file that is included in the generated report. This allows you to further customize the report. #129 - HTML Report: made status circle clickable to show failed, pending, or successful scenarios #130
- Special characters like parentheses are not treated as part of a placeholder name anymore #118
- Fixed in issue with TestNG introduced with v0.8.3 that a failing case does not lead to failed TestNG status #138
- Fixed an issue with TestNG that when using a data provider a failing case prevented following cases from finishing #123
- Fixed an issue that the status of the overall scenario could be successful although some cases of the scenario failed #125
- Introduced the annotation
@DoNotIntercept
, to completely circumvent the JGiven interception mechanism of step methods. #103 - Introduced new feature to directly show image attachment in the HTML report. This is done by calling
showDirectly()
on theAttachment
object. #117 - Introduced the possibility to automatically number the rows or columns of a table parameter. #116
- HTML Report: introduce pagination to better deal with large lists of scenarios. #120
- HTML Report: fixed an issue that caused the scenario list to only shows the first 20 entries #119
- Parameters of test methods can now also be formatted with formatters like step parameters. This is only relevant, however, when you have scenarios with multiple cases that do not generate a data table, but multiple cases #114
- 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
- Fixed an issue that the dataprovider with TestNG could not be used in parallel mode #105
- Fixed an issue that when using TestNG only a report for one test class was generated #115
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