Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >在maven testng selenium java中禁用并行执行(使用surefire插件-它不会按照testng.xml中的顺序运行)

在maven testng selenium java中禁用并行执行(使用surefire插件-它不会按照testng.xml中的顺序运行)
EN

Stack Overflow用户
提问于 2020-07-13 13:11:57
回答 1查看 968关注 0票数 1

我正在开发一个Maven TestNG Selenium Java项目,并试图通过从pom.xml调用我的testng.xml来运行我的测试。项目本身在它的非maven版本中工作正常,但是当我通过pom.xml文件运行它时,它只是并行运行所有测试,打开网站并一起运行所有测试(我需要按顺序运行它们,因为它们相互依赖,而且@BeforeSuite@AfterSuite方法也工作得很好,问题只在于@Test类型的执行)

我试着在互联网上遵循了几个指南和类似的项目示例,并根据它们删除和添加了依赖项,但似乎都不起作用。

这是我当前的pom.xml (现在已经一团糟了):

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<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>ZafulSelMaven4</groupId>
  <artifactId>ZafulSelMaven4</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  
  <name>ZafulSelMaven4</name>
    <url>http://maven.apache.org</url>
    
 <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.argument.target>${maven.compiler.target}</maven.compiler.argument.target>
        <maven.compiler.argument.source>${maven.compiler.source}</maven.compiler.argument.source>
        <appium-java-client.version>7.1.0</appium-java-client.version>
        <spring-boot.version>2.1.6.RELEASE</spring-boot.version>
        <slf4j.version>1.7.25</slf4j.version>
        <logback.version>1.2.3</logback.version>
        
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <suiteXmlFile>testng.xml</suiteXmlFile>
        <java.version>1.8</java.version>
        <!--Dependency Versions-->
        <selenium.version>3.141.59</selenium.version>
        <assertj-core.version>3.15.0</assertj-core.version>
        <testng.version>7.1.0</testng.version>
        <query.version>2.0.0-BETA3</query.version>
        <!--Plugin Versions-->
        <driver-binary-downloader-maven-plugin.version>1.0.18</driver-binary-downloader-maven-plugin.version>
        <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
        <maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version>
        <!--Configuration Properties-->
        <overwrite.binaries>false</overwrite.binaries>
        <read.timeout>30000</read.timeout>
        <connection.timeout>40000</connection.timeout>
        <retry.attempts>4</retry.attempts>
        <browser>chrome</browser>
        <threads>1</threads>
        <remote>false</remote>
        <headless>true</headless>
        <seleniumGridURL/>
        <platform/>
        <browserVersion/>
        <proxyEnabled>false</proxyEnabled>
        <proxyHost/>
        <proxyPort/>
        <proxyUsername/>
        <proxyPassword/>
        
    </properties>
    <dependencies>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>${appium-java-client.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
            
        <dependency>
              <groupId>org.hamcrest</groupId>
              <artifactId>hamcrest</artifactId>
              <version>2.2</version>
        </dependency>
        
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version><!--$NO-MVN-MAN-VER$-->
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version><!--$NO-MVN-MAN-VER$-->
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>${selenium.version}</version><!--$NO-MVN-MAN-VER$-->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version><!--$NO-MVN-MAN-VER$-->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj-core.version}</version><!--$NO-MVN-MAN-VER$-->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.lazerycode.selenium</groupId>
            <artifactId>query</artifactId>
            <version>${query.version}</version>
            <scope>test</scope>
        </dependency>
         <dependency>
          <groupId>org.json</groupId>
          <artifactId>json</artifactId>
          <version>20170516</version>
          <scope>compile</scope>
        </dependency>
                
        <dependency>
         <groupId>com.googlecode.json-simple</groupId>
         <artifactId>json-simple</artifactId>
         <version>1.1.1</version>
         <scope>compile</scope>
       </dependency> 
       
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>selenium-tests</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M3</version>
                        <configuration>                                          
                         <suiteXmlFiles>
                          <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>               
                         </suiteXmlFiles>   
                         <suitename>Test_Suite</suitename>     
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                        </configuration>
                        <version>${maven-compiler-plugin.version}</version>
                    </plugin>
                    <plugin>
                        <groupId>com.lazerycode.selenium</groupId>
                        <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                        <version>${driver-binary-downloader-maven-plugin.version}</version>
                        <configuration>
                            <rootStandaloneServerDirectory>${project.basedir}/src/test/resources/selenium_standalone_binaries</rootStandaloneServerDirectory>
                            <downloadedZipFileDirectory>${project.basedir}/src/test/resources/selenium_standalone_zips</downloadedZipFileDirectory>
                            <customRepositoryMap>${project.basedir}/src/test/resources/RepositoryMap.xml</customRepositoryMap>
                            <overwriteFilesThatExist>${overwrite.binaries}</overwriteFilesThatExist>
                            <onlyGetDriversForHostOperatingSystem>false</onlyGetDriversForHostOperatingSystem>
                            <fileDownloadRetryAttempts>${retry.attempts}</fileDownloadRetryAttempts>
                            <fileDownloadReadTimeout>${read.timeout}</fileDownloadReadTimeout>
                            <operatingSystems>
                                <windows>true</windows>
                                <linux>true</linux>
                                <mac>true</mac>
                            </operatingSystems>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>selenium</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven-failsafe-plugin.version}</version>
                        <configuration>
                            <parallel>methods</parallel>
                            <threadCount>${threads}</threadCount>
                            <systemPropertyVariables>
                                <browser>${browser}</browser>
                                <screenshotDirectory>${project.build.directory}/screenshots</screenshotDirectory>
                                <remoteDriver>${remote}</remoteDriver>
                                <gridURL>${seleniumGridURL}</gridURL>
                                <desiredPlatform>${platform}</desiredPlatform>
                                <desiredBrowserVersion>${browserVersion}</desiredBrowserVersion>
                                <proxyEnabled>${proxyEnabled}</proxyEnabled>
                                <proxyHost>${proxyHost}</proxyHost>
                                <proxyPort>${proxyPort}</proxyPort>
                                <proxyUsername>${proxyUsername}</proxyUsername>
                                <proxyPassword>${proxyPassword}</proxyPassword>
                                <headless>${headless}</headless>

                                <!--Set properties passed in by the driver binary downloader-->
                                <webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
                                <webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
                                <webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
                                <webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
                                <webdriver.edge.driver>${webdriver.edge.driver}</webdriver.edge.driver>
                            </systemPropertyVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <!--This goal makes the build fail if you have test failures-->
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

