Cucumber - TaggedHooks

Feature: Test Tagged Hooks

@First
Scenario: This is FIRST test
Given this is first step
Then this is second step
Then this is third step

@Second
Scenario: This is SECOND test
Given this is a first step
Then this is a second step
Then this is a third step

@Third
Scenario: This is THIRD test
Given this is the first step
Then this is the second step
Then this is the third step

----------------------------------------------------

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=false,
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 TaggedHooksTestRun3 {

}

---------------------------------------------------------------
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 TaggedHooks {

@Before(order=0)
public void setUp() {
System.out.println("!!OrderFirst--OPEN!!");

}
@After(order=0)
public void tearDown() {
System.out.println("OrderFirst-$$END$$");
}
@Before(order=1)
public void BeforeUp() {
System.out.println("!!OrderSecond--OPEN!!");

}
@After(order=1)
public void AfterDown() {
System.out.println("OrderSecond-$$END$$");
}
@Before("@first")
public void BeforeUp1() {
System.out.println("!!@first-OPEN!!");

}
@After("@first")
public void AfterDown2() {
System.out.println("@first-$$END$$");
}
@Given("^this is first step$")
public void this_is_first_step() {
System.out.println("@first-this is first step");

}

@Then("^this is second step$")
public void this_is_second_step() {
System.out.println("@first-this is Second step");
// Write code here that turns the phrase above into concrete actions

}

@Then("^this is third step$")
public void this_is_third_step() {
System.out.println("@first-this_is_third_step");
// Write code here that turns the phrase above into concrete actions

}

@Given("^this is a first step$")
public void this_is_a_first_step() {
System.out.println("@Second-this is a first step");
// Write code here that turns the phrase above into concrete actions

}

@Then("^this is a second step$")
public void this_is_a_second_step() {
System.out.println("@Second-this is a second step");// Write code here that turns the phrase above into concrete
// actions

}

@Then("^this is a third step$")
public void this_is_a_third_step() {
System.out.println("@Second-this is a third step");
// Write code here that turns the phrase above into concrete actions

}

@Given("^this is the first step$")
public void this_is_the_first_step() {
System.out.println("@Third-this is the first step");
// Write code here that turns the phrase above into concrete actions

}

@Then("^this is the second step$")
public void this_is_the_second_step() {
System.out.println("@Third-this is the second step");
// Write code here that turns the phrase above into concrete actions

}

@Then("^this is the third step$")
public void this_is_the_third_step() {
System.out.println("@Third-this is the third step");
// Write code here that turns the phrase above into concrete actions

}

}


Comments

Popular posts from this blog

Implicit and Explicit Waits,FluentWait,PageLoadTimeOut

A Interview Questions- selenium