import static com.autoexsel.webdriver.WebDriverManager.*;
import org.testng.annotations.AfterSuite;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(features = "features/", glue = "autoexsel/cucumber/", tags = { "@verifyStepDef" })
public class WebTestRunner extends AbstractTestNGCucumberTests {
@AfterSuite
public void teardown() {
closeExecution();
}
}
@Before
public void startTestReport(Scenario scenario) throws Exception {
startTest(scenario.getName());
}
@After
public void endTestReport(Scenario scenario) {
System.out.println(scenario.getName()+" :"+scenario.getStatus().toUpperCase()+"\n");
endTest();
}
AutoExSel provides many inbuilt functions which helps to automate web application along with API. Import below packages to use inbuilt functions.
import static com.autoexsel.webdriver.WebDriverManager.*;
import static com.factory.services.wrapper.RestAssuredManager.*;
findByAny("btnK").as("Button").click();
public static String searchInput = "q";
public static String searchResult = "//h3[@class='LC20lb']";
And use variable name in line of code e.g. findByAny(searchInput).as("Search Field").sendKeys(arg1);
{
"step-definition": "autoexsel.cucumber.test", //package name under .../src/test/java
"or-path": "object-repositories"
}
Note: refer config.json and add/update the configuration keys value pair in configuration file as required. Value of step-definition can be autoexsel OR autoexsel.cucumber OR autoexsel.cucumber.test.
public static String searchInput;
public static String searchResult;
And use variable name in line of code e.g. findByAny(searchButton).as("Search Button").click();
{
"searchButton": {
"name": "btnK"
}
}
IMPORTANT: Class file (where searchButton
is used) and JSON file name must be same.