469,592 Members | 1,801 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

creating test suites

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
3 1387
bartonc
6,596 Expert 4TB
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
fuffens
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
rdps
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.

Similar topics

41 posts views Thread by Roy Smith | last post: by
2 posts views Thread by vadi | last post: by
6 posts views Thread by Param R. | last post: by
5 posts views Thread by VvanN | last post: by
176 posts views Thread by nw | last post: by
48 posts views Thread by Ark Khasin | last post: by
2 posts views Thread by prem | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.