How to run different testing categories using mocha

684 views
Skip to first unread message

Abhijit Zanak

unread,
Aug 7, 2015, 5:00:54 AM8/7/15
to Mocha
Hello,

let us take an example, I have few test cases in my test.js file, out of that i want run only few having specific parameter.
say i want categories my test for sanity and regression, i have 5 test in my test.js, three of them are sanity and two are for regression.
how i can achieve this scenario ?

reed...@gmail.com

unread,
Aug 7, 2015, 12:24:46 PM8/7/15
to moc...@googlegroups.com
Either put the sanity tests in one describe() block and the regression in another, or ensure "sanity" is part of the description of all the sanity tests and "regression" is part of the description of all the regression tests.



-- Sent from my HP Pre3 running webOS


--
You received this message because you are subscribed to the Google Groups "Mocha" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mochajs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vlad GURDIGA

unread,
Aug 8, 2015, 9:27:24 AM8/8/15
to Mocha
Hi Abhijit,

I just wanted to add a bit to Doug’s answer.

So, latest Mocha’s has two options for filtering:

    -g, --grep <pattern>                    only run tests matching <pattern>

    -f, --fgrep <string>                    only run tests containing <string>


If I would have a special set of tests to run on specific occasions, one other option that I’d try is just to put them in a separate file, say special-tests.js, and run only that on those special occasions. :)

Cheers!
Reply all
Reply to author
Forward
0 new messages