При запуске автотеста ошибка Cannot instantiate class

Рейтинг: 0Ответов: 0Опубликовано: 08.01.2023

Работали тесты до определенного момента.
Не поняла, что сломалось.

При запуске теста выдает ошибку:

Cannot instantiate class.

Использую idea/selenium/testng/java

Я думаю, что проблема с maven-surefire-plugin, но пока не разобралась в чем конкретно.

В проекте есть файл testng.xml

Файл Pom.xml. В таком варианте тесты запускались.

<groupId>org.example</groupId>
<artifactId>Project</artifactId>
<version>1.0-SNAPSHOT</version>


<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <aspectj.version>1.9.9.1</aspectj.version>
    <testing.version>7.6.1</testing.version>
    <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <testngXML>testng.xml</testngXML>

</properties>


<build>
    <resources>
        <resource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            
            <dependencies>
                <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjrt -->
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjrt</artifactId>
                    <version>${aspectj.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>


<dependencies>
    <!-- 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>

    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testing.version}</version>
        <scope>import</scope>
    </dependency>
    <dependency>
        <groupId>netease-im-clj</groupId>
        <artifactId>netease-im-clj</artifactId>
        <version>0.1.0</version>
        <scope>compile</scope>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>clojars</id>
        <name>Clojars</name>
        <url>https://repo.clojars.org/</url>
    </repository>
</repositories>

Пробовала добавлять конфигурацию

<configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles>
                <suiteXmlFiles>
                    <file>src/test/resources/testng.xml</file>
                </suiteXmlFiles>
                <properties>
                    <property>
                        <name>testnames</name>
                        <value>All Test Suite</value>
                    </property>
                </properties>

и обновила <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version> до версии 3.0.0-M7и не работает.

Ответы

Ответов пока нет.