lyuts
12th July 2010, 19:47
Hello, guys.
I was just developing unit tests for my application and got really confused about what is "test case" in terms of QTestLib. I need some initialization to be done before each test runs, so I explored docs in Qt Assistant and found initTestCase() slot. So I just had to override it. But I was surprised to see that this slot is called only once. I read QTestLib docs once again and found this:
initTestCase() will be called before the first testfunction is executed.
cleanupTestCase() will be called after the last testfunction was executed.
init() will be called before each testfunction is executed.
cleanup() will be called after every testfunction.
This confused me greatly. As far as I understand (at least it seemed to me that I understood that right) there is "test suite" which is a set of test cases (wikipedia and cppunit told me the same). It should make sense that there should be something like initTestSuite and initTestCase (the same with cleanup).
As it appears in Qt:
Qt's initTestCase corresponds to theory's initTestSuite and
Qt's init corresponds to theory's initTestCase.
I don't understand why these terms are rearanged in Qt.
Doesn't this look a little bit wrong to you? Maybe someone knows the reason for this?
I was just developing unit tests for my application and got really confused about what is "test case" in terms of QTestLib. I need some initialization to be done before each test runs, so I explored docs in Qt Assistant and found initTestCase() slot. So I just had to override it. But I was surprised to see that this slot is called only once. I read QTestLib docs once again and found this:
initTestCase() will be called before the first testfunction is executed.
cleanupTestCase() will be called after the last testfunction was executed.
init() will be called before each testfunction is executed.
cleanup() will be called after every testfunction.
This confused me greatly. As far as I understand (at least it seemed to me that I understood that right) there is "test suite" which is a set of test cases (wikipedia and cppunit told me the same). It should make sense that there should be something like initTestSuite and initTestCase (the same with cleanup).
As it appears in Qt:
Qt's initTestCase corresponds to theory's initTestSuite and
Qt's init corresponds to theory's initTestCase.
I don't understand why these terms are rearanged in Qt.
Doesn't this look a little bit wrong to you? Maybe someone knows the reason for this?