Last active
June 13, 2019 10:35
-
-
Save stykalin/5c40464b4e77a59dfe84dcfcb3539779 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AllureTestNgListener implements | |
ISuiteListener, | |
ITestListener, | |
IInvokedMethodListener, | |
IDataProviderListener { | |
... | |
@Override | |
public void beforeDataProviderExecution(IDataProviderMethod iDataProviderMethod, ITestNGMethod iTestNgMethod, ITestContext iTestContext) { | |
final String parentUuid = classContainerUuidStorage.get(iTestNgMethod.getTestClass()); | |
startBefore(parentUuid, iDataProviderMethod); | |
} | |
@Override | |
public void afterDataProviderExecution(IDataProviderMethod iDataProviderMethod, ITestNGMethod iTestNgMethod, ITestContext iTestContext) { | |
final String executableUuid = currentExecutable.get(); | |
currentExecutable.remove(); | |
getLifecycle().stopFixture(executableUuid); | |
} | |
private void startBefore(final String parentUuid, final IDataProviderMethod method) { | |
final String uuid = currentExecutable.get(); | |
getLifecycle().startPrepareFixture(parentUuid, uuid, getFixtureFromDataProviderResult(method)); | |
} | |
private FixtureResult getFixtureFromDataProviderResult(final IDataProviderMethod method) { | |
return new FixtureResult().setName("Подготовка тестовых данных в провайдере " + method.getName()).setStart(System.currentTimeMillis()) | |
.setDescription("Подготовка тестовых данных").setStage(Stage.RUNNING); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment