Hello
Could you share your experience how do you (your company)
test code?
We are using
JUnit 4, and we have naming convention for all test methods.
after annotation @Test, we give each method name
test<OriginalMethodName>
testMakeSearch()
testReset()
and so on
but sometimes we have to make more then one test case for one method.
For example: we want to test makeSearch(...) with different parameters.
We have two possible solutions:
1. put all checks in one method, like:
public testMakeSearch() {
case1
case2
...
}
2. make one test method for each case
Variant 1 is not too good, as we will not see what cases are ok - we will see fail after first fail.
Variant 2 is better, but I don't know which naming convention to use...
testMakeSearch_case1()
testMakeSearch_case2()
but as I know "_" is not recommended in names (but not resticted)
how do you resolve this?
thanks