473,839 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

creating test suites

13 New Member
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.Te stCase):

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

def makeTestSuite() :

suite = unittest.TestSu ite()
suite.addTest(x yz("testAbc"))
suite.addTest(x yz("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 1597
bartonc
6,596 Recognized Expert Expert
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.Te stCase):

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

def makeTestSuite() :

suite = unittest.TestSu ite()
suite.addTest(x yz("testAbc"))
suite.addTest(x yz("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 New Member
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 New Member
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

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

Similar topics

41
10310
by: Roy Smith | last post by:
I've used the standard unittest (pyunit) module on a few projects in the past and have always thought it basicly worked fine but was just a little too complicated for what it did. I'm starting a new project now and I'm thinking of trying py.test (http://codespeak.net/py/current/doc/test.html). It looks pretty cool from the docs. Is there anybody out there who has used both packages and can give a comparative review?
2
2010
by: vadi | last post by:
Can any one help me in finding the test suite (test C++ examples) for testing the C++ parser.
7
3123
by: Tao Wang | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I saw cuj's conformance roundup, but the result is quite old. I think many people like me want to know newer c++ standard conformance test result. Especially, I want to know the compiler conformance of vc7.1, vc8.0, gcc 4.x and intel c++, and also each implementation of STL. The world is moving on, right? :)
6
1182
by: Param R. | last post by:
Hi all, could someone recommend some good control suites for asp.net that I can purchase. I am specifically looking for enhanced controls like calendaring, scheduling, menus, treets and charts(all kinds, 2d & 3d). I am also looking for something that does not require vs.net and that I can code with a text editor instead. It also needs to run on .net 1.1+. Any suggestions? I am currently looking into Infragistics.. thanks
5
2517
by: VvanN | last post by:
hi, fellows I'd like to intruduce a new unit test framework for C++ freely available at: http://unit--.sourceforge.net/ It does not need bothering test registration, here is an example // --- begin code ---
17
2533
by: CBFalconer | last post by:
David Brown wrote: .... snip ... The problem with the gcc test suite is that it is geared to the gcc 'standard', rather than the ISO standard. A test suite should be open-source, and there should probably be several of them (with some commonality), one each for C90, C99, and C0X. The tests should be clearly tied to the standard. There are several classes of tests needed, i.e. conformance, detection of errors, and quality. The last...
176
8508
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write their own unit test framework, and then in a lab session see if I can get them to write their own. To give them an example I've created the following UTF class (with a simple test program following). I would welcome and suggestions on how anybody...
48
2529
by: Ark Khasin | last post by:
Unit testing is an integral component of both "formal" and "agile" models of development. Alas, it involves a significant amount of tedious labor. There are test automation tools out there but from what limited exposure I've had, they are pricey, reasonably buggy, and require compiler/target adaptation. Out of my frustration with two out of two of them came my own. Its instrumentation approach is based solely on profound abuse of the C
2
2039
by: prem | last post by:
Hi, Anybody know if there are any *FREE* ANSI C test suite for C/C++ for Compiler available? Any link/pointers is appreciated /Prem
0
9697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10908
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10586
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10648
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10293
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7828
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7017
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5866
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.