Test execution order? Not explicitly documented

35 views
Skip to first unread message

David Herron

unread,
Feb 13, 2018, 3:42:19 PM2/13/18
to Mocha
I'm writing some UI tests using Puppeteer and am curious about the execution order in Mocha.  

The Mocha website doesn't explicitly describe the execution order for tests, other than the effect of before/after/beforeEach/afterEach/etc

Clearly from the behavior of Mocha it seems that the execution order is to execute each "describe" block in order, and within that block execute each "it" block in order ... with the caveat of interspersing before/after hooks as appropriate.

Is that understanding correct?

And I do understand that generally tests are supposed to be independent and theoretically can be executed in any order.  A UI test is different since a) it doesn't make sense to have multiple tests manipulating the UI at the same time, b) each test needs to know the state of the web browser at the end of the previous test.



+ David Herron


Vlad GURDIGA

unread,
Feb 14, 2018, 2:39:41 AM2/14/18
to Mocha
Hey David! 👋

The source code seems to say that the tests are executed sequentially, and I also did a quick manual test to verify, and I’m seeing the same. 🤓
Reply all
Reply to author
Forward
0 new messages