Closed kavimukh closed 8 years ago
Hi,
My understanding is that nightwatch runs the tests in the order they are in your directory. So, more often than not they'll run in alphabetical order.
If you have some tests which are set up tests (like, saving things into your database so that all your tests run in the same state of the app) then add a flag on them and call that flag before you run the other tests.
The other option is numbering the files like 1c.js 2b.js 3d.js 4a.js, but that isn't ideal. Especially if you want to insert a test between b and d.
But good practice would say that you shouldn't have tests that depend on other tests.. Not easy to do, but that is the ideal. Each test should tear_down to leave the app in the state it started in.
Yes, I also think that each test should be independent and so this feature is not something we will be adding, I'm afraid.
Sometimes it is necessary to have dependent tests. In this case, it is in my experience easiest to consolidate all of this test code into a single test suite file. Use a linter and indenter to ensure your code is clean and readable.
Agreed that it is best whenever possible to conceptually create test suites (files) that are independent and create ("stand up") and clean up ("stand down") their own test data on their own.
Using environment variables to specify runtime information, such as login account information for test accounts, can be a useful tool in this process.
Hi, OS: Windows Created few script in my test folder and while execution, it's executing in alphabetic order. To avoid this how I can specify my own order for nightwatch.js.
let's saying i have a.js, b.js, c.js and d.js in my test folder
During execution nightwatch.js is executing first a.js and b.js then c.js and the d.js
but I don't want in this order When I execute it should execute in following oder c.js b.js d.js a.js
and let's say I want to execute again c.js. Can I do then how?