πͺ’ Sources of Truth
Connecting your tests to the sources of truth of your app
Nil
188 Words Reading Time: 51 Seconds
11-30-2024 21:25 +0000
Connecting your tests to Sources of Truth
Basically, e2e testing is about testing that the information we see in the frontend is correct, and that the app is usable. Nonetheless, archiving this is not always easy, especially when the information is not static, and it is constantly changing.
The information changes
We need to work in a way that ensures that changes in the underlaying data won’t break our tests. Because of this, you must find a way to connect to the underlaying data sources used for your app On this day and age, connecting to any data source is not a problem, either you are using a REST API, a GraphQL API, or a database, you can always connect to it. For instance, some time ago I coded a NPM package to query MongoDB from cypress, this is the way I found to connect to the data source of the app I was testing at that time.
Avoid testing against static data
Testing against static data is a bad practice, because it will make your tests brittle, and they will break as soon as the data changes.