A simplified Data-driven software automation testing framework along with Library architecture with multithreaded test execution implemented using Selenium and TestNG. For reference, use the sample project - gSTAX-Example
- Add the following code to your pom.xml file.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.georgescaria</groupId>
<artifactId>gSTAX</artifactId>
<version>main-SNAPSHOT</version>
</dependency>- In your project, create a package named com.gSTAX.Tests and add your test classes. Extend the class InitialSetup where the driver and Test Case ID (TC_ID) is initialized.
package com.gSTAX.Tests;
import org.testng.annotations.Test;
import com.gSTAX.Setup.InitialSetup;
public class Website extends InitialSetup
{
@Test
public void WebsiteTest() throws Exception
{ //Perform actions }
}-
In the project root folder, create a folder named Test Data. Create a new excel file Testdata.xls/Testdata.xlsx. Format all the cells to 'Text' Structure the excel file in the below format.
TC_ID Execute Class Name URL Browser TC_1 Y Amazon https://amazon.com Chrome TC_2 N Google https://google.com Edge The Test Cases that have a corresponding Execute column value 'Y' will only be run. For the above sample Testdata, only the class Amazon will run(create class Amazon.class in your project - com.gSTAX.Tests.Amazon). The website https://amazon.com will open up in Chrome browser. The following browsers are supported:
- Chrome
- Firefox
- Edge
- Opera
-
Right click on the TestNG.xml file in your project and Run as RestNG Suite. And there you go!
The test run report will be generated and saved in the folder Test Results in your project root folder.
To use the Reporting functions, import the below to your Test class file.
import com.gSTAX.Utilities.Report;The below reporting actions can be performed using the Report keyword.
-
Informational
- Log event
Report.logEvent("Log event");
- Take screenshot
Report.takeScreenshot();
- Take screenshot with log message
Report.takeScreenshot("Take screenshot with Log");
-
Passing Test Case/ Test Step
- Pass with log message
Report.pass("Pass test with log");
- Pass test with screenshot
Report.passWithScreenshot();
- Pass test with screenshot and log message
Report.passWithScreenshot("Pass test step with screenshot and log");
-
Fail Test Case/ Test Step
- Fail with log message
Report.fail("Fail test with log");
- Fail test with screenshot
Report.failWithScreenshot();
- Fail test with screenshot and log message
Report.failWithScreenshot("Fail test step with screenshot and log");