Put it into two tests if you want to ensure that all asserts are evaluated regardless of failing.
Usually what I do is testSomeFunction, so all of the tests are surrounding the operation of SomeFunction. What I get is testing up to the first failing assertion, but that's not a big problem because all assertions must pass for the test to be good, so I fix the first failure, and then if there are more failures I fix those as they come up. Focusing on one failure at a time is definitely the way to go IMO.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
This the hows CppUnit work. The Assert whichever fails first, after that no assert is going to evaluate.
Tom have already given the soultion for this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am writing testcase and in each testcase there are multiple asserts. I face problem that not all the asserst are tested. For example
void testSample() { CPPUNIT_ASSERT_EQUAL_MESSAGE("This test should fail",1050,1060);
CPPUNIT_ASSERT_DOUBLES_EQUAL(15.4,15.9,0.1);
}
I see when I run this test only the first assert is evaluated and second is not . What is the problem.
Any help is highly appreciated
Put it into two tests if you want to ensure that all asserts are evaluated regardless of failing.
Usually what I do is testSomeFunction, so all of the tests are surrounding the operation of SomeFunction. What I get is testing up to the first failing assertion, but that's not a big problem because all assertions must pass for the test to be good, so I fix the first failure, and then if there are more failures I fix those as they come up. Focusing on one failure at a time is definitely the way to go IMO.
Hi
This the hows CppUnit work. The Assert whichever fails first, after that no assert is going to evaluate.
Tom have already given the soultion for this.