0

for example: there is a function to be ran by nosetest,

def test_example(flag):
    nose.tools.assert_equal(flag, 'ok')

How to specified parameters of this function when i run commands 'nosetest' in the console?

pls help me, many tks!!

zhangke
  • 1
  • 1

1 Answers1

0

yeah! I finally found a solution by using 'htmlTestRunner'. I edit the source code of 'htmlTestRunner' and 'unittest'.

Run testCase like this:

    # 执行单个clss or 方法
def run_by_cl_func(self):
    # func = TestLoader().loadTestsFromName('TestStringMethods. test_example')
    # suite = TestSuite([func])
    func = TestLoader().loadTestsFromName('TestStringMethods.test_param',{"flag": "this is key"})
    suite = TestSuite([func])
    runner = HTMLTestRunner(output='htmlTestRunner', report_title='Test')
    runner.run(suite)
zhangke
  • 1
  • 1