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

How to stop test running at first failure? #604

Closed
bmsoko opened this issue Jul 5, 2016 · 7 comments
Closed

How to stop test running at first failure? #604

bmsoko opened this issue Jul 5, 2016 · 7 comments

Comments

@bmsoko
Copy link

bmsoko commented Jul 5, 2016

I need to stop my tests on the first failure found, I'm also using Protractor. I had created:

    this.After(function (scenario, callback) {
        if (scenario.isFailed()) {
            browser.takeScreenshot().then(function(png) {
                var decodedImage = new Buffer(png, 'base64').toString('binary');
                scenario.attach(decodedImage, 'image/png');
                browser.quit();
                callback();
            });
        } else {
            callback();
        }
    });

But I don't like at all this approach! the problem is that for the rest of the scenarios I had an error that's confusing if another team member sees it! can you help? I looked around and didn't found a thing!

Thanks

@charlierudolph
Copy link
Member

cucumber-js has a --fail-fast CLI option which will stop the test run after the first failure.

@bmsoko
Copy link
Author

bmsoko commented Jul 6, 2016

I had tried that and seems not to be working, I have a npm task like "e2e-local": "scripts/test-e2e.sh local" that executes: grunt test:e2e:"$1" --tags "$2" and the protractor task in the grunt file looks like:

      // Functional test configuration
        protractor: {
            options: {
                configFile: 'test/protractor-devel-conf.js',
                keepAlive: false,
                noColor: false,
                args: {
                    cucumberOpts: {
                        tags: grunt.option('tags')
                    }
                }
            },
            local: {
                options: {
                    configFile: 'test/protractor-devel-conf.js',
                    keepAlive: false
                }
            },
            live: {
                options: {
                    configFile: 'test/protractor-live-conf.js',
                    keepAlive: false
                }
            }
        },

I had tried to add the --fail-fast at all points that calls, such in:

  • npm run e2e-local --tags @TAG --fail-fast and didn't work
  • grunt test:e2e:"$1" --tags "$2" --fail-fast but neither...

I cannot see what I'm doing wrong! can you tell!?

@charlierudolph
Copy link
Member

I believe you should actually be asking this question on the repo for the grunt plugin you are using. My hunch would be that you need to add something to the cucumberOpts block in your configuration.

@charlierudolph
Copy link
Member

@bmsoko any update on this? If not going to close this out

@charlierudolph
Copy link
Member

closing due to inactivity. Please reopen if needed

@bmsoko
Copy link
Author

bmsoko commented Aug 5, 2016

@charlierudolph thank you very much for the responses! I haven't contacted the grunt plugin developers with this question, but will do soon and let you'll know about it.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants