Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new lambda step API #282

Merged
merged 1 commit into from
Dec 14, 2018
Merged

Introduce new lambda step API #282

merged 1 commit into from
Dec 14, 2018

Conversation

baev
Copy link
Member

@baev baev commented Dec 2, 2018

fixes #232

Add test links

link("testing", "https://example.com");
issue("GH-123", "https://github.com/allure-framework/allure2/issues/123");
tms("AS-182", "https://allureee.qameta.io/project/1/test-cases/182");

Add test labels

epic("Allure Java API");
feature("Dynamic API");
label("component", "allure-java-commons");

Add parameters to test within test body

String baseUrl = parameter("baseUrl", "https://example.com/getData");

Log-style steps

step("set up test database", Status.SKIPPED);
step("set up test create mocks"); // Status.PASSED by default

Add parameters to test inside steps as well

String token = step("authorization", () -> {
    String login = parameter("login", "admin");
    String password = parameter("password", "admin");
    return getAuth(login, password);
});

Add parameters to step using injected StepContext

step("preparation checks", (step) -> {
    step.parameter("a", "a value");
    step.parameter("b", "b value");
});

Nested step and dynamic step name

step((step) -> {
    String a = step("child 1", () -> "A");
    String b = step("child b", () -> "B");
    String c = step("child b", () -> "C");
    step.name("dynamic name " + a + b + c);
});

Create attachments as well as steps

step("get data", () -> {
    step("build client");
    List<String> responseData = step("run request", (step) -> {
        step.parameter("authorization", token);
        step.parameter("url", baseUrl);
        int[] requestBody = step.parameter("requestBody", new int[]{1, 2, 3});
        return getData(baseUrl, token, requestBody);
    });
    attachment("response", ObjectUtils.toString(responseData));
});

@baev baev requested a review from eroshenkoam December 2, 2018 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lambda step API
2 participants