allure-qaguru's People
allure-qaguru's Issues
Пишем простой тест на Selenide
Добавляем зависимости:
compile 'com.codeborne:selenide:5.11.1'
compile("org.junit.jupiter:junit-jupiter-api:5.6.2")
compile("org.junit.jupiter:junit-jupiter-engine:5.6.2")
compile("org.junit.jupiter:junit-jupiter-params:5.6.2")
Обозначаем входные параметры:
private final static String REPOSITORY = "eroshenkoam/allure-example";
private final static String USER = "eroshenkoam";
private final static int ISSUE_NUMBER = 12;
Пишем простой тест на Selenide:
open("https://github.com");
$(".header-search-input").click();
$(".header-search-input").sendKeys("eroshenkoam/allure-example");
$(".header-search-input").submit();
$(By.linkText("eroshenkoam/allure-example")).click();
$(withText("Issues")).click();
$(withText("#12")).should(Condition.exist);
Заменяем степы на Listener
Добавляем зависимости:
compile 'io.qameta.allure:allure-selenide:2.13.3'
Добавляем Listener в тесты:
@Before
public void initSelenideListener() {
SelenideLogger.addListener("allure", new AllureSelenide().screenshots(true));
}
Добавляем именованные элементы:
public class NamedBy extends By {
private final By by;
private String name;
public NamedBy(final By by) {
this.by = by;
}
public NamedBy as(final String name) {
this.name = name;
return this;
}
@Override
public List<WebElement> findElements(final SearchContext context) {
return this.by.findElements(context);
}
public String toString() {
return Optional.ofNullable(name).orElseGet(by::toString);
}
public static NamedBy css(final String value) {
return new NamedBy(By.cssSelector(value));
}
}
Добавляем дополнительную разметку в виде step методов
Создаем класс BaseSteps:
public class BasicSteps {
@Step("Открываем главную страницу")
public void openMainPage(String user) {
parameter("user", user);
open("https://github.com");
}
@Step("Открываем страницу с репозиторием")
public void searchForRepository(String name) {
parameter("Repository", name);
$(".header-search-input").click();
$(".header-search-input").sendKeys(name);
$(".header-search-input").submit();
$(By.linkText(name)).click();
}
@Step("Открываем страницу с задачами в репозитории")
public void openRepositoryIssues() {
$(withText("Issues")).click();
}
@Step("Проверяем наличие задачи c id")
public void shouldSeeIssueWithId(int number) {
parameter("Issue Number", number);
$(withText("#12")).should(Condition.exist);
}
}
Добавляем сценарий теста:
steps.openMainPage(USER);
steps.searchForRepository(REPOSITORY);
steps.openRepositoryIssues();
steps.shouldSeeIssueWithId(ISSUE_NUMBER);
Добавляем зависимости Allure
Плагин:
https://github.com/allure-framework/allure-gradle
Добавляем информацию о плагинах:
plugins {
id 'java'
id 'io.qameta.allure' version '2.8.1'
}
Добавляем конфигурацию Allure плагина :
allure {
autoconfigure = true
version = '2.13.3'
useJUnit5 {
version = '2.13.3'
}
}
Добавляем зависимости:
compile 'io.qameta.allure:allure-java-commons:2.13.3'
Добавляем дополнительную разметку
Изменяем сценарий теста:
step("Открываем главную страницу", () -> {
open("https://github.com");
});
step("Открываем страницу с репозиторием", () -> {
$(".header-search-input").click();
$(".header-search-input").sendKeys("eroshenkoam/allure-example");
$(".header-search-input").submit();
$(By.linkText("eroshenkoam/allure-example")).click();
});
step("Открываем страницу с задачами в репозитории", () -> {
$(withText("Issues")).click();
});
step("Проверяем наличие задачи с ID=" + ISSUE_NUMBER, () -> {
$(withText("#12")).exists();
});
Добавляем параметры теста:
parameter("User", USER);
parameter("Repository", REPOSITORY);
parameter("Issue Number", ISSUE_NUMBER);
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.