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
使用Maven、Gauge Java框架在不同配置上运行并行测试_Java_Maven_Selenium_Gauge_Getgauge - Fatal编程技术网

使用Maven、Gauge Java框架在不同配置上运行并行测试

使用Maven、Gauge Java框架在不同配置上运行并行测试,java,maven,selenium,gauge,getgauge,Java,Maven,Selenium,Gauge,Getgauge,当我尝试在LambdaTest Selenium网格上运行时,我的测试是按顺序运行的,但不是并行运行的。 下面是我的maven pom文件的一小部分: <executions> <execution> <id>test-chrome</id> <phase>test</phase>

当我尝试在LambdaTest Selenium网格上运行时,我的测试是按顺序运行的,但不是并行运行的。 下面是我的maven pom文件的一小部分:

<executions> 
                        <execution>
                        <id>test-chrome</id>
                        <phase>test</phase>
                        <configuration>
                            <env>chrome</env>
                            <inParallel>true</inParallel>
                            <nodes>4</nodes>
                            <specsDir>specs</specsDir>
                        </configuration>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                    </execution>

                    <execution>
                        <id>test-firefox</id>
                        <phase>test</phase>
                        <configuration>
                            <env>firefox</env>
                            <inParallel>true</inParallel>
                            <nodes>4</nodes>
                            <specsDir>specs</specsDir>
                        </configuration>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        </execution>
</executions>
firefox.properties文件:

BROWSER = chrome
BROWSER_VERSION = 78
PLATFORM = WIN10
BROWSER = firefox
BROWSER_VERSION = 69
PLATFORM = WIN8
我在java类文件中使用了以下环境变量:

DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("browserName", System.getenv("BROWSER"));
        capabilities.setCapability("version", System.getenv("BROWSER_VERSION"));
        capabilities.setCapability("platform", System.getenv("PLATFORM"));

如果您有任何帮助,我们将不胜感激:)

尝试用以下内容替换chrome.properties:

BROWSER = chrome (PropertyName)
BROWSER_VERSION = 78 
PLATFORM = WIN10
并从属性文件或任何其他要设置为动态的参数中添加驱动程序版本

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
         <parallel>tests</parallel>
          <threadCount>10</threadCount>
           <systemPropertyVariables>
            <propertyName>Firefox</propertyName>
            <propertyName>Chrome</propertyName>
          </systemPropertyVariables>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>

        </configuration>
      </plugin>
</plugins>
    </build>
  <dependencies>
    <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>2.47.1</version>
</dependency>   
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>2.47.1</version>
</dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.47.1</version>
    </dependency>  
</dependencies> 

org.apache.maven.plugins
maven surefire插件
2.18.1
测验
10
火狐
铬
testng.xml
org.testng
testng
6.8.8
测试
org.seleniumhq.selenium
selenium firefox驱动程序
2.47.1
org.seleniumhq.selenium
硒铬驱动器
2.47.1
org.seleniumhq.selenium
硒爪哇
2.47.1

尝试用以下内容替换chrome.properties:

BROWSER = chrome (PropertyName)
BROWSER_VERSION = 78 
PLATFORM = WIN10
并从属性文件或任何其他要设置为动态的参数中添加驱动程序版本

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
         <parallel>tests</parallel>
          <threadCount>10</threadCount>
           <systemPropertyVariables>
            <propertyName>Firefox</propertyName>
            <propertyName>Chrome</propertyName>
          </systemPropertyVariables>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>

        </configuration>
      </plugin>
</plugins>
    </build>
  <dependencies>
    <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>2.47.1</version>
</dependency>   
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>2.47.1</version>
</dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.47.1</version>
    </dependency>  
</dependencies> 

org.apache.maven.plugins
maven surefire插件
2.18.1
测验
10
火狐
铬
testng.xml
org.testng
testng
6.8.8
测试
org.seleniumhq.selenium
selenium firefox驱动程序
2.47.1
org.seleniumhq.selenium
硒铬驱动器
2.47.1
org.seleniumhq.selenium
硒爪哇
2.47.1