I am from India, so while using the TestProject platform a famous movie always comes to mind 🎬 It’s called “Bhaubali”, and as of now, parts 1 & 2 were released.
I watched the second part of this movie before the first. And just like the Bhaubali part 2 makes me want to watch part 1, so does the TestProject platform. I am learning all tools and concepts available after trying a few, to achieve my personal and organizational goals.
In this article, I will elaborate on command prompt execution syntaxes of offline test cases, to achieve these goals. The above are software automation concepts such as data-driven testing execution, cross-browser testing execution, parallel execution, and batch execution 🌟
TestProject Test Case Execution – Table of Contents:
- Offline mode of test case creation in TestProject
- Local reports and custom report location
- Data-driven test case execution using the CLI
- Cross-browser test execution using CLI
- Parallel execution using CLI
- Batch execution
Offline mode of test case creation in TestProject
- Login to the TestProject platform dashboard
- Download the latest TestProject agent
- Install and register the agent
- Create a new project and a new test
- Provide the required application URL. Here I used the TestProject example link
- In Record click file for offline test case
- Click Start recording
- TestProject Recorder displayed in separate browser with application home page
- Here record all the steps, use parameters wherever required as well as validation
- Click the Save button. The created test case is saved in the Downloads folder in a YAML format
Local reports and custom report location
By default, after each test case execution, reports are generated in both the Cloud and the default local reports folder 📁 Here our requirement is to get local reports only, in the default local reports folder or custom report location. We can get local reports in two ways:
- By unregistering the TestProject agent and executing the test case, the report is generated locally
- By using the below syntax –report=LOCAL_REPORT, to get reports in local only:
testproject-agent run --parameters parameters.csv -o ~/Desktop --report=LOCAL_REPORT
Here -o ~/Desktop describes the custom report location in a local machine.
testproject-agent run F:\TestProject\tpp_2021-08-23_18_16_27.yaml –o F:\TestProject\Offline_report --report=LOCAL_REPORT
Data-driven test case execution using the CLI
Data-driven testing is a concept in which a user can create a test case for single data with the help of a parameter file, in order to execute the same test case with multiple data. It allows checking whether the application response is as expected or not.
In the above created offline test case by default, the application URL comes as a parameter in the TestProject platform. Fullname, Password, Address, Email, and PhoneNumber are created as parameters in order to pass different values via a .csv file to achieve data-driven testing.
Here the created offline test case name is tpp_2021-08-23_18_16_27 and the parameter filename is Parameters_jana.csv. In the example below, we have provided the file location for both test case and parameter file based on this syntax:
testproject-agent run MyFirstTestBackup.yaml --parameters parameters.csv
In command prompt use the below syntax for data-driven testing:
testproject-agent run F:\TestProject\tpp_2021-08-23_18_16_27.yaml –-parameters F:\TestProject\Parameters_jana.csv –o F:\TestProject\Offline_report --report=LOCAL_REPORT
Cross-browser test execution using CLI
In TestProject, after the creation of an offline mode for a test case in Chrome browser, the user is able to run in other browsers installed on their local machine (Edge, Firefox, and Internet Explorer). The test case will be executed in these browsers and reports are saved locally 💾
On my local machine, I have Chrome browser and Edge browser available, so I used these two browsers in my below syntax. If Mozilla Firefox is installed then –browser Firefox is used for execution in Firefox browser.
testproject-agent run MyFirstTestBackup.yaml --parameters parameters.csv o ~/Desktop –browser CHROME --browser FIREFOX --browser Edge --report=LOCAL_REPORT
testproject-agent run F:\TestProject\tpp_2021-08-23_18_16_27.yaml –-parameters F:\TestProject\Parameters_jana.csv –o F:\TestProject\Offline_report --browser CHROME --browser Edge --report=LOCAL_REPORT
Parallel execution using CLI
Execution settings for a stand-alone YAML file, the following options are available by -s or –settings should be used to provide an external setting file.
Enabling –parallel-targets will result in tests being executed one by one on all defined browsers/devices, in parallel.
Enabling –parallel-tests will result in all tests being executed on all defined browsers simultaneously 🎯 If a test has a data source, all data iterations will run at the same time as well.
SYNTAX for TestProject CLI for parallel execution:
testproject-agent run MyFirstTestBackup.zip --settings settings.yaml --parameters parameters.csv -o ~/Desktop --parallel-tests --browser CHROME --browser FIREFOX --browser Edge --report=LOCAL_REPORT
testproject-agent run F:\TestProject\tpp_2021-08-23_18_16_27.yaml --settings settings.yaml --parameters F:\TestProject\Parameters_jana.csv –o F:\TestProject\Offline_report --parallel-tests --browser CHROME --browser Edge --report=LOCAL_REPORT
Batch execution
As of now, we execute the single YAML file in the above automation execution. Here in batch execution, we can execute multiple YAML files in a single execution.
Dependency: Shell Script application needed. (MinGW) GitBash:
- Create a script file, it will contain all YAML files with the correct Syntax to run your files
- Save the file in Shell Script(.sh) format
- Keep the file with the sh application in a folder
- In command prompt, use the below command with the respective path of folder runner.sh. Here runner is the name of the saved file:
With the help of a minimal learning curve in software testing and automation concepts, every software tester can easily achieve results in a perfect manner! 💪