How to verify the search function works as expected?

My web has so many tables with search function as below screenshot. My goal is creating a new keyword to check the search function works as expected. Could you please help me to find the best solution for this case. Thanks a lot!

Hi @vnduc74

It’s a tough problem from an end-to-end perspective. This is the type of problem I’d recommend that the development team tests by writing unit tests rather than relying on UI testing. You should verify that the data is being displayed correctly, not that the data being loaded is correct.

If your team already had unit tests, I’d recommend try using the mock data in these unit test cases. For example, a unit test could verify that the search function upon receiving input ‘Barrack’ would return a list of all people in the database with the first name ‘Barrack’, which means the expected data in the unit test must be available.

Then you can apply data-driven testing to see when you type ‘Barrack’ into the search bar the data being displayed is indeed the same as the expected data retrieved from the unit tests.

Cheers !

1 Like