TestMessagingSystem is a suite that I have defined inside a fixture of the same name. Could I pass an argument to either the suite or the fixture? Preferably I would like to pass it to the fixture. The reason I need to do this is that I am running these tests using a middleware that requires the context from the main class to use some of it's functions. So I need to pass the context "down" to the individual tests. Is that possible?
Cheers
Shanker
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is not part of the API. Perhaps derive your own runner class from TextTestRunner and pass the parameter to the constructor or to a method that you add before making the runner.run() call.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Which means I overloaded the suite function. If someone is interested in the same, I used a static variable of the fixture to store the variable that I passed through.
2. Then in the main program, I didn't use the CPPUNIT_TEST_SUITE_REGISTRATION macro either. Instead, I did:
which means that I defined the fixture explicitly, also of name TestMessagingSystem. Then I called the suite inside and a passed an argument (which is the this pointer here).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I would like to send an argument to a test fixture/suite. At the moment, the test suites that I am running look like:
TestMessagingSystem is a suite that I have defined inside a fixture of the same name. Could I pass an argument to either the suite or the fixture? Preferably I would like to pass it to the fixture. The reason I need to do this is that I am running these tests using a middleware that requires the context from the main class to use some of it's functions. So I need to pass the context "down" to the individual tests. Is that possible?
Cheers
Shanker
That is not part of the API. Perhaps derive your own runner class from TextTestRunner and pass the parameter to the constructor or to a method that you add before making the runner.run() call.
If this is interesting to someone who has a similar question, here is what I did.
1. I defined the TestMessagingSystem suite without using the macros and instead something like:
Which means I overloaded the suite function. If someone is interested in the same, I used a static variable of the fixture to store the variable that I passed through.
2. Then in the main program, I didn't use the CPPUNIT_TEST_SUITE_REGISTRATION macro either. Instead, I did:
which means that I defined the fixture explicitly, also of name TestMessagingSystem. Then I called the suite inside and a passed an argument (which is the this pointer here).