这是我将pom.xml文件作为maven测试运行后的控制台:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building ZafulSelMaven4 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ZafulSelMaven4 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ ZafulSelMaven4 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ZafulSelMaven4 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 37 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ ZafulSelMaven4 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- driver-binary-downloader-maven-plugin:1.0.18:selenium (default) @ ZafulSelMaven4 ---
[INFO]  
[INFO] --------------------------------------------------------
[INFO]  DOWNLOADING SELENIUM STAND-ALONE EXECUTABLE BINARIES...
[INFO] --------------------------------------------------------
[INFO]  
[INFO] Repository map 'file:/C:/Users/hagit/workspace/ZafulSelMaven4/src/test/resources/RepositoryMap.xml' is valid
[INFO]  
[INFO] Only get drivers for current Operating System: false
[INFO] Archives will be downloaded to 'C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_zips'
[INFO] Standalone executable files will be extracted to 'C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_binaries'
[INFO]  
[INFO] Preparing to download Selenium Standalone Executable Binaries...
[INFO] Binary 'operadriver' exists: true
[INFO] Using existing 'operadriver 'binary.
[INFO] Binary 'operadriver' exists: true
[INFO] Using existing 'operadriver 'binary.
[INFO] Binary 'IEDriverServer.exe' exists: true
[INFO] Using existing 'IEDriverServer.exe 'binary.
[INFO] Binary 'msedgedriver' exists: true
[INFO] Using existing 'msedgedriver 'binary.
[INFO] Binary 'chromedriver' exists: true
[INFO] Using existing 'chromedriver 'binary.
[INFO] Binary 'operadriver.exe' exists: true
[INFO] Using existing 'operadriver.exe 'binary.
[INFO] Binary 'chromedriver' exists: true
[INFO] Using existing 'chromedriver 'binary.
[INFO] Binary 'geckodriver.exe' exists: true
[INFO] Using existing 'geckodriver.exe 'binary.
[INFO] Binary 'msedgedriver.exe' exists: true
[INFO] Using existing 'msedgedriver.exe 'binary.
[INFO] Binary 'chromedriver.exe' exists: true
[INFO] Using existing 'chromedriver.exe 'binary.
[INFO] Binary 'geckodriver' exists: true
[INFO] Using existing 'geckodriver 'binary.
[INFO] Binary 'geckodriver' exists: true
[INFO] Using existing 'geckodriver 'binary.
[INFO] Setting maven property - ${webdriver.ie.driver} = C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_binaries\windows\internetexplorer\64bit\IEDriverServer.exe
[INFO] Setting maven property - ${webdriver.opera.driver} = C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_binaries\windows\operachromium\64bit\operadriver.exe
[INFO] Setting maven property - ${webdriver.gecko.driver} = C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_binaries\windows\marionette\64bit\geckodriver.exe
[INFO] Setting maven property - ${webdriver.edge.driver} = C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_binaries\windows\edge\64bit\msedgedriver.exe
[INFO] Setting maven property - ${webdriver.chrome.driver} = C:\Users\hagit\workspace\ZafulSelMaven4\src\test\resources\selenium_standalone_binaries\windows\googlechrome\64bit\chromedriver.exe
[INFO]  
[INFO] --------------------------------------------------------
[INFO] SELENIUM STAND-ALONE EXECUTABLE DOWNLOADS COMPLETE
[INFO] --------------------------------------------------------
[INFO]  
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ ZafulSelMaven4 ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
Zaful_Maven_Project
Jul 13, 2020 3:12:56 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
15:12:57.230 [main] DEBUG io.github.bonigarcia.wdm.Preferences - Preference chrome=83 (valid until 2020-07-13 16:07:04)
15:12:57.241 [main] DEBUG io.github.bonigarcia.wdm.Preferences - Preference chrome83=83.0.4103.39 (valid until 2020-07-13 16:07:04)
15:12:57.242 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 83.0.4103.39 (since Google Chrome 83 is installed in your machine)
15:12:57.272 [main] DEBUG io.github.bonigarcia.wdm.WebDriverManager - Driver chromedriver 83.0.4103.39 found in cache
15:12:57.273 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as C:\Users\hagit\.m2\repository\webdriver\chromedriver\win32\83.0.4103.39\chromedriver.exe
 
