Доброго дня.
Проблема следующая при запуске тестов в параллельном исполнении фактический результат получается плачевным.
Запускается N - необходимых тридов но все они запускаются последовательно.
Как это выглядит в аллюре:
В чём может быть проблема?
Почему контейнеры поднимаются последовательно?
При установке докера и селенида ничего не менял кроме browsers.json
Запускаю через бинарник на linux машине:
./cm_linux_amd64 selenoid start --vnc
./cm_linux_amd64 selenoid-ui start
“browsers.json”
Базовый класс теста
package ru.bbbb.core;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.logevents.SelenideLogger;
import io.qameta.allure.Step;
import io.qameta.allure.selenide.AllureSelenide;
import org.apache.log4j.Logger;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.ITestResult;
import org.testng.annotations.*;
import java.net.MalformedURLException;
import java.net.URI;
import static com.codeborne.selenide.Selenide.*;
import static com.codeborne.selenide.WebDriverRunner.getWebDriver;
import static com.codeborne.selenide.WebDriverRunner.setWebDriver;
@Listeners({ AllureDecorator.class})
public class BaseTest {
public Logger log = Logger.getLogger(this.getClass());// лог
public String url;
@BeforeClass
public void addAllureLogger() throws MalformedURLException {
SelenideLogger.addListener("AllureSelenide", new AllureSelenide().screenshots(true).savePageSource(false));
ConfigurationLoader.loadProperty();
url = ConfigurationLoader.getProperty("selenide.baseUrl");
DesiredCapabilities dc = DesiredCapabilities.chrome();
dc.setCapability("acceptInsecureCerts", true);
dc.setBrowserName(Configuration.browser);
dc.setVersion(Configuration.browserVersion);
dc.setCapability("enableVNC", true);
dc.setCapability("enableVideo", false);
dc.setCapability("screenResolution", "1960x1280x24");
dc.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
//dc.setCapability("videoName", "selenoid_recording.mp4");
//dc.setCapability("videoScreenSize", "1960x1280");
dc.setPlatform(Platform.LINUX);
dc.setJavascriptEnabled(true);
RemoteWebDriver selenoidDriver = new RemoteWebDriver(URI.create(ConfigurationLoader.getProperty("selenide.remote")).toURL(), dc);
setWebDriver(selenoidDriver);
getWebDriver().manage().window().setSize(new Dimension(1920, 1080));
}
@BeforeTest
public void prepareParameters() {
log.info("Старт тестов в классе: " + this.getClass().getName() + "\n");
}
/**
* Использовать при дебаге или запуске вручную
* @param url урл куда перейти
*/
public void setUrl(String url) {
this.url = url;
}
/**
* возвращает текущий установленный урл
* @return
*/
public String getUrl() {
return url;
}
@Step("Выход из Siebel")
public void exitFromSiebel() {
$(".siebui-busy").waitUntil(Condition.disappears,60000);
$("html").sendKeys((Keys.chord(Keys.LEFT_CONTROL, Keys.LEFT_SHIFT, "x")));
$(".siebui-busy").waitUntil(Condition.disappears,60000);
}
@AfterTest
public void afterEachTestDo() {
log.info("Завершили тесты в классе: " + this.getClass().getName() + "\n");
}
@AfterMethod
public void getResult(ITestResult result) {
log.info("Завершили тестовый метод: " + result.getMethod().getMethodName() + " результат (1/2)=(успех/ошибка): " + result.getStatus());
}
}
Файл пропертей
selenide.driverManagerEnabled=false
selenide.browser=chrome
selenide.browserVersion=83.0
selenide.browserSize = “1920x1080”
selenide.remote=http://crm-docker-test:4444/wd/hub
selenide.timeout=10000
selenide.startMaximized=true
selenide.pageLoadStrategy=eager
selenide.downloadsFolder=${project.basedir}\target\download
selenide.reportsFolder=${project.basedir}\target\reports\tests
selenide.baseUrl=${site.url}
prj.output.path=${project.basedir}\target
file.for.attach=${project.basedir}\target\test-classes\FileForAttach.txt
server.restart=10:00;14:00;16:00
resource.folder=${project.basedir}\target\test-classes\
POM
<?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>bbbb.ru</groupId>
<artifactId>CRMCorporateAutotests</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<io.qameta.allure.version>2.13.3</io.qameta.allure.version>
<maven.surefire.plugin>3.0.0-M4</maven.surefire.plugin><!--2.22.2-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<testng.version>7.0.0</testng.version>
<selenide.version>5.10.0</selenide.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mdep.fileSeparator>\</mdep.fileSeparator>
<aspectj.version>1.9.1</aspectj.version>
</properties>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-selenide</artifactId>
<version>${io.qameta.allure.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${io.qameta.allure.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.siebel</groupId>
<artifactId>data</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Siebel.jar</systemPath>
</dependency>
<dependency>
<groupId>com.siebelJI_enu</groupId>
<artifactId>data</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/SiebelJI_enu.jar</systemPath>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>${selenide.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>orai18n</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/~$*.xlsx</exclude>
</excludes>
</testResource>
<testResource>
<targetPath>../allure-results</targetPath>
<directory>src/test/resources</directory>
<includes>
<include>**/categories.json</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin}</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<!--useSystemClassLoader>false</useSystemClassLoader-->
<perCoreThreadCount>false</perCoreThreadCount>
<parallel>classes</parallel>
<threadCount>6</threadCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>docx</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<reportVersion>${io.qameta.allure.version}</reportVersion>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- environments -->
<profile>
<id>TEST3</id>
<properties>
<site.url>https://crm8test3.ru/finscontact_rus/start.swe?SWECmd=AutoOn</site.url>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>STUDY1</id>
<properties>
<site.url>https://crm8study1.ru/fins_oui_rus/start.swe?SWECmd=AutoOn</site.url>
</properties>
</profile>
<profile>
<id>STUDY2</id>
<properties>
<site.url>https://crm8study2.ru/fins_oui_rus/start.swe?SWECmd=AutoOn</site.url>
</properties>
</profile>
<profile>
<id>DEVHOST</id>
<properties>
<site.url>https://crm8test3.ru/finscontact_rus/start.swe?SWECmd=AutoOn</site.url>
</properties>
</profile>
<profile>
<id>PREPROD</id>
<properties>
<site.url>https://crm8-preprod.ru/fins_auto_rus/start.swe?SWECmd=AutoOn</site.url>
</properties>
</profile>
</profiles>
</project>
“testng.xml”
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite" parallel="classes" thread-count="6">
<test verbose="2" preserve-order="true"
name="Id_2565_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_2565_Test">
<methods>
<include name="id_2565_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_2564_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_2564_Test">
<methods>
<include name="id_2564_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_2566_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_2566_Test">
<methods>
<include name="id_2566_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_91932_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_91932_Test">
<methods>
<include name="id_91932_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_91293_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_91293_Test">
<methods>
<include name="id_91293_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_2561_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_2561_Test">
<methods>
<include name="id_2561_Test"/>
<include name="id_2562_Test"/>
<include name="id_2563_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_12449_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_12449_Test">
<methods>
<include name="id_12449_StaticTest"/>
<include name="id_12449_RandomTest"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_91636_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_91636_Test">
<methods>
<include name="id_91932_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_91980_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_91980_Test">
<methods>
<include name="id_91980_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_91611_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_91611_Test">
<methods>
<include name="id_91611_Test"/>
</methods>
</class>
</classes>
</test>
<test verbose="2" preserve-order="true"
name="Id_91975_Test.java">
<classes>
<class name="ru.bbbb.tests.actual.Id_91975_Test">
<methods>
<include name="id_91975_Test"/>
</methods>
</class>
</classes>
</test>
</suite>