Cucumber - hooks
Feature: Creat e hooks feature file
Scenario: Login to the gmail application
Given Login to the Application with the valid Credentails
Then Verify the title of the page
And Logout the applcation and close
Scenario: Login to the Yahoo application
Given Login to the Yahoo Application with the valid Credentails
Then Verify the title of the Yahoo page
And Logout the Yahoo applcation and close
Scenario Outline: Login to dubm Website
Given Login and test scenarioOutline
Then Verify dubm the "<title>"
And close the application
Examples:
|title|
|FreeCRM|
|PaidCRM|
|PreCRM|
|PostCRM|
package StepDefination;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class HooksStepGenerator {
// @Before
// public void setUp() {
// System.out.println("@Before---Opening all the connections");
// }
//
// @After
// public void tearDown() {
// System.out.println("@After--Closing all the applications");
// }
@Given("^Login to the Application with the valid Credentails$")
public void login_to_the_Application_with_the_valid_Credentails() throws Throwable {
System.out.println("1st-Gmail test case");
}
@Then("^Verify the title of the page$")
public void verify_the_title_of_the_page() {
System.out.println("2nd-Gmail test case");
}
@Then("^Logout the applcation and close$")
public void logout_the_applcation_and_close() {
System.out.println("3rd-Gmail test case");
}
@Given("^Login to the Yahoo Application with the valid Credentails$")
public void login_to_the_Yahoo_Application_with_the_valid_Credentails() {
System.out.println("1st-Yahoo test case");
}
@Then("^Verify the title of the Yahoo page$")
public void verify_the_title_of_the_Yahoo_page() {
System.out.println("2nd-Yahoo test case");
}
@Then("^Logout the Yahoo applcation and close$")
public void logout_the_Yahoo_applcation_and_close() {
System.out.println("3Rd-Yahoo test case");
}
@Given("^Login and test scenarioOutline$")
public void login_and_test_scenarioOutline() throws Throwable {
System.out.println("ogin and test scenarioOutline");
}
@Then("^Verify dubm the \"([^\"]*)\"$")
public void verify_dubm_the(String arg1) {
// Write code here that turns the phrase above into concrete actions
System.out.println(arg1);
}
@Then("^close the application$")
public void close_the_application() throws Throwable {
System.out.println("close application");
}
}
Scenario: Login to the gmail application
Given Login to the Application with the valid Credentails
Then Verify the title of the page
And Logout the applcation and close
Scenario: Login to the Yahoo application
Given Login to the Yahoo Application with the valid Credentails
Then Verify the title of the Yahoo page
And Logout the Yahoo applcation and close
Scenario Outline: Login to dubm Website
Given Login and test scenarioOutline
Then Verify dubm the "<title>"
And close the application
Examples:
|title|
|FreeCRM|
|PaidCRM|
|PreCRM|
|PostCRM|
package StepDefination;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class HooksStepGenerator {
// @Before
// public void setUp() {
// System.out.println("@Before---Opening all the connections");
// }
//
// @After
// public void tearDown() {
// System.out.println("@After--Closing all the applications");
// }
@Given("^Login to the Application with the valid Credentails$")
public void login_to_the_Application_with_the_valid_Credentails() throws Throwable {
System.out.println("1st-Gmail test case");
}
@Then("^Verify the title of the page$")
public void verify_the_title_of_the_page() {
System.out.println("2nd-Gmail test case");
}
@Then("^Logout the applcation and close$")
public void logout_the_applcation_and_close() {
System.out.println("3rd-Gmail test case");
}
@Given("^Login to the Yahoo Application with the valid Credentails$")
public void login_to_the_Yahoo_Application_with_the_valid_Credentails() {
System.out.println("1st-Yahoo test case");
}
@Then("^Verify the title of the Yahoo page$")
public void verify_the_title_of_the_Yahoo_page() {
System.out.println("2nd-Yahoo test case");
}
@Then("^Logout the Yahoo applcation and close$")
public void logout_the_Yahoo_applcation_and_close() {
System.out.println("3Rd-Yahoo test case");
}
@Given("^Login and test scenarioOutline$")
public void login_and_test_scenarioOutline() throws Throwable {
System.out.println("ogin and test scenarioOutline");
}
@Then("^Verify dubm the \"([^\"]*)\"$")
public void verify_dubm_the(String arg1) {
// Write code here that turns the phrase above into concrete actions
System.out.println(arg1);
}
@Then("^close the application$")
public void close_the_application() throws Throwable {
System.out.println("close application");
}
}
package Runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features="C:\\Ecillipse-Java\\UnitedCumcumFreecrm\\src\\main\\java\\Features\\TaggedHooks.feature",
glue= "StepDefination",
plugin= {
"pretty", "html:test-output", "json:json_output/cucumber.json",
"junit:junit_output/cucumber.xml" },
dryRun=true,
strict=true,
monochrome=true)
//tags= {"@E2ETest", "@RegresssionTest","@SmokeTest"})//2
//tags={"~@E2ETest", "~@RegresssionTest","~@SmokeTest"})//11
//tags= {"@SmokeTest, @RegresssionTest"})//9
//tags= {"@SmokeTest", "@RegresssionTest"})//3
// tags= {"@SmokeTest"})//6
// tags= {"@RegresssionTest"})//6
// Tags OR --- {"@SmokeTest,@RegressionTest"}--execute all tests tags as @SmokeTest OR @RegressionTest
//Tags AND --- {"@E2ETest", "@RegresssionTest"})execute all tests tags as @E2ETest AND @RegressionTest
//@SmokeTest @RegresssionTest
//Ignore Test in cucumber----
//tags={"~@E2ETest", "~@RegresssionTest","~@SmokeTest"})
public class HooksTestRun2 {
}
Comments
Post a Comment