My test context (using the spring annotation @Component and wired to my steps with @Autowired) is dirty after a scenario, and I want it to auto-reset so the scenario coming next has a clean context before it starts.
I can manually do it with the cucumber annotation @Before/@After, but then it will show up in the report, and I don't want that because it has no business value.
Runner class
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/features",
glue = "com.company.steps",
tags = "@smoke",
plugin = {"pretty", "json:target/cucumber-report/cucumber.json", "html:target/cucumber-report/html"})
public class RunCucumber {
}
cucumber.xml (spring configuration file)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.funky.company"/>
</beans>
Cucumber: 4.8.0
Spring: 5.2.0.RELEASE
Junit: 4.12