Automation Set Up and Scripting Instruction
Automation Set Up and Scripting Instruction
Automation Set Up and Scripting Instruction
(Windows):
1. Go to: https://www.oracle.com/java/technologies/downloads/#jdk22-linux
- Select JDK 22> Select OS (Linux, Mac, Windows) > Select .exe file to download
Click New:
Add this value: %JAVA_HOME%\bin
Click OK
4. Open cmd and type “java -version” to check if JDK has been installed successfully and java version is
shown.
II/ Install IntelliJ:
1. Access this link: https://www.jetbrains.com/idea/download/?section=windows
Scroll down and download this version (Community Edition)
3.After successful installation, open cmd and type “git –version” to check if git has been installed.
Firstly, brainstorm and outline the test scenarios you’re going to write: which module, which
pages, which functionality, what are the web elements you’re going to interact with.
Then go to tests folder and create separate feature file for each module like this:
This is a sample Test Scenario for Payment Mode:
The tag name (eg: @PaymentMode) helps us to pick up any scenarios that we want to run which
will be configured in test runner> xml files.
“Example” is mandatory in scenario which is the test data File we use for the scenario
Inside the loc file we will declare all the web element locators of the pages: fields, buttons,
textboxes, title,…..
The element locator should be xpath and following existing Json format, For example:
3. Create Page Classes to write step definition for steps (main automation scripts).
We also have separate classed for each module:
Note that we will use a lot of pre-configured methods in some classes (Browser Global,
lhubCommonBase, lhubCommonSteps) which are common actions interacting with web elements
like scroll to elements, verify the presence of elements, click on buttons, input texts to fields…..
For example, if you want to verify if an element is present, the script will be like:
5. For the step when user must input multiple data to multiple fields, it’d better to prepare test data
file (excel) and use this below structure (e.g)
6. After scripts are created in page class, go to test runner to create xml file to configure test run.
This line means all the scenarios having the tag name= @PaymentMode will be executed in test
run:
6. After test runner.xml created, open Terminal (Alt +F12) and run this command:
mvn clean install -DtestSuiteFile="test-runner/{name of the text runner file}"\
(e.g: mvn clean install -DtestSuiteFile="test-runner/PaymentMode_runner.xml"\)
7. After text execution is completed, to read report, right click dashboard.htm> Open
In>Browser>Chrome to view test result report:
Test passes:
Report Details: