Open joshughes opened 11 years ago
I don't think we'll attempt to make any reporters thread safe. I think it's easier to fix Cucumber so it only accesses reporters from a single thread.
WDYT?
Fixing the internals of cucumber-jvm to support multithreading while maintaining the committed to api for reporters/formatters will be difficult at best (some of the implicit contracts about ordering will need to be broken). I'd rather see cucumber-jvm execute in a thread safe way.
To get there, it might be interesting to attempt this by making the json formatter, have it act as an intermediary holder of state, until passing it off to other real formatters. Internal state storage needs to happen somewhere.... the json reporter could become a report aggregator and proxy.
Refactor-rinse-repeat?
In my project we are using parallel test, cucumber and Gherkin gesm to generate the HTML reports. In the project we are using JSONFormatter to write a json, due to multithreaded environment it is giving us malformed JSON every time. Please refer the attachment for the same.
If you have any solution to synchronize the threads while writing on JSON then please suggest us, Tons of thanks in advance.
in Gherkin library, they just need to move to google Gson, whivch is maintaining a ThreadLoacl, instead of their Gson, which uses a HashMap
When running Cucumber tests in parallel only the last RunCukes.java class to be executed writes to the json report. This is a problem for anyone that consumes the report downstream. @rexhoffman mentioned this would be easy to do.