Allure Framework
Artem Eroshenko
eroshenkoam@
инженер по
автоматизации
разработка
инструментов
Отчеты автотестов
Хорошие отчеты
скорость и точность
Чем дальше от кода
тем меньше точность
Юнит тесты
Тесты через API
Web-тесты
Хорошие отчеты
необходимые данные
содержат
Хорошие отчеты
понятны всем
Хорошие отчеты
легко читать всем
В Яндексе нет единого
универсального отчета
Хабра-подход
/company/yandex/blog/200364/
Отчет для
функциональных тестов
Allure Framework
Allure Framework
Функциональные тесты
Легкость интеграции
Allure Framework
Понятность отчета
Allure Framework
Allure Framework
расширение xUnit
Стандартный xUnit
Стандартный xUnit
TestSuite Class
Стандартный xUnit
TestSuite Class
TestCase Method
Расширение xUnit
Аттачменты (Аттачи)
Аттачменты
HTML
IMAGE
JSON
XML
TXT
OTHER
Шаги (Степы)
Расширение xUnit
Шаги
Вложенность
Шаги
Статус завершения
Вложенность
Шаги
Статус завершения
Вложенность
Содержат аттачменты
Лейблы
Расширение xUnit
Лейблы
Способ группировки
Allure Framework
=
+
Стандартный xUnit
Шаги Аттачменты Лейблы
Архитектура Allure
Allure Model
Allure Adaptor
Allure Report
Архитектура Allure
Allure Model
Test	

Suite	

.xml
расширение xUnit
<testsuite time=“188”!
name=“company.TestMe”!
tests=“1” skipped=“0”!
errors=“0” failures=“0”>!
<testcase!
time=“180" name=“testMe”!
classname=“company.TestMe” !
/>!
</testsuite>
xUnit Model
Allure Model
Test	

Suite	

.xml
start/stop
status
test info
расширение xUnit
severity
<test-suite start="3" stop="25">!
<title>Test Suite</title>!
<test-cases>!
   <test-case start=“5" stop=“23”!
status=“passed”!
severity="normal">!
     <title>Test Case</title>!
   </test-case>!
</test-cases>!
</testsuite>
Allure Model
Allure Model
steps attachments
Test	

Suite	

.xml
start/stop
status
severity
test info
расширение xUnit
<test-case … >!
<title>Test Case</title>!
<steps>!
<step start="3" start="17" !
title=“Open Main Page”/>!
</steps>!
<attachments>!
<attachment title="Image"!
source=“image.png“/>!
</attachments>!
</test-case>
Allure Model
<testcase … >!
<steps>!
<step start="3" start="17" !
title=“Open Main Page”>!
<attachments>!
<attachment title="Image"!
source=“image.png“/>!
</attachments>!
</step>!
</steps>!
</testcase>
Allure Model
<testcase … >!
<steps>!
<step start="3" start="17" !
title=“Search by [test]”>!
<steps>!
<step start="7" start="10"!
title=“Type [test]” />!
</steps>!
</step>!
</steps>!
</testcase>
Allure Model
<testcase … >!
<labels>!
<label name=“Feature” !
value=“Search”/>!
<label name=“Component”!
value=“Web Interface”/>!
<label name=“Since Version”!
value=“1.7.2”/>!
</labels>!
</testcase>
Allure Model
Allure Framework
=
+
Стандартный xUnit
Шаги Аттачменты Лейблы
Allure Adaptor
jUnit
pyUnit
Karma
Test	

Suite	

.xml
Allure Adaptor
jUnit
pyUnit
Karma
jUnit	

Adaptor
Test	

Suite	

.xml
Allure Adaptor
jUnit
pyUnit
Karma
jUnit	

Adaptor
pyUnit	

Adaptor
Test	

Suite	

.xml
Allure Adaptor
jUnit
pyUnit
Karma
jUnit	

Adaptor
pyUnit	

Adaptor
Karma	

Adaptor
Test	

Suite	

.xml
Allure Report
Test	

Suite	

.xml
Test	

Suite	

.xml
Test	

Suite	

.xml
Allure Report
Test	

Suite	

.xml
Test	

Suite	

.xml
Test	

Suite	

.xml
Report	

Data	

Generator
Test	

Suite	

.json
Test	

Suite	

.json
Test	

Suite	

.json
Run	

Status	

.json
Allure Report
Angular JS
+
Test	

Suite	

.json
Test	

Suite	

.json
Test	

Suite	

.json
Run	

Status	

.json
Report Face
Архитектура Allure
jUnit
jUnit	

Adaptor
Test	

Suite	

.xml
Data	

GEN
Report
Allure Model
Allure Adaptor
Allure Report
Архитектура Allure
Allure In Action
Allure Lifecycle
Allure TestNG
Allure jUnit
Allure Java Adaptors
Allure Lifecycle
Allure.LIFECYCLE.fire(TestSuiteStarted);!
Allure.LIFECYCLE.fire(TestCaseStarted);!
Allure.LIFECYCLE.fire(StepStarted);!
Allure.LIFECYCLE.fire(MakeAttach);!
Allure.LIFECYCLE.fire(StepStarted);!
Allure.LIFECYCLE.fire(StepFinished);!
Allure.LIFECYCLE.fire(StepFinished);!
Allure.LIFECYCLE.fire(TestCaseFinished);!
Allure.LIFECYCLE.fire(TestSuiteFinished);
Allure jUnit
public class AllureRunListener !
extends RunListener{!
!
@Override!
public void testStarted (…) {!
TestSuiteStartedEvent suiteStarted =!
new TestSuiteStartedEvent(…);!
getLifecycle().fire(suiteStarted);!
}!
…!
} RunListener
public class AllureTestListener !
implements ITestListener{!
!
@Override!
public void onTestStart (…) {!
TestSuiteStartedEvent suiteStarted =!
new TestSuiteStartedEvent(…);!
getLifecycle().fire(suiteStarted);!
}!
…!
}
Allure testNG
ITestListener
Allure jUnit Example
Чистый xUnit
public void SearchTest {!
@Test!
public void searchResultsTest() {!
…!
}!
}
Добавляем шаги
@Step!
public void openMainPage () {!
driver.get(“http://yandex.ru”);!
}!
!
@Step!
public void searchBy (String key) {!
driver.findElement(id(“text”))!
.type(key);!
driver.findElement(id(“srch”)).click();!
}
Добавляем аттачи
@Attach(type=AttachmentType.PNG)!
public File makeScreenshot () {!
driver.getScreenshotAs(OutputType.File)!
}!
@Step!
public void checkResultHas(String text) {!
//получаем текст результатов!
//с помощью драйвера, проверяем текст!
! makeScreenShot(); !
}
Пишем тест
public void SearchTest {!
@Test!
public void searchResultsTest() {!
openMainPage();!
searchBy(“Yandex”);!
checkResultsHas(“Yandex”);!
}!
}
Получаем отчет
http://bit.ly/allure-reports
Allure Python Adaptors
Allure Lifecycle
Allure pyTest
Allure Report Builder
Allure Maven Plugin
Allure Jenkins Plugin
Демо
Вопросы?
https://github.com/allure-framework
eroshenkoam@

Allure Framework