vendredi 25 mai 2018

How to write good test unit/functional test for such case?

This thread is more about idea not giving ready code.

I'am currently making Dusk (Selenium implemented in Laravel) tests for application. I have functionality which is returning : search users which like color blue. It's ofc bit more complicated (relations, many models etc. etc.). I wrote 2 tests right now.

  • searching for users who likes color abc. Only my test users like it so I know what result I should get. I am doing comparison between db query and int.

  • searching for users who likes color (random from available colors) in db. It's same logic as previous with real color name.

I think that it's not good, beacause I never know what result I should get from db. Checking manually in db is hard with large amount of users.

I am asking for some ideas how and what I should test to be shure that functionality returns correct result.

Aucun commentaire:

Enregistrer un commentaire