How to auto create test cases with minimum codingLets say , you want to run a series of test cases that undergo similar kind of testing . but you need to generate different test cases for each comparison (or whatever test procedure you are using).
So imagine. We want to test a function. A function that accepts two variables, and an operator for comparison. Here's our test function:
def _test_func(self, a, b, exp, operator):
ans = 0
exec("ans = %d %s %d" % (a, operator, b))
We want to test above function with various inputs....And...we want each scenario as a test case...You might need it for test report or something...
Recently , we (me and my friend Sumant)came up with one more simpler model for the same purpose.
In case , you want to be extra cautious, you can use the decorator @nottest to indicate that the function is not a test method.
"from nose.tools import notttest"