Really need an advice how to dynamically create parameterized tests from the file (json or yaml) in python. File contains list of urls
file example :
{ "name":"url_1", "url":"http://check.com","expected": "23"}
or :
{ "url_1", "http://check.com","23"}
Example like this:
@parameterized(from the file import name, expected)
def testUrl (self, name, url, expected):
run something (%s) url
assertTrue( expected = result)
OUTPUT :
test_for_url_1_ (test.TestClass) ... ok
test_for_url_2_ (test.TestClass) ... ok
I'm checking nose-parameterized for:
# An iterable of params
@parameterized(
param.explicit(*json.loads(line))
for line in open("testcases.jsons")
)
def test_from_json_file(...):
...
But can't make it work :(
Thank you in advance