Create proxy to allow JGiven to run with Class lifecycles
Especially TestNG cannot run in parallel with JGiven using injected stages, due to its lifecycle strategy. It would be nice to create a proxy for TestNG and by Extension JUnit5 to support those two testing frameworks more completely.
Follow-up for #829
Trying to get around the parallel dataprovider limitation that JGiven has with its TestNG integration...
In my scenario class defined stage fields as following (without using the @ScenarioStage annotation, which we all know it does not work well with parallel dataproviders):
protected ThreadLocal<ElasticSearchFixtures<?>> elasticSearchFixtures = new ThreadLocal<>();
// and similar for ElasticSearchActions and ElasticSearchVerifications stages
and initialization methods, like this:
protected ElasticSearchFixtures<?> given(
final ElasticSearchFixtures<?> fixtures) {
elasticSearchFixtures.set(fixtures);
return fixtures;
}
then, in scenario methods, I used these like this:
given(new ElasticSearchFixtures<>())
.elastic_search(configuration().elasticSearchClient())
.and().indexed_by(configuration().elasticSearchIndex())
.and().storing(JsonNode.class);
It all compiles fine, but fails with NPE because the fields in ElasticSearchActions and ElasticSearchVerifications are not injected.
I am not familiar with the injection mechanism used by JGiven, perhaps you can suggest something?
Do you have a more comprehensive sample? I am failing to understand, where these ElasticSearchActions and ElasticSearchVerifications are in the first place...
Are these supposed to be scenario states?
Do you have a more comprehensive sample? I am failing to understand, where these
ElasticSearchActionsandElasticSearchVerificationsare in the first place... Are these supposed to be scenario states?
see #1469 -- both are about how to use multiple stages in a parallel testing mode