Запуск параллельного теста в другой конфигурации с Maven, Gauge-Java framework

Мои тесты выполняются последовательно, но не параллельно, когда я пытаюсь запустить LambdaTest Selenium Grid. Ниже представлена ​​небольшая часть моего файла 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>

И я создал 2 разных каталога для chrome и firefox, которые содержат два разных файла свойств:

файл chrome.properties:

BROWSER = chrome
BROWSER_VERSION = 78
PLATFORM = WIN10

файл firefox.properties:

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"));

Любая помощь будет оценена по достоинству, большое спасибо :)


person Abin    schedule 10.12.2019    source источник


Ответы (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> 
person Alok kumar    schedule 11.12.2019