Katalon | Cucumber | How to run Tests / Features in Parallel
Assumption here - we have good understanding of following tool / terminologies.
* Cucumber Tool (Basic Idea)
* Katalon Tool
Problem Statement:
As an Automation Tester,
I want to execute my cucumber automation suites in parallel
So that Total test execution time can be reduced.Apart, it would be great if I can also achieve below goal-
* Able to select type of browser while execution.
* Able to see test artifacts at the end of execution (ex: Screenshots, Test Execution Video, High level execution summary, etc)
Solution:
Note: There could be several solutions but let me explain the one what I have recently explored. Here, Objective is to run modules/suites in parallel and NOT the each test cases.
Katalon has in-built component called “Test Suite Collection”. A Test Suite Collection contains a list of test suites to allow users more options for planning their test execution. It has two execution mode.
- Sequential: the test suites will be executed one after another.
- Parallel: the test suites will be executed at the same time.
You can add a test suites into a collection by following below steps:
* Assumed that test suites have been already created.
* A test suite is a collection of multiple test cases. In other words, a test suite contains all the test materials required to conduct a test execution. More Info
- Click on “Add” to add test suites
2. All test suites in Katalon Studio are displayed in Test Suite Browser. Select your test suites to be executed then click OK
3. The selected test suites will be added to the test suite collection accordingly
where,
- Run with = The environment to be executed with the Test Suite. (Can define different browser, Mobile device, etc)
- Profile = Execution Profile that contains all variables values for each Test Suite execution.
- Run = This is checked by default. It means that the test case will be executed when running the collection.
Note: You can add one test suite to the collection multiple times. This is particularly helpful when the users want to execute the same suite on different environments.
4. Execute a Test Suite Collection. All test suites will be executed accordingly
5. Reports can be viewed directly inside each Report >Test Suite Collection.
Have we solved the PROBLEM?
— — — — — — — — — — — — — — — — — — — — — —
Well, whatever I have mentioned up to till, demonstrate how we can run suites in parallel. Let me give more context with respect to Cucumber feature files.
So, We have agreed that we need to have test suite collection to run test parallel. And we are supposed to add test suites within test suite collection.
Assumed that Recruitment software has 3 modules -· Candidate
· Position
· InterviewWe should have test-cases / Feature files / Test scenarios for each above modules & we have marked/categorized properly each scenarios with proper tags (ex: @Candidate , @Position, @Interview)
- Create Cucumber Test Runner:
Let’s create cucumber runner for each modules (Candidate, Position, Interview). Ex: MyCucumberRunnerPosition.class
// MyCucumberRunnerPosition.class@RunWith(Cucumber.class)
@CucumberOptions(features= ["Include/features/"],
glue="",
plugin = ["pretty",
"junit:ReportFolder/cucumber.xml","json:ReportFolder/cucumber.json","html:ReportFolder"], tags = ["@Position","not @wip"])
public class MyCucumberRunnerPosition {
}
2. Create Test case and bind Runner:
How to create Test case and bind runner, Please refer here.
3. Create Test Suites & Add Test case:
How to create Test suite and add test cases, Please refer here.
4. Create Test Suite Collection:
- Create Test Suite Collection and all test suites created for each modules inside. More Info, refer here
5. Execute Test suite collection.
- So following objectives have been achieved now -
- We will be able to run tests parallel by modules (Position, Candidate, Interview)
- We are able to choose browser type based on our need.
- We are able to generate reports after the test execution. (At least report.)
- And as far as few other artifacts are concerned like Video, screenshot, etc. we can have below setting under Project > Settings.
Hence, below is the overall hierarchy we need to have in order to run cucumber scenarios in parallel [Module wise].