I have a some tests for android using Android Studio with jUnit. It is work. But, now i need use testNG. I have been include testng library
dependencies {
...
androidTestImplementation 'org.testng:testng:5.14.2'
implementation group: 'org.sonatype.http-testing-harness', name: 'testng-runner', version: '0.8'
...
}
After, I create test with TestNG annotations. But i can't run the test.
import com.example.gallyamovrifat.autotesting.Page.RolloutPage;
import org.testng.annotations.*;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObjectNotFoundException;
import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
public class RolloutKeysDownload {
private UiDevice device;
private RolloutPage page;
private final String ROC_ADDRESS = "****************";
private final String USER_NAME = "****************";
private final String PASSWORD = "****************";
@BeforeClass
public void SetUp(){
device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
page = new RolloutPage(device);
}
@Test
public void enterRolloutCenterAddress() throws UiObjectNotFoundException {
page.authorizationButtonClick();
String verifyAddress = page.enterRocAddress(ROC_ADDRESS);
assertEquals("Сертификат подтвержден", verifyAddress);
}
@Test
public void authorization() throws UiObjectNotFoundException {
boolean isAuthorized = page.joinButtonClick();
if (!isAuthorized) {
isAuthorized = page.authorize(USER_NAME, PASSWORD);
assertTrue(isAuthorized);
}
}
}
I get exception:
org.testng.TestNGException: Cannot find class in classpath: com.example.gallyamovrifat.autotesting.rollout.RolloutKeysDownload at org.testng.xml.XmlClass.getSupportClass(XmlClass.java:59) at org.testng.internal.ClassInfoMap.(ClassInfoMap.java:19) at org.testng.TestRunner.initMethods(TestRunner.java:389) at org.testng.TestRunner.init(TestRunner.java:228) at org.testng.TestRunner.init(TestRunner.java:198) at org.testng.TestRunner.(TestRunner.java:147) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:499) at org.testng.SuiteRunner.init(SuiteRunner.java:140) at org.testng.SuiteRunner.(SuiteRunner.java:104) at org.testng.TestNG.createSuiteRunner(TestNG.java:1039) at org.testng.TestNG.createSuiteRunners(TestNG.java:1025) at org.testng.TestNG.runSuitesLocally(TestNG.java:871) at org.testng.TestNG.run(TestNG.java:814) at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Aucun commentaire:
Enregistrer un commentaire