pyUnit and dynamic test functions
Sakcee
sakcee at gmail.com
Wed Dec 21 16:24:29 EST 2005
Please anyone help, is this kind of dynamin thing possible? any
suggestion for creating frameworks for automated testing ,
all comments appreciated
thanks
Sakcee wrote:
> Hi
>
> I am trying to use pyUnit to create a framework for testing functions
>
> I am reading function name, expected output, from a text file.
> and in python generating dynamic test functions
> something like this
>
>
> class getUsStatesTest( unittest.TestCase ):
>
> self.setUp = lambda : function_call
> self.testReturnVal = lambda : self.assertEqual( fileInput,
> function_returnedVals )
> self.testLength = lambda : self.assertEqual( len(returnedVals)
> , len(inp) )
>
>
>
> is it possible to load these dynamic functions via pyUnit, instead of
> defining in text form ,
> can i use loadfromname etc to load these dynamic test functions.
>
> something like this
>
> unittest.TestSuite(unittest.defaultTestLoader.loadTestsFromName(
> getUsStatesTest() ))
>
> in this way I can completely automate every function that returns some
> output by dynamically generating its
> test functions
>
> thanks
More information about the Python-list
mailing list