By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

creating test suites

P: 13
I am a newbie and that says it all about posting a basic doubt. I still hope someone helps me out .

I am unit testing some modules. My test module is in diff file than the modules
to be tested. My code is something like this :

<PRE>

class xyz(unittest.TestCase):

def testAbc():
.....
def testPqr():
.....
def testKlm():
.....

def makeTestSuite():

suite = unittest.TestSuite()
suite.addTest(xyz("testAbc"))
suite.addTest(xyz("testPqr"))
return suite

if __name__ == "__main__":
unittest.main()

</PRE>
But, though i am adding only tow test cases in the test suite, all the 3 test cases are running. I cannot figure out the reson. Could someone please help me?

Regards,
rdps
Nov 13 '06 #1
Share this Question
Share on Google+
3 Replies


bartonc
Expert 5K+
P: 6,596
I am a newbie and that says it all about posting a basic doubt. I still hope someone helps me out .

I am unit testing some modules. My test module is in diff file than the modules
to be tested. My code is something like this :

<PRE>

class xyz(unittest.TestCase):

def testAbc():
.....
def testPqr():
.....
def testKlm():
.....

def makeTestSuite():

suite = unittest.TestSuite()
suite.addTest(xyz("testAbc"))
suite.addTest(xyz("testPqr"))
return suite

if __name__ == "__main__":
unittest.main()

</PRE>
But, though i am adding only tow test cases in the test suite, all the 3 test cases are running. I cannot figure out the reson. Could someone please help me?

Regards,
rdps
Great question! I'll do some research and get back to you. In the meanwhile, please read the posting guidelines located in the panel on the right as you post or the sticky (first post) on this forum to learn how to use code tags around code in your post. It helps us help you. Thanks,
Barton (PFM)
Nov 13 '06 #2

P: 38
Try to use
Expand|Select|Wrap|Line Numbers
  1. unittest.TextTestRunner(verbosity=2).run(suite)
instead of
Expand|Select|Wrap|Line Numbers
  1. unittest.main()
to see if it makes any difference.

BR
/Fredrik
Nov 13 '06 #3

P: 13
Thanks for the replies...but the solution doesnt seem to work for me. All the test cases run, evn though i want to run only 2 of the three test cases.

Currently i am using Eclipse IDE for running the tests but in future i plan to run the test suites through command line. Any pointers regarding how to run the test suite from command line?
Nov 14 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.