Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse 使用Maven按字母顺序运行Selenium/Thucydides JUnit测试_Eclipse_Maven_Selenium Webdriver_Junit4_Thucydides - Fatal编程技术网

Eclipse 使用Maven按字母顺序运行Selenium/Thucydides JUnit测试

Eclipse 使用Maven按字母顺序运行Selenium/Thucydides JUnit测试,eclipse,maven,selenium-webdriver,junit4,thucydides,Eclipse,Maven,Selenium Webdriver,Junit4,Thucydides,我有一个Selenium/Thucydides项目,它使用JUnit运行测试用例。 在Eclipse中,当使用JUnit运行时,我可以使用@FixMethodOrder按字母顺序运行测试。这很好,但是当我在Maven中使用mvn verify运行测试时,测试是随机运行的 我看到您可以在pom.xml中设置字母顺序,但它似乎也不起作用 在使用Maven时,是否有按字母顺序运行测试的方法?(我知道他们不应该相互依赖,但有些人在这个时间点上,所以需要这个选项,直到我可以使他们独立) POM.xml:

我有一个Selenium/Thucydides项目,它使用JUnit运行测试用例。 在Eclipse中,当使用JUnit运行时,我可以使用
@FixMethodOrder
按字母顺序运行测试。这很好,但是当我在Maven中使用
mvn verify
运行测试时,测试是随机运行的

我看到您可以在pom.xml中设置
字母顺序
,但它似乎也不起作用

在使用Maven时,是否有按字母顺序运行测试的方法?(我知道他们不应该相互依赖,但有些人在这个时间点上,所以需要这个选项,直到我可以使他们独立)

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.team.app</groupId>
<artifactId>Testing</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Selenium Testing</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <thucydides.version>0.9.127</thucydides.version>
    <webdriver.driver>firefox</webdriver.driver>
</properties>
<dependencies>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-core</artifactId>
        <version>${thucydides.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-junit</artifactId>
        <version>${thucydides.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.15</version>
            <configuration>
              <runOrder>alphabetical</runOrder> 
              <systemPropertyVariables>
                <webdriver.driver>${webdriver.driver}</webdriver.driver>
              </systemPropertyVariables>
              <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.15</version>
            <configuration>
                <runOrder>alphabetical</runOrder> 
                <includes>
                    <include>**/*Test.java</include>
                    <include>**/Test*.java</include>
                    <include>**/When*.java</include>
                    <include>**/*TestSuite.java</include>
                </includes>
                <systemPropertyVariables>
                    <webdriver.driver>${webdriver.driver}</webdriver.driver>
                </systemPropertyVariables>                                      
                <!-- <parallel>parallel</parallel> -->
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>                
                <source>1.7</source>
                <target>1.7</target>                    
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.thucydides.maven.plugins</groupId>
            <artifactId>maven-thucydides-plugin</artifactId>
            <version>${thucydides.version}</version>
            <executions>
                <execution>
                    <id>thucydides-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <id>maven2</id>
        <activation>
            <file>
                <missing>${basedir}</missing>
            </file>
        </activation>
        <reporting>
            <plugins>
                <plugin>
                    <groupId>net.thucydides.maven.plugins</groupId>
                    <artifactId>maven-thucydides-plugin</artifactId>
                    <version>${thucydides.version}</version>
                </plugin>
            </plugins>
        </reporting>
    </profile>
    <profile>
        <id>maven3</id>
        <activation>
            <file>
                <exists>${basedir}</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.0-beta-3</version>
                    <configuration>
                        <reportPlugins>
                            <plugin>
                                <groupId>net.thucydides.maven.plugins</groupId>
                                <artifactId>maven-thucydides-plugin</artifactId>
                                <version>${thucydides.version}</version>
                            </plugin>
                        </reportPlugins>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
<description>Project that perform automated user test on Bosted using Selenium and Thucydides</description>
并使用按字母顺序排列的
@Test
方法。

按字母顺序
对我来说工作正常


我也在运行修昔底德的故障保护2.15,并行关闭,等等。。。配置几乎相同,只是目标java版本是1.6。

我想出来了。或者至少我通过降级到
Maven 2.2.1
解决了这个问题。 由于某种原因,
Maven 3.0.x
似乎不遵守
runOrder
参数。 但不需要特别的v3,所以降级对我来说很好。 不过还是很奇怪

  @FixMethodOrder(MethodSorters.NAME_ASCENDING)
  @Story(Application.PlanModernusConfiguration.ConfigureFieldDefinitions.class)
  @RunWith(ThucydidesRunner.class)