I have 2 feature files each with 2 scenarios. I want to execute scenarios from: * [First feature], [Second feature] - sequentially; * [Third feature] - in parallel;
I use tags and 2 Test Runners (with threadCount=1, threadCount=5), but all scenarios are executing in parallel (due to timeline.html).
Scenarios:
@sequential
Feature: First feature
Background:
# some code
@smoke
Scenario: f1, s1
# some code
@regression
Scenario: f1, s2
# some code
@sequential @smoke
Feature: Second feature
Background:
# some code
@smoke
Scenario: f2, s1
# some code
@regression
Scenario: f2, s2
# some code
Feature: Third feature
Background:
# some code
@smoke
Scenario: f3, s1
# some code
@regression
Scenario: f3, s2
# some code
Test runners for scenarios that should be executed sequentially:
@KarateOptions(tags = {"@regression,@smoke", "@sequential,~@ignore"})
public class TestsRunner extends TestSetBase {
@Test
public void AllSequentialTests() {
Results results = Runner.parallel(getClass(), 1, PropertyValues.getReportDir());
generateReport(PropertyValues.getReportDir());
assertTrue(results.getFailCount() == 0, results.getErrorMessages());
}
}
Test runner for parallel execution:
@KarateOptions(tags = {"@regression,@smoke", "~@sequential,~@ignore"})
public class TestsRunner2 extends TestSetBase {
@Test
public void AllSequentialTests() {
Results results = Runner.parallel(getClass(), 5, PropertyValues.getReportDir());
generateReport(PropertyValues.getReportDir());
assertTrue(results.getFailCount() == 0, results.getErrorMessages());
}
}
I'm running tests from maven:
...
<configuration>
<includes>
<include>api/TestsRunner.java</include>
<include>api/TestsRunner2.java</include>
</includes>
</configuration>
...
Currently, when I execute tests, timeline.html shows:
|ForkJoinPool-2-Worker1|----[f1, s1]
|ForkJoinPool-2-Worker2|----[f1, s2]
|ForkJoinPool-2-Worker3|----[f2, s1]---[f3, s2]
|ForkJoinPool-2-Worker4|----[f2, s2]
|ForkJoinPool-2-Worker5|----[f2, s1]
I tried to add @parallel=false, in such case s1, s2 will be executed sequentially, but f1, f2 have still be executed in parallel. I'm using KarateDSL v.0.9.3.
Do you have any ideas how to fix it?