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

Can tests be marked as Pending at runtime? #1101

Closed
cressie176 opened this issue Jan 5, 2014 · 6 comments
Closed

Can tests be marked as Pending at runtime? #1101

cressie176 opened this issue Jan 5, 2014 · 6 comments
Labels
status: waiting for author waiting on response from OP - more information needed

Comments

@cressie176
Copy link

Is it possible to mark a test as pending while it's being executed? Something like this.emit('pending') or this.pending = true?

The reason for this is that yadda executes multiple bdd steps per mocha test, and I've had a feature request to change the test to pending if one of the bdd steps hasn't been implemented.

Thanks.

@poum
Copy link

poum commented Apr 16, 2014

Would be nice of you to help Yadda project cause the association beetween excellent mocha & yadda produce something great.

@boneskull
Copy link
Contributor

So this is basically marking tests as "skipped" at runtime, right?

Please see #946 and let me know if that does what you want.

@boneskull
Copy link
Contributor

Old; reopen if necessary

@xslim
Copy link

xslim commented Nov 24, 2014

Hey, I'm searching for a similar functionality, to mark a test as skipped / pending depending on the result of previous test. Any hints on this?

@molmedoz
Copy link

Hi,
I had the same problem. I could resolve this, storing result of test and before execute each test read if this test is blocked.
Each test knows that tests will be blocked if fails. If the current test is blocked, the test will be skipped.

var featuresFiles = new Yadda.FeatureFileSearch('./test/features');
var nFeaturesFiles = featuresFiles.list().length;
featuresFiles.each(function(file, nFile) {
    //console.log('Iniciamos el test');
    featureFile(file, function(feature) {
    scenarios(feature.scenarios, function(scenario) {
        describe(scenario.title, function() {
            before(function() {
                if(infoTest[scenario.annotations.cp] && infoTest[scenario.annotations.cp].blocked){
                    this.pending = true;
                    this.skip();
                }
                //do staffs
            });
            //code
            after(function(done){
                if(this.failed || this.pending){
                    var blocked = (scenario.annotations.blocking)?JSON.parse(scenario.annotations.blocking) : [];
                    if(blocked.length){
                        blocked.map(function(test){
                            infoTest[test.cp].blocked = true;
                        });
                    }
                }
            }
            //do staffs
        }
    }
}

I hope this will help you

@danielstjules
Copy link
Contributor

Sounds like #1618 would work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for author waiting on response from OP - more information needed
Projects
None yet
Development

No branches or pull requests

6 participants