Local Operating System: WINDOWS 10
Local Architecture: amd64
Selected Browser: chrome
Connecting to Selenium Grid: false
 
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 37771
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Jul 13, 2020 3:13:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C

Entered Test 1: Open Zaful
Written screenshot to target/screenshots\1594642387816_Logo_Exsists.png
Entered Test 1: Open Zaful
Written screenshot to target/screenshots\1594642392370_Logo_Exsists.png
Entered Test 2: Blue Bikini
Written screenshot to target/screenshots\1594642393496_Blue_Bikini_List.png
Entered Test 3: Black Bikini Like
Passed
Entered Test 1: Open Zaful
Written screenshot to target/screenshots\1594642396467_Logo_Exsists.png
Entered Test 2: Blue Bikini
Written screenshot to target/screenshots\1594642397495_Blue_Bikini_List.png
Entered Test 3: Black Bikini Like
Passed
Entered Test 3: Refresh no Like
Passed
Entered Test 1: Open Zaful
Written screenshot to target/screenshots\1594642403344_Logo_Exsists.png
Entered Test 2: Blue Bikini
Written screenshot to target/screenshots\1594642404359_Blue_Bikini_List.png
Entered Test 3: Black Bikini Like
Passed
Entered Test 3: Refresh no Like
Passed
Entered Test 1: Open Zaful
Written screenshot to target/screenshots\1594642409144_Logo_Exsists.png
Entered Test 2: Blue Bikini
Written screenshot to target/screenshots\1594642410471_Blue_Bikini_List.png
TestJASON.json2020_07_13
[ERROR] Tests run: 14, Failures: 9, Errors: 0, Skipped: 0, Time elapsed: 36.35 s <<< FAILURE! - in TestSuite
[ERROR] Logo_Exsists(testcases.OpenZafulTest)  Time elapsed: 8.149 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
    at testcases.OpenZafulTest.Logo_Exsists(OpenZafulTest.java:53)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates
    at testcases.OpenZafulTest.Logo_Exsists(OpenZafulTest.java:53)

[ERROR] Logo_Exsists(testcases.BlueBikiniListTest)  Time elapsed: 3.539 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[ERROR] Blue_Bikini_List(testcases.BlueBikiniListTest)  Time elapsed: 0.691 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
    at testcases.BlueBikiniListTest.Blue_Bikini_List(BlueBikiniListTest.java:39)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates
    at testcases.BlueBikiniListTest.Blue_Bikini_List(BlueBikiniListTest.java:39)

