Перекрестные шаги Selenium-Java-Serenity и проблемы сценариев. Есть идеи, в чем проблема?JAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Перекрестные шаги Selenium-Java-Serenity и проблемы сценариев. Есть идеи, в чем проблема?

Сообщение Anonymous »

У меня возникла проблема, когда шаг в сценарии A (в файле объекта A) выполняется (переключается) с шагом в сценарии B (в файле объекта B).
Это Эта проблема приводит ко многим ошибкам в моем отчете. Проблема не только в отчетности, потому что если бы она была в отчетности, дело было бы успешным с просто неправильным изображением.
Вот пример отчетности:

[Функция A: тестирование функциональности страницы канала]
[Сценарий A : Пользователь хочет просмотреть страницу обзора канала
[Шаг 1: Данный пользователь находится на странице сообщества талантов]

[Пример изображения A]: https://i.sstatic.net/5ZqjXhHO.png


ПЕРЕКЛЮЧАЕТСЯ С


[Функция B: Тестируемый кандидат вход пользователя с зарегистрированной функцией электронной почты и функцией редактирования профиля]
[Сценарий B: Пользователь хочет добавить университетское образование – полные данные]
[Шаг 4: кандидат заполняет область обучения]

[Образец изображения B]: https://i.sstatic.net /UDO38WvE.png


Я использую mvn Clean Verify, вот несколько кодов из моего проекта:
  • AcceptanceTestSuite.java

Код: Выделить всё

package org.hyrdnewcompany.acceptancetests;

import net.serenitybdd.junit5.SerenityJUnit5Extension;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;

//@RunWith(CucumberWithSerenity.class)
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("features")
@ConfigurationParameter(key = "cucumber.plugin", value = "io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:target/cucumber-report.json")
@ConfigurationParameter(key = "cucumber.glue", value = "org.hyrdnewcompany.steps, org.hyrdnewcompany.hooks")
public class AcceptanceTestSuite {
}

  • Hooks.java

Код: Выделить всё

package org.hyrdnewcompany.hooks;

import io.cucumber.java.After;
import io.cucumber.java.BeforeStep;
import io.cucumber.java.AfterStep;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import static net.thucydides.core.webdriver.ThucydidesWebDriverSupport.getDriver;

public class Hooks {
private static final long STEP_DELAY = 2000; // 2 seconds

@BeforeStep
public void beforeStep() {
waitFixedTime(STEP_DELAY);
}

@AfterStep
public void afterStep() {
waitFixedTime(STEP_DELAY);
}

private void waitFixedTime(long delayMillis) {
CountDownLatch latch = new CountDownLatch(1);
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.schedule(latch::countDown, delayMillis, TimeUnit.MILLISECONDS);
try {
latch.await();  // Wait for the latch to count down after the delay
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.out.println("Fixed wait was interrupted.");
} finally {
scheduler.shutdown();   // Clean up the scheduler
}
}

@After
public void tearDown() {
if (getDriver() != null) {
getDriver().quit();
}
}
}

  • junit-платформа .properties

Код: Выделить всё

cucumber.execution.parallel.enabled=true
cucumber.execution.parallel.config.strategy=fixed
cucumber.execution.parallel.config.fixed.parallelism=6
cucumber.execution.parallel.config.fixed.max-pool-size=6
cucumber.execution.execution-mode.feature=same_thread
cucumber.plugin=io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:target/test-results/timeline
cucumber.execution.timeout=60000

  • serenity.properties

Код: Выделить всё

webdriver.driver = provided
webdriver.provided.type = mydriver
webdriver.shared=false
webdriver.provided.mydriver = org.hyrdnewcompany.driver.CustomDriver
thucydides.driver.capabilities = mydriver
serenity.timeout = 60000
serenity.take.screenshots=BEFORE_AND_AFTER_EACH_STEP

  • pom.xml (для параллельного режима)

Код: Выделить всё

          
maven-failsafe-plugin
3.3.0


**/acceptancetests/*.java

-Xmx512m
methods
6
false




integration-test
verify






Подробнее здесь: https://stackoverflow.com/questions/791 ... -the-issue
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»