Это мой файл testNG для моего проекта
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="mobile-automation-framework">
<parameter name="os" value="android" />
<listeners>
<listener class-name="UITestFramework.retryLogic.RetryListener" />
<listener class-name="UITestFramework.retryLogic.TestListener" />
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
<test name="LoginTest">
<classes>
<class name="tests.testngTests.e2e_Tests"/>
</classes>
</test>
</suite>
мой файл тестового примера
package tests.testngTests;
import org.testng.annotations.*;
import IntegrationTests.coreLogic.base.*;
import IntegrationTests.coreLogic.android.*;
import UITestFramework.CreateSession;
/**
* automated test to verify login to android/iOS app.
*/
public class e2e_Tests extends CreateSession {
LoginCoreLogic loginCoreLogic;
/**
* this method instantiate required helpers depending on the platform(android or iOS)
*
* @param invokeDriver android or iOS
*/
@Parameters({"os"})
@BeforeClass
public void instantiateHelpers(@Optional("android") String invokeDriver) {
//Load Test Data
if (invokeDriver.equalsIgnoreCase("android")) {
loginCoreLogic = new AndroidLoginHelper(driver);
} else if (invokeDriver.equalsIgnoreCase("iOS")) {
//loginCoreLogic = new IOSLoginCoreLogic(driver);
}
}
/**
* method to verify login to android and iOS app
*
* @throws InterruptedException Thrown when a thread is waiting, sleeping,
* or otherwise occupied, and the thread is interrupted, either
before
* or during the activity.
*/
@Test(priority = 0)
public void VerifyForgotPassword() throws InterruptedException {
System.out.println("inside test 1");
}
}
Журналы ошибок
[RemoteTestNG] detected TestNG version 7.0.1
Exception in thread "main" org.testng.TestNGException:
Cannot load class from file:
at org.testng.internal.ClassHelper.fileToClass(ClassHelper.java:340)
at org.testng.TestNG.configure(TestNG.java:1422)
at org.testng.remote.AbstractRemoteTestNG.configure(AbstractRemoteTestNG.java:75)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:235)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Я установил плагин testNG и testng зависимость в моем файле pom. Я не знаю, в чем причина этой ошибки. Пожалуйста, дайте мне знать, какое возможное решение этой проблемы. Я уже переустанавливаю плагин testNG и уже выполнил запуск, сборку, очистку проекта
pom. xml файл
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github</groupId>
<artifactId>mobile-automation-framework</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MobileAutomationFramework</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
<suiteXmlFiles>
<suiteXmlFile>"testng.xml"</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<suiteXmlFiles>-->
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
</property>
</properties>
<workingDirectory>target/</workingDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!--<systemPropertyVariables>
<property>
<invokeDriver>${invokeDriver}</invokeDriver>
</property>
</systemPropertyVariables>-->
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
<type>maven-plugin</type>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-configuration2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.saucelabs/sauce_java_common -->
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_java_common</artifactId>
<version>2.1.23</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.saucelabs/sauce_testng -->
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_testng</artifactId>
<version>2.1.23</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>