首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven execute不适用于TestNG.xml

Maven execute不适用于TestNG.xml
EN

Stack Overflow用户
提问于 2021-05-08 02:04:57
回答 2查看 131关注 0票数 0

嘿,伙计们,我在我的项目上被maven执行了。

我发布了maven告诉我的,当我试图和他一起执行时,XML本身是有效的,但没有else.so我需要一些帮助,我希望有人知道如何处理它。

代码语言:javascript
复制
    <dependencies>

       <!--  https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>4.4.1</version>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>2.13.0</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.0.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-edge-driver</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>com.github.stephenc.monte</groupId>
            <artifactId>monte-screen-recorder</artifactId>
            <version>0.7.7.0</version>
        </dependency>

        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.2.0</version>
        </dependency>

       <!-- <dependency>
            <groupId>com.experitest</groupId>
            <artifactId>appium</artifactId>
            <version>4.1.2</version>
        </dependency> -->

        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.13</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>3.3.0</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>3.3.0</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <version>3.3.0</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.24</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.7</version>
        </dependency>


    </dependencies>

构建的配置文件是

代码语言:javascript
复制
     <profiles>
            <profile>
                <id>web</id>
                 <build>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>2.14.1</version>
                            <configuration>
                                <includes>**/*Tests.java</includes>
                                <suiteXmlFiles>
                                    <suiteXmlFile>testNGWeb.xml</suiteXmlFile>
                                </suiteXmlFiles>
                                <argLine>
                                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                                </argLine>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>

当我尝试使用mvn测试-Pweb时,它会使

代码语言:javascript
复制
    [INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< org.example:FinalProject >----------------------
[INFO] Building FinalProject 1.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.092 s
[INFO] Finished at: 2021-05-07T20:56:53+03:00
[INFO] ------------------------------------------------------------------------

TestNgWeb.xml文件是

代码语言:javascript
复制
    <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Web Suite" parallel="false">
    <test name="Web Tests">
        <parameter name="PlatformName" value="web" />
        <classes>
            <class name="sanity.RedditWeb" />
        </classes>
    </test>
</suite>
EN

回答 2

Stack Overflow用户

发布于 2021-05-08 03:43:24

尝试从src开始设置xml的路径,例如:

代码语言:javascript
复制
<suiteXmlFile>src/test/java/testSuites/testNGWeb.xml</suiteXmlFile>
票数 0
EN

Stack Overflow用户

发布于 2021-05-08 14:30:36

我修复了我在pom pom上遇到的问题,所以我删除了它,然后重新运行,它就可以工作了。

代码语言:javascript
复制
<packaging>pom</packaging>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67439770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档