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

Dry run is ignored for ConditionalPerformable #1503

Closed
nbarrett opened this issue Dec 20, 2018 · 3 comments
Closed

Dry run is ignored for ConditionalPerformable #1503

nbarrett opened this issue Dec 20, 2018 · 3 comments

Comments

@nbarrett
Copy link
Contributor

nbarrett commented Dec 20, 2018

Ever since upgrading from 2.0.0.20 to 2.0.27 dry run is ignored, if a conditional performable exists at the top level. For instance in the following example, Navigate.toTaskThatDoesSomething() is always run, rather than being skipped as expected:

    @Test
    public void dryRunBroken() {
        System.setProperty("serenity.dry.run", "true");
        Actor.named("nick").attemptsTo(
            Check.whether(true)
                .andIfSo(Navigate.toTaskThatDoesSomething()));
    }

Whereas this version of the test would obey the dry run setting:

    @Test
    public void dryRunGood() {
        System.setProperty("serenity.dry.run", "true");
        Actor.named("nick").attemptsTo(
            Navigate.toTaskThatDoesSomething());
    }
@nbarrett
Copy link
Contributor Author

Interestingly, a workaround using Task.where() works:

    @Test
    public void dryRunWorkaround() {
        System.setProperty("serenity.dry.run", "true");
        Actor.named("nick").attemptsTo(
            Task.where("Temporary fix to enable dry run to work correctly until https://github.com/serenity-bdd/serenity-core/issues/1503 fixed",
                       Check.whether(true)
                           .andIfSo(Navigate.toTaskThatDoesSomething())));
    }

But using SilentTask doesn't work:

    @Test
    public void dryRunWorkaroundDoesntWork() {
        System.setProperty("serenity.dry.run", "true");
        Actor.named("nick").attemptsTo(
            SilentTask.where("Temporary fix to enable dry run to work correctly until https://github.com/serenity-bdd/serenity-core/issues/1503 fixed",
                       Check.whether(true)
                           .andIfSo(Navigate.toTaskThatDoesSomething())));
    }
``

@wakaleo
Copy link
Member

wakaleo commented Dec 20, 2018

Hmm, DryRun isn't really an official feature (more for testing the framework) - can you propose a PR to reinstate it for tasks? Not sure what would have changed.

@nbarrett
Copy link
Contributor Author

nbarrett commented Dec 20, 2018

Yes, I understand your point about Dry run not being an official feature! However on more than one client project, I've used it very effectively to skip potentially time-consuming sections of data setup in tests which provides significant performance benefits. I've been meaning to propose a PR to add this 'skippable concept' to Serenity or maybe write an article about it because it's a really ground-breaking feature, allowing parts of tests to be completely skipped over like so:
image
The really cool thing is that the reporting already works perfectly and shows the parts that have been skipped. Of course 'leveraging' capabilities like this is risky as they can be broken by new releases and this has happened on more than one occasion especially around the area of Silent Performables... I'll see what I can do 😄

@wakaleo wakaleo closed this as completed Feb 12, 2022
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

No branches or pull requests

2 participants