mercredi 9 juin 2021

How to group allure steps inside builder pattern in Java?

Builder Class

public class UserBuilder {

    @Step("User Builder")
    public static Builder creator() {
        return new Builder();
    }

    public static class Builder {
        private UserBuilderHolder holder = new UserBuilderHolder();

        Builder() {
            this.holder.setBuilder(this);
            this.holder.setAuthenticable(new UserAuthentication("User Builder Default"));
        }

        @Step("Get User Builder")
        public UserBuilder.Builder builder() {
            return this;
        }

        @Step("Get User Builder Holder")
        public UserBuilderHolder holder() {
            return holder;
        }
    }
}

Actual Code using the Builder class

UserBuilder.creator().builder().holder();

How to get the steps listed below in the allure report?

    --> User Builder
    --> --> Get User Builder
    --> --> Get User Builder Holder

Currently, it works as below:

    --> User Builder
    --> Get User Builder
    --> Get User Builder Holder

I just want to group all actions under a builder to a single step in the allure report.

Aucun commentaire:

Enregistrer un commentaire