You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this may not even be a Cypress specific thing but since I'm using Cypress I still think it's bes to ask here.
I'ts a very simply question:
Is the test order within one file (one describe block) guaranteed?
Why do I ask that?
We have quite a lot of database dependent tests.
Because of this we often have to seed our database data within tests.
Now let's assume I have the following tests:
describe('My database tests',()=>{// this is only done once for all tests in this blockbefore(()=>{seedUsersInDatabase();});it('Get users',()=>{// expect 10 users});it('Remove users',()=>{// expect 5 users removed});});
Maybe you already see why the question poppep up.
If it's guaranteed that the tests within a describe block are always executed in the same order, I can seed the database with before. However if the order is not guaranteed I'd need to change it to beforeEach.
I personally assumed the order is guaranteed and therefore wrote only the before. The main reason for this is by the way: Performance! Seeding a database sometimes takes quite the time (even if it's just 100ms, it sums up if you have a lot of tests).
The text was updated successfully, but these errors were encountered:
In the future, we recommend questions relating to how to use Cypress be asked in our community chat. Issues in our GitHub repo are reserved for potential bugs or feature requests.
So this may not even be a Cypress specific thing but since I'm using Cypress I still think it's bes to ask here.
I'ts a very simply question:
Is the test order within one file (one describe block) guaranteed?
Why do I ask that?
We have quite a lot of database dependent tests.
Because of this we often have to seed our database data within tests.
Now let's assume I have the following tests:
Maybe you already see why the question poppep up.
If it's guaranteed that the tests within a
describe
block are always executed in the same order, I can seed the database withbefore
. However if the order is not guaranteed I'd need to change it tobeforeEach
.I personally assumed the order is guaranteed and therefore wrote only the
before
. The main reason for this is by the way: Performance! Seeding a database sometimes takes quite the time (even if it's just 100ms, it sums up if you have a lot of tests).The text was updated successfully, but these errors were encountered: