GingerSpec Formatter - veepee-oss/gingerspec GitHub Wiki
By default, Gingerspec uses a custom formatter for printing the currently running tests to the console. This is a custom implementation of the cucumber PrettyFormatter called TestNGPrettyFormatter that allows more flexibility with colors and other formatting options. Error messages generated from other classes are printed using the standard log4j.
The main objective when creating the TestNGPrettyFormatter was to make test CLI output as similar as possible to the original Feature file representation. It allows the developer to more easily follow through the test's execution, and at the same time, it is easier to read and to detect what went wrong and where.
TestNGPrettyFormatter brings some new functionality not originally present in the regular Pretty formatted:
- Unlike PrettyFormatter, this formatter also prints things like Docstrings and Datatables
- Instead of printing the whole stack trace of the error when an assertion fails, only the main message of the assertion is printed, which makes tests easier to read (this can be overridden by using -DSHOW_ERRORS_STACKTRACE)
- If the variable -DSHOW_STACK_INFO is present, the formatter will print the step definition location and arguments
- Print comments written on top of steps (#log) and even do variable replacement on them
- Last but not least, this formatter also makes variable replacement, so it will correctly print Gingerspec custom variables (${VAR})
- It prints a banner at the beginning and a help message with useful comments at the end of the test suite. You can even customize these banners with whatever info you like. For this, just create a banner.txt file with your custom banner and a helpMessage.txt file with your custom footer message in the /resources folder of the project