[ERROR] Logo_Exsists(testcases.LikeBlackBikiniTest)  Time elapsed: 3.05 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[ERROR] Blue_Bikini_List(testcases.LikeBlackBikiniTest)  Time elapsed: 1.169 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[ERROR] Logo_Exsists(testcases.NoLikesAfterRefreshTest)  Time elapsed: 2.994 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[ERROR] Blue_Bikini_List(testcases.NoLikesAfterRefreshTest)  Time elapsed: 0.741 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[ERROR] Logo_Exsists(testcases.JsonWriterTest)  Time elapsed: 3.376 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[ERROR] Blue_Bikini_List(testcases.JsonWriterTest)  Time elapsed: 1.097 s  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Coordinates
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.Coordinates

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   BlueBikiniListTest.Blue_Bikini_List:39 » NoClassDefFound org/openqa/selenium/i...
[ERROR]   BlueBikiniListTest>OpenZafulTest.Logo_Exsists:53 » NoClassDefFound org/openqa/...
[ERROR]   JsonWriterTest>BlueBikiniListTest.Blue_Bikini_List:39 » NoClassDefFound org/op...
[ERROR]   JsonWriterTest>OpenZafulTest.Logo_Exsists:53 » NoClassDefFound org/openqa/sele...
[ERROR]   LikeBlackBikiniTest>BlueBikiniListTest.Blue_Bikini_List:39 » NoClassDefFound o...
[ERROR]   LikeBlackBikiniTest>OpenZafulTest.Logo_Exsists:53 » NoClassDefFound org/openqa...
[ERROR]   NoLikesAfterRefreshTest>BlueBikiniListTest.Blue_Bikini_List:39 » NoClassDefFound
[ERROR]   NoLikesAfterRefreshTest>OpenZafulTest.Logo_Exsists:53 » NoClassDefFound org/op...
[ERROR]   OpenZafulTest.Logo_Exsists:53 » NoClassDefFound org/openqa/selenium/interactio...
[INFO] 
[ERROR] Tests run: 14, Failures: 9, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43.867 s
[INFO] Finished at: 2020-07-13T15:13:32+03:00
[INFO] Final Memory: 25M/268M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project ZafulSelMaven4: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\Users\hagit\workspace\ZafulSelMaven4\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这是testng.xml:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Test_Suite" parallel="none" thread-count="1">
  <test name="Test">
    <classes>   
      <class name="testcases.OpenZafulTest"/>
      <class name="testcases.BlueBikiniListTest"/>
      <class name="testcases.LikeBlackBikiniTest"/>
      <class name="testcases.NoLikesAfterRefreshTest"/>
      <class name="testcases.JsonWriterTest"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

我想按它们的顺序(一个类一个类)来运行我的测试,所以如果有人知道如何做到这一点,那将会对我有很大帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-13 13:50:29

这就是TestNG的行为方式。测试将不会按照testng.xml中列出的顺序执行。您应该为测试分配优先级,以便按照所需的顺序运行它们。如果测试是相互依赖的,那么使用依赖于。请在此处查看文档。

https://testng.org/doc/documentation-main.html

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

https://stackoverflow.com/questions/62876588

