首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >maven-surefire-plugin无法加载我的suiteXmlFile

maven-surefire-plugin无法加载我的suiteXmlFile
EN

Stack Overflow用户
提问于 2018-04-27 23:32:32
回答 1查看 509关注 0票数 0

maven-surefire-plugin无法加载我的suiteXmlFile。'willUsePorts‘和'deviceInfos’的返回值仅为null。请告诉我出了什么问题。

下面是我的pom.xml和结构。(我的结构: ptas/src/test/suite/AppiumTestSuite.xml)

我的结构: ptas/src/test/suite/AppiumTestSuite.xml

代码语言:javascript
复制
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.netmarble</groupId>
    <artifactId>ptas</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>ptas</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20.1</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/suite/AppiumTestSuite.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <systemProperties>
                        <property>
                            <name>method</name>
                            <value>${method}</value>
                        </property>
                        <property>
                            <name>willUsePorts</name>
                            <value>${willUsePorts}</value>
                        </property>
                        <property>
                            <name>deviceInfos</name>
                            <value>${deviceInfos}</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.11.0</version>
        </dependency>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>5.0.2</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>1.2.5</version>
        </dependency>
    </dependencies>
</project>

EN

回答 1

Stack Overflow用户

发布于 2018-04-28 12:07:07

这个问题与TestNG或您的套件xml文件没有任何关系。

您基本上是在配置surefire插件来设置一些JVM参数(通过系统属性)。但是这些JVM参数的值被称为属性(因为您已经使用了${willUsePorts}${deviceInfos})。

因此,Maven将尝试在pom.xml<properties>部分下查找分别名为<willUsePorts><deviceInfos>的条目。因为在pom文件中没有定义这样的值,所以这两个JVM参数的值被设置为null

要解决这个问题,您应该在运行mvn test时从命令行传递-DwillUsePorts-DdeviceInfos,或者应该如上所述在<properties>部分下添加相应的属性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50065753

复制
相关文章

相似问题

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