Allure TestNG Retry Listener

Implementation of ITestListener to allow retry functionality for combination of Allure Framework and TestNG Framework

Лицензия

Лицензия

Категории

Категории

TestNG Тестирование компонентов
Группа

Группа

com.github.paulakimenko
Идентификатор

Идентификатор

allure-testng-retry-listener
Последняя версия

Последняя версия

0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Allure TestNG Retry Listener
Implementation of ITestListener to allow retry functionality for combination of Allure Framework and TestNG Framework
Ссылка на сайт

Ссылка на сайт

https://github.com/paulakimenko/allure-testng-retry-listener/
Система контроля версий

Система контроля версий

https://github.com/paulakimenko/allure-testng-retry-listener/

Скачать allure-testng-retry-listener

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.paulakimenko/allure-testng-retry-listener/ -->
<dependency>
    <groupId>com.github.paulakimenko</groupId>
    <artifactId>allure-testng-retry-listener</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.paulakimenko/allure-testng-retry-listener/
implementation 'com.github.paulakimenko:allure-testng-retry-listener:0.1'
// https://jarcasting.com/artifacts/com.github.paulakimenko/allure-testng-retry-listener/
implementation ("com.github.paulakimenko:allure-testng-retry-listener:0.1")
'com.github.paulakimenko:allure-testng-retry-listener:jar:0.1'
<dependency org="com.github.paulakimenko" name="allure-testng-retry-listener" rev="0.1">
  <artifact name="allure-testng-retry-listener" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.paulakimenko', module='allure-testng-retry-listener', version='0.1')
)
libraryDependencies += "com.github.paulakimenko" % "allure-testng-retry-listener" % "0.1"
[com.github.paulakimenko/allure-testng-retry-listener "0.1"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
ru.yandex.qatools.allure : allure-testng-adaptor jar 1.4.0
org.testng : testng jar 6.8

test (1)

Идентификатор библиотеки Тип Версия
org.mockito : mockito-all jar 1.8.4

Модули Проекта

Данный проект не имеет модулей.

#Allure TestNG Retry Listener

Implementation of TestNG ITestListener to allow "Retry Functionality" for combination of Allure Framework and TestNG Framework. See JavaDocs here (TBD).

##Features:

  • If test has been retried, its result status would be changed from "Failed"("Broken") to "Pending", with all saved steps and attachments
  • If test failed and it hasn't "retry ability", its result status wouldn't be changed
  • User can use SimpleRetryAnalyzer which works with TestNG dataProviders and gets MAX_RETRY_COUNT from system properties (see the example below)
  • User can implement IAllureRetryAnalyzer, or extend from AbstractAllureRetryAnalyzer to set the rule for retry (to write custom analyzer)
  • There is RetryUtils.getResultHash() method which returns special hashcode from ITestResult instance (to write custom analyzer)

##How-to:

Simple usage example:

@Listeners(RetryListener.class)
public class ExampleTest {
    @Test(retryAnalyzer = SimpleRetryAnalyzer.class)
    public void test() {
        // test logic
    }
}

To apply RetryAnalyzer for whole suite:

@BeforeSuite(alwaysRun = true)
public void setUpSuite(ITestContext context) {
    for (ITestNGMethod method : context.getAllTestMethods()) {
        if (method.getRetryAnalyzer() == null) {
            method.setRetryAnalyzer(new SimpleRetryAnalyzer());
        }
    }
}

Set MAX_RETRY_COUNT for SimpleRetryAnalyzer example:

System.setProperty(SimpleRetryAnalyzer.RETRY_COUNT_PROPERTY_KEY, "2");
    // "alluretestng.retrylistener.retryCount" property key

Custom RetryAnalyzer example:

public static class TestRetryAnalyzer extends AbstractAllureRetryAnalyzer {
    private static final int MAX_RETRY_COUNT = 1;
    private int retryCount;

    @Override
    public boolean retry(ITestResult result, boolean getRetryAbilityOnly) {
        if (retryCount < MAX_RETRY_COUNT) {
            if (!getRetryAbilityOnly)
                retryCount++;
            return true;
        }
        return false;
    }
}

Contact

Mail: paulakimenko@gmail.com

Версии библиотеки

Версия
0.1