复制
相关文章
Chef
此文档适合于对Chef不了解,或者仅仅是了解但并未真正使用过Chef的用户。如果您对Chef充分了解,并且经常使用Chef,想要了解其中的技术,那么此文档可能并不是真正的适合您。
技术火炬手
2018/09/03
7890
Chef
Chef
Author: Fangchao Gao 转载请注明出处 此文档适合于对Chef不了解,或者仅仅是了解但并未真正使用过Chef的用户。如果您对Chef充分了解,并且经常使用Chef,想要了解其中的技术
gaofc
2018/05/09
1.5K0
Codechef Chef and Easy Problem(智商)
You are given a sequence A1, A2, ..., AN and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 ≤ X < 231and the value of (AL xor X) + (AL+1 xor X) + ... + (AR xor X) is maximum possible.
attack
2018/07/27
2730
绑定事件中 如可控制函数的执行次数
var flag = true; function onlyOne() { if(flag) { "这里是要执行的代码"; } flag = false//该方法是控制函数仅执行一次 因为flag是全局变量 onlyOne()函数执行一次后flag就变成false了 函数就执行不了了
大当家
2018/06/28
2.3K0
如何在Ubuntu 14.04服务器上设置Chef 12配置管理系统
随着基础架构需求的扩展,手动管理每台服务器变得越来越困难。这种困难因重复性要求而变得复杂,如果节点出现故障或需要水平缩放,则需要再现性。
新巴子
2018/10/16
2K0
如何在Chef中使用角色和环境来控制服务器配置
在构建基础架构时,管理多服务器,服务,用户和应用程序可能会很快变得很难。配置管理系统可用于帮助您管理这种混乱。
丰一川
2018/08/07
1.4K0
Chef 的安装与使用
Chef 是一款自动化服务器配置管理工具,可以对所管理的对象实行自动化配置,如系统管理,安装软件等。Chef 由三大组件组成:Chef Server、Chef Workstation 和 Chef Node。
菲宇
2019/06/12
2.6K0
Chef 的安装与使用
如何在Ubuntu上安装Chef服务器,工作站和客户端
随着组织结构的增长以及管理环境所需组件的扩展,各个服务器和服务可能变得难以管理。配置管理解决方案旨在简化系统和基础架构的管理。配置管理工具的目标是允许您将基础架构作为代码库进行管理。 Chef是一种配置管理解决方案,可让您轻松管理大量服务器。
新巴子
2018/08/07
2.9K0
如何在 docker 中执行 crontab
新建名为hello-cron的文件 内容为: # PATH非常重要,因为cron bash和系统环境变量不一致 PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" * * * * * echo hello > /proc/1/fd/1 2>/proc/1/fd/2 # An empty line is required at the end of this file for a valid c
马哥Python
2019/06/27
7.1K0
如何在 Chrome 中执行 JavaScript 代码
要在浏览器中执行 JavaScript 脚本,首先你的浏览器得支持。现在主流推荐 Chrome 浏览器,也可以使用基于 Chromium 的 Edge 浏览器。下面来介绍如何在 Chrome 中打开开发者工具,以及如何在开发者工具中运行调试 JavaScript 代码。
村雨遥
2022/03/14
6.1K0
如何在 Chrome 中执行 JavaScript 代码
如何在HUE上执行Java程序
基于HUE系统,使用平台自带的hadoop-mapreduce-examples.jar对一个文本文件执行wordcount操作。
create17
2019/03/12
2.1K2
如何在远程系统执行程序
在我们获得用户名口令后,尝试远程登陆目标主机并执行程序,结合实际环境做了如下测试.
Ms08067安全实验室
2019/12/18
1.6K0
Docker 世界中的配置管理:5分钟让你明白如何在Puppet,Chef,Ansible之间选择
本文翻译并节选自《DevOps2.0的工具集(DevOps黑宝书)——打造自动化的持续交付流程》一书,转自译者CSDN博客,转载请注明出处,译者:胡帅。
DevOps时代
2019/07/30
1.3K0
可用于集群的开源软件赏:Chef
目前我在腾讯主要负责一个服务器端软件的相关开源项目,所以接下来几天的开源内容是最近工作上积累的一些经验和想法,下图中的内容就是我目前主要的工作内容和一些小小的成果。 服务器集群系统设计是一个需要考虑开
韩伟
2018/03/05
1.9K0
可用于集群的开源软件赏:Chef
首发!DevOps@BOC — 器用之道,如琢如磨
我来自中国银行软件中心的一个开发部门,中国银行软件中心从 2013年开始试点敏捷软件开发以及相关CI、CD等实践,而我们内部真正的提 DevOps 比这个要更晚些。
DevOps时代
2018/10/08
1K0
首发!DevOps@BOC — 器用之道,如琢如磨
创建您的第一本Chef Cookbook
Cookbook是Chef框架的关键组成部分之一,其描述了相关节点的所需状态,并允许Chef推送需达到该状态的更改数据。由于需要进行配置的选项和区域数量众多,第一眼看上去,创建一本Cookbook是一项艰巨的任务,因此在本指南中我们将介绍通常人们在学习其配置的第一件事:设置LAMP(Linux + Apache + MySQL/MariaDB/Percona + PHP)软件环境。
PantaZheng
2018/09/21
3.2K0
创建您的第一本Chef Cookbook
如何在ClickHouse中查看SQL执行计划
ClickHouse目前并没有直接提供EXPLAIN查询,但是借助后台的服务日志,也能变相实现EXPLAIN的功能。
Nauu
2020/03/26
7K0
SQL如何在数据库中执行
数据库的服务端,可分为执行器(Execution Engine) 和 存储引擎(Storage Engine) 两部分:
JavaEdge
2023/01/06
3.1K0
SQL如何在数据库中执行
点击加载更多

相似问题

InnoDB关系:单向还是双向?

12

是单向还是双向绑定?

12

MVC和Flux?双向还是单向?

47

通过ajax提交表单,单向还是双向?

10

当单向rest调用时是双向SSL还是单向SSL?

10
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文