Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spring] Start and stop test context once per scenario #2517

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Apr 8, 2022

The TestContextAdaptor would start the scenario scope once at the start of
each test, then another one to run the after test method hooks. Refactored
code to make the order of operations more obvious.

Also prevented scenario scopes from being registered more then once. Though
because CucumberScenarioScope delegates everything to CucumberTestContext
this effectively only reduces the log spam a bit at debug level.

Fixes: #2516

@mpkorstanje mpkorstanje force-pushed the spring--start-test-context-once branch 2 times, most recently from 73c0fa8 to ef8efed Compare April 9, 2022 00:04
@codecov
Copy link

codecov bot commented Apr 9, 2022

Codecov Report

Merging #2517 (633f41f) into main (3df1505) will decrease coverage by 0.02%.
The diff coverage is 92.85%.

❗ Current head 633f41f differs from pull request most recent head 6c85990. Consider uploading reports for the commit 6c85990 to get more accurate results

@@             Coverage Diff              @@
##               main    #2517      +/-   ##
============================================
- Coverage     83.80%   83.77%   -0.03%     
- Complexity     2649     2690      +41     
============================================
  Files           309      319      +10     
  Lines          9354     9475     +121     
  Branches        912      918       +6     
============================================
+ Hits           7839     7938      +99     
- Misses         1182     1200      +18     
- Partials        333      337       +4     
Impacted Files Coverage Δ
...java/io/cucumber/spring/CucumberScenarioScope.java 46.66% <0.00%> (ø)
...n/java/io/cucumber/spring/CucumberTestContext.java 70.96% <100.00%> (+3.22%) ⬆️
...rc/main/java/io/cucumber/spring/SpringFactory.java 91.66% <100.00%> (ø)
...in/java/io/cucumber/spring/TestContextAdaptor.java 87.14% <100.00%> (+0.77%) ⬆️
.../io/cucumber/examples/wicket/main/view/Create.java 71.42% <0.00%> (ø)
.../io/cucumber/examples/wicket/main/Application.java 92.85% <0.00%> (ø)
...ucumber/examples/wicket/main/model/entity/Car.java 100.00% <0.00%> (ø)
...examples/wicket/main/model/dao/InMemoryCarDAO.java 70.58% <0.00%> (ø)
.../io/cucumber/examples/spring/application/User.java 100.00% <0.00%> (ø)
.../cucumber/examples/spring/application/Message.java 75.00% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3df1505...6c85990. Read the comment docs.

@mpkorstanje mpkorstanje force-pushed the spring--start-test-context-once branch from 633f41f to 0c3e0b1 Compare April 10, 2022 13:03
@mpkorstanje mpkorstanje changed the title [Spring] Start test context once per scenario [Spring] Start and stop test context once per scenario Apr 10, 2022
@mpkorstanje mpkorstanje force-pushed the spring--start-test-context-once branch from 0c3e0b1 to 6c85990 Compare April 10, 2022 13:11
@mpkorstanje mpkorstanje marked this pull request as ready for review April 10, 2022 13:20
@mpkorstanje mpkorstanje merged commit f5f1ace into main Apr 10, 2022
@mpkorstanje mpkorstanje deleted the spring--start-test-context-once branch April 10, 2022 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spring] CucumberTestContext is started twice and stopped only once
1 participant