Dividie test cases?

Hello!
I have a question about this situation, i have a section that has 3 values that are the sum of all values of some cards in that section.
I was wondering how would you recomend to write the automated scripts.
I want to check that the sum of the values in the cards are the same as the value at the top.
Would you write one test case with 3 asserts?
Would you write three test cases with one assert each?

I was thinking about writing three test cases since i think is a good practice that test cases are unit.
But at the same time, the test cases will be running x3 in time.

How would you write the scripts?

2 Likes

Hi @jcalienni !

can you put the data somewhere and use the same test case with different data ?
https://www.guru99.com/data-driven-testing.html
Hope that help :slight_smile:

Are you checking this via the UI? If I was I would consider doing it all together (sequential checks) as I likely have to go through some steps to get to that point.

If possible to do this via API then I would consider to make the tests totally atomic, they will (may) run so fast anyway that it wont matter if there are 3 “tests” instead of 1 (though it looks like there is more than 3 checks to made)

2 Likes

I’d check if the calculation of numbers that represent money is being done in CENTS.

If you go around calculating numbers that represent money with Doubles and then round them down to 2 numbers behind the dot it’ll give you rounding errors when it comes to doing calculations with money.

Other than that, I’d write unit tests for this. But…computers know how to calculate, so it also seems a bit silly to just test for is 2 + 2 = 4.

Im doing the scripts in UI with selenium. It can be done with API but i don’t have the knowledge to do this haha.
So far i created three separated tests and each one is running for 10 secs. If i write the three asserts in a same test it would save a lot of time. So i think i will do that.
I’m confussed in how to do this since if i’m not mistaken the best practice would be to write one test for each assert. But so far i was mostly advices to do the three asserts in the same scripts.