`-must need the DI injection constructor and how to use with detailed explanation. i already used properly but error coming
-Test runner how to use and what is missing my test runner
- Am using cucumber junit–> why hooks are not triggering.
package DI_constructor;
————this is my DI class——–
import org.openqa.selenium.WebDriver;
public class pagecontext {
public WebDriver getDriver() {
return driver;
}
public void setDriver(WebDriver driver) {
this.driver = driver;
}
private WebDriver driver;
}
———-this is my hooks class—————-
package Hooks;
import io.cucumber.java.Before;
public class myhooks {
private pagecontext context;
public myhooks(pagecontext context) {
this.context=context;
}
@BeforeClass
public void setup() {
System.setProperty("webdriver.edge.driver","C:/Users/DINESH.PALANIYANDI/eclipse-workspace/Shopify/src/test/resources/Drivers/msedgedriver.exe");
WebDriver driver=new EdgeDriver();
context.setDriver(driver);
context.getDriver().manage().window().maximize();
context.getDriver().manage().timeouts().implicitlyWait(Duration.ofSeconds(20));
}
@AfterClass
public void teardown() {
context.getDriver().close();
context.getDriver().quit();
}
}
—–this is my first test runner class ts01——-
package Testrunner;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/Features/F01_RegisterwithShopify.feature"},
plugin = {"pretty","html:C:/Users/DINESH.PALANIYANDI/eclipse-workspace/Shopify/target/Reports/F01_RegisterwithShopify.html"},
glue = {"StepDefinations_TS"},
monochrome = true,
dryRun = false )
public class TestrunnerTS01 {
}
———-this is my 2nd runner class————
package Testrunner;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/Features/F02_Configureyourstore.feature"},
glue = {"StepDefinations_TS"},
plugin = {"pretty","html:C:/Users/DINESH.PALANIYANDI/eclipse-workspace/Shopify/target/Reports/F02_Configureyourstore.html"},
monochrome = true,
dryRun = false )
public class TestRunnerTS02 {
}
`