Skip to content

Instantly share code, notes, and snippets.

@simple-elf
Created July 28, 2021 06:05
Show Gist options
  • Save simple-elf/22d4724a497ffe2ff561c5e6b46ea62e to your computer and use it in GitHub Desktop.
Save simple-elf/22d4724a497ffe2ff561c5e6b46ea62e to your computer and use it in GitHub Desktop.
Allure TestOps junit5 ParameterizedTest
@ParameterizedTest(name = "{displayName}[{0} {1} {2}]")
@DisplayName("Выполнение запроса без отправки токена")
@MethodSource("allMethodProvider")
void noTokenTest(String method, String endpoint, ContentType contentType) {
Allure.parameter("method", method);
Allure.parameter("endpoint", endpoint);
Allure.parameter("contentType", contentType);
// OR Allure.label("TMS", testCaseId)
}
// Когда параметром выступает сложный объект с полями
@ParameterizedTest(name = "{displayName}[{index}]")
@DisplayName("Выполнение запроса без отправки токена")
@MethodSource("allMethodProviderData")
void noTokenTest(Object data) {
Allure.getLifecycle().updateTestCase( test ->
test.setName(String.format(
"Выполнение запроса без отправки токена %s %s %s",
data.method, data.endpoint, data.contentType ))
);
Allure.parameter("method", data.method);
Allure.parameter("endpoint", data.endpoint);
Allure.parameter("contentType", data.contentType);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment