When trying to run test using the runner for a test I creating for a feature file. The runner is build and completed successfully but nothing happens.
Feature File:
Feature: Login to Queries
#Login in Chrome
Scenario: Login using Chrome
Given I open Chrome
When I browse to Queries
Then I login to Queries using "pcy1" and "123"£"
Step Definition (this class extends the base class):
public class login extends base {
@Given("^I open Chrome$")
public void iOpenChrome() throws Throwable {
driver = initializeDriver();
throw new PendingException();
}
@When("^I browse to Queries$")
public void iBrowseToQueries() {
driver.get("https://atesting321.test/");
throw new PendingException();
}
@Then("^I login to Queries using \"([^\"]*)\" and \"([^\"]*)\"£\"$")
public void iLoginToQueriesUsingAnd£(String username, String password) throws Throwable {
driver.findElement(By.id("UserName")).sendKeys(username);
driver.findElement(By.id("Password")).sendKeys(password);
driver.findElement(By.id("btnLogin")).click();
throw new PendingException();
}
Runner
@RunWith(Cucumber.class)
@CucumberOptions(
features= "src/test/java/features/login",
glue= "stepDefinitions")
public class RunTest {
public static void main (String[] args)
{}
Base class (used as a global variables)
public class base {
public WebDriver driver;
public Properties prop;
public ChromeOptions coptions;
public WebDriver initializeDriver() throws IOException
{
prop= new Properties();
String browserName= "chrome";
System.out.println(browserName);
String pathToDriver = "";
if(browserName.equals("chrome"))
{
pathToDriver = "C:\\Repositories\\automationProject\\webDrivers\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", pathToDriver);
coptions.addArguments("disable-infobars");
coptions.addArguments("--start-maximized");
driver= new ChromeDriver(coptions);
//execute in chrome driver
}
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
return driver;
}
When I run the RunTest java file the below result is what I get:
Process finished with exit code 0
Aucun commentaire:
Enregistrer un commentaire