[TIP] Supplying variable options to unittest2 tests

Perry Johnson Perry.Johnson at efi.com
Wed Jun 22 07:08:17 PDT 2016

Hi all,

I hope this is the right mailing list for this type of question, but I am trying to work with unittest to run through test cases, and I am just not understanding how to do what I need to do.  Knowledge wise I am a step up from beginner at Python, and I am without a formal CS degree.  If I should go to another list, please, let me know which one, and accept my apologies.

Here is the set up.

I have a list of settings for software on a physical device which are test cases from a test case management application.  These cases involve setting options on the device through software, running a test, and checking the device's output.  I have set up a basic script to do the options setting, running, and checking.  I also have a framework supplied to me using unittest2 that will generate an html file with results of test cases run, using the unittest2.TestCase class.

I would like to get each "test case" from the TCM application, run those settings through my script, and then get the results from the existing framework.  The trouble is I don't see a way to feed variable options into the unittest2.TestCase, and from what I have read this may not be what the module was designed for.  Creating individual test_ methods for every set of test case options is unwieldy because the options change, and there are thousands of tests.

Is there an easy way to work around this, or would it be easier to scrap the supplied framework and use another module set for testing?  My boss would like me to use the existing framework, but if it isn't too much trouble I could probably build my own in my off hours.

Thank you for reading.

Best Regards,
Perry Johnson

Confidentiality notice: This message may contain confidential information. It is intended only for the person to whom it is addressed. If you are not that person, you should not use this message. We request that you notify us by replying to this message, and then delete all copies including any contained in your reply. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20160622/df64835b/attachment.html>

More information about the testing-in-python mailing list