Just started a QA Automation tester course and I am having some problems with IntelliJ. When I am trying to run a test I get Process finished with exit code 0 and no tests were found.
public class MyStoreTest {
private WebDriver driver;
@BeforeEach
public void beforeEach() {
System.setProperty("webdriver.chrome.driver", "src/test/resources/drivers/chromedriver.exe");
this.driver = new ChromeDriver();
this.driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(16));
this.driver.get("https://mystore-testlab.coderslab.pl/index.php");
}
@Test
public void MyStoreTest() {
MyStoreMainPage MyStoreMainPage = new MyStoreMainPage(driver);
MyStoreMainPage.clickSignIn();
MyStoreAuthenticationPage authenticationPage = new MyStoreAuthenticationPage(driver);
String email = "oetuomldfaacfducoz@bvhrk.com";
String password = "1992Dawid";
authenticationPage.submitSignIn(email , password);
MyStoreAddAnAddressPage AddAnAddress = new MyStoreAddAnAddressPage(driver);
AddressData AddressData = new AddressData()
.setAddress("Ul.Pulawska")
.setZip("02-508")
.setCity("Warszawa");
AddAnAddress.AddAnAddress(AddressData);
MyStoreMyAccountPage myAccountPage = new MyStoreMyAccountPage(driver);
assertTrue(myAccountPage.isAddressSuccessfullyAdded());
}
}
How can I understand why it can find no test? I am would be really grateful for any answers
Other than no tests found I get
org.junit.platform.launcher.core.DefaultLauncher handleThrowable WARNING: TestEngine with ID 'junit-vintage' failed to discover tests org.junit.platform.commons.JUnitException: Failed to parse version of junit:junit: 4.13.2 at org.junit.vintage.engine.JUnit4VersionCheck.parseVersion(JUnit4VersionCheck.java:54) at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:37) at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:32) at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:61) at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:177) at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:164) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
wrz 15, 2022 12:31:10 AM org.junit.platform.launcher.core.DefaultLauncher handleThrowable WARNING: TestEngine with ID 'junit-jupiter' failed to discover tests java.lang.NoClassDefFoundError: org/junit/jupiter/api/io/CleanupMode at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:66) at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:177) at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:164) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: java.lang.ClassNotFoundException: org.junit.jupiter.api.io.CleanupMode at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 10 more
Maybe the problem is in my java classes?
public class AddressData {
private String Address;
private String City;
private String Zip;
public String getAddress() {
return Address;
}
public AddressData setAddress(String Address) {
this.Address = Address;
return this;
}
public String getCity() {
return City;
}
public AddressData setCity(String City) {
this.City = City;
return this;
}
public String getZip() {
return Zip;
}
public AddressData setZip(String Zip) {
this.Zip = Zip;
return this;
}
}
public class MyStoreAddAnAddressPage {
public WebDriver driver;
public MyStoreAddAnAddressPage(WebDriver driver) {
this.driver = driver;
}
public void AddAnAddress(AddressData AddressData) {
WebElement AddressInput = driver.findElement(By.name("address1"));
AddressInput.sendKeys(AddressData.getAddress());
WebElement CityInput = driver.findElement(By.name("city"));
CityInput.sendKeys(AddressData.getCity());
WebElement ZipInput = driver.findElement(By.name("postcode"));
ZipInput.sendKeys(AddressData.getZip());
WebElement saveButton = this.driver.findElement(
By.name("submitAddress")
);
saveButton.click();
}
}
public class MyStoreAuthenticationPage {
@FindBy(css = "href#log.in.to.your.customer.account")
private WebElement signIn;
@FindBy(name = "email")
private WebElement emailInput;
@FindBy(name = "password")
private WebElement passwordInput;
@FindBy(id = "submit-login")
private WebElement signInButton;
private WebDriver driver;
public MyStoreAuthenticationPage(WebDriver driver) {
PageFactory.initElements(driver, this);
}
public void submitSignIn(String email, String password) {
emailInput.sendKeys(email);
passwordInput.sendKeys(password);
signInButton.click();
}
}
public class MyStoreMainPage {
public WebDriver driver;
public MyStoreMainPage(WebDriver driver) {
this.driver = driver;
}
public void clickSignIn() {
WebElement signIn = this.driver.findElement(
By.cssSelector("href#log.in.to.your.customer.account")
);
signIn.click();
}
}
public class MyStoreMyAccountPage {
public WebDriver driver;
public MyStoreMyAccountPage(WebDriver driver) {
this.driver = driver;
}
public boolean isAddressSuccessfullyAdded() {
WebElement confirmationPanel = this.driver.findElement(
By.cssSelector("article.alert.alert-success")
);
String panelText = confirmationPanel.getText();
return panelText.equals("Address successfully added!");
}
}
