Negative test cases | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

Negative test cases

A hammer can push a nail into a wall but cannot cut a tree, for that you need an axe ! This example certifies that negative test cases are as important as the positive ones ?šŸ¤” Yes or no ?

1st Aug 2019, 1:46 AM
Sanjay Kamath
Sanjay Kamath - avatar
3 Respostas
+ 6
So what is the negative test case here? A test to verify that a hammer can't cut a tree?
1st Aug 2019, 7:13 AM
Sonic
Sonic - avatar
+ 5
Well I guess that would depend on the size of the tree and your willingness to pound a hammer at it, because Iā€™m sure a hammer will knock a tree down if youā€™re patient or strong enough to keep at it. I think that best represents using the right tool for the job. (You wouldnt use a thousand lines of if statements to check each element in a large list when a loop can do it in 5 lines would you?) You install a pad-lock to secure your belongings, but it turns out it never came with a code. Well your stuff is safe, but now you canā€™t access them either. (probably shouldā€™ve made sure it came with a code)
1st Aug 2019, 2:38 AM
Jake
Jake - avatar
+ 2
So what is the negative test case here? A test to verify that a hammer can't cut a tree? šŸ¤”šŸ¤”šŸ¤” Yes !!
1st Aug 2019, 11:02 AM
Sanjay Kamath
Sanjay Kamath - avatar