Reputation: 3
I am having an issue where a step in Scenario A (In feature file A) is executed (switched) with a step in Scenario B (in feature file B).
This issue leads to many case failures in my report. The issue is not only on the reporting because if it was in the reporting, the case would be successful with just wrong image
[Feature A: Testing Channel Page Functionality]
[Scenario A: User wants to view Channel Overview Page
[Step 1: Given User is on talent community page]
[Report Sample Image A]: https://i.sstatic.net/5ZqjXhHO.png
IS SWITCHED WITH
[Feature B: Testing candidate user login with registered email feature and editing profile feature]
[Scenario B: User wants to add University Education - Complete Data]
[Step 4: And Candidate fills in Study Area]
[Report Sample Image B]: https://i.sstatic.net/UDO38WvE.png
I am running using mvn clean verify, here are some codes from my project:
package org.hyrdnewcompany.acceptancetests;
import net.serenitybdd.junit5.SerenityJUnit5Extension;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;
//@RunWith(CucumberWithSerenity.class)
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("features")
@ConfigurationParameter(key = "cucumber.plugin", value = "io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:target/cucumber-report.json")
@ConfigurationParameter(key = "cucumber.glue", value = "org.hyrdnewcompany.steps, org.hyrdnewcompany.hooks")
public class AcceptanceTestSuite {
}
package org.hyrdnewcompany.hooks;
import io.cucumber.java.After;
import io.cucumber.java.BeforeStep;
import io.cucumber.java.AfterStep;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import static net.thucydides.core.webdriver.ThucydidesWebDriverSupport.getDriver;
public class Hooks {
private static final long STEP_DELAY = 2000; // 2 seconds
@BeforeStep
public void beforeStep() {
waitFixedTime(STEP_DELAY);
}
@AfterStep
public void afterStep() {
waitFixedTime(STEP_DELAY);
}
private void waitFixedTime(long delayMillis) {
CountDownLatch latch = new CountDownLatch(1);
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.schedule(latch::countDown, delayMillis, TimeUnit.MILLISECONDS);
try {
latch.await(); // Wait for the latch to count down after the delay
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.out.println("Fixed wait was interrupted.");
} finally {
scheduler.shutdown(); // Clean up the scheduler
}
}
@After
public void tearDown() {
if (getDriver() != null) {
getDriver().quit();
}
}
}
cucumber.execution.parallel.enabled=true
cucumber.execution.parallel.config.strategy=fixed
cucumber.execution.parallel.config.fixed.parallelism=6
cucumber.execution.parallel.config.fixed.max-pool-size=6
cucumber.execution.execution-mode.feature=same_thread
cucumber.plugin=io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:target/test-results/timeline
cucumber.execution.timeout=60000
webdriver.driver = provided
webdriver.provided.type = mydriver
webdriver.shared=false
webdriver.provided.mydriver = org.hyrdnewcompany.driver.CustomDriver
thucydides.driver.capabilities = mydriver
serenity.timeout = 60000
serenity.take.screenshots=BEFORE_AND_AFTER_EACH_STEP
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<includes>
<include>**/acceptancetests/*.java</include>
</includes>
<argLine>-Xmx512m</argLine>
<parallel>methods</parallel>
<threadCount>6</threadCount>
<perCoreThreadCount>false</perCoreThreadCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 0
Views: 52