I'm writing some end-to-end automated tests for a CRM-alike web application. One of the development team leaders is asking me to do something that I've never done before.

The problem is that the data that is being displayed in the views of the application is sometimes different after each synchronization/deployment, but the data should always be the same.

The data comes from different stored procedures inside a SQL Server database, and they are using some kind of soft coding solution to develop the application and connect it to these stored procedures. I would like to know if it is possible and advisable to include this data verification in the automation process (as they are asking me to do) and what solutions would be appropriate for this.

We are using Cypress as our automation tool. The idea would be to somehow store the data after running the automated tests, and then the next time we run the tests again, the stored data is compared against the data of the current execution. If the data is different, that should cause the tests to fail.

This is my first time asking a question here, any ideas?

4 Answers 4


This is called snapshot testing (because you're comparing the app data to a "snapshot" that represents the expected data), and you can do it manually by storing your data in a file (usually in the fixtures/ directory), loading it during the test, and asserting that it matches the data in the app. See the documentation for cy.fixture(), and Fixture examples.

There are plugins that help with that by providing Cypress commands. For example: @cypress/snapshot.


If you know the output data, you can uses fixture folder to create a json file(or any other file) to store data in a proper format. There after you can compare data in the file with the new data. If you give more details about the output data it will be more clear to provide a better answer.

If you can try intercepting to the API. If you do it, you can get response body to compare data directly without dealing with UI element. API will have a json and also have created a json using a previous data.


Yes, we can perform data validation by using Cypress.


1.Integrate MySQL Plugin in Package.Json file.

2.Design SQL connectivity code in .js file with appropriate database connection String

3.Use Cypress cy.task() to execute SQL queries from cypress and then we can compare that data with any Webpage or BI Report data.


Yes that's possible. You can use something like writing your data into Cypress/fixture and store it in a json/csv file. The next time you run the code, you

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 26, 2022 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.