本文整理汇总了Python中testlink.TestLinkHelper.loadScenario方法的典型用法代码示例。如果您正苦于以下问题:Python TestLinkHelper.loadScenario方法的具体用法?Python TestLinkHelper.loadScenario怎么用?Python TestLinkHelper.loadScenario使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testlink.TestLinkHelper
的用法示例。
在下文中一共展示了TestLinkHelper.loadScenario方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import loadScenario [as 别名]
class TestLinkAPIOfflineTestCase(unittest.TestCase):
""" TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
works with DummyAPIClientm which returns special test data
"""
def setUp(self):
self.api = TestLinkHelper().connect(DummyAPIClient)
# def tearDown(self):
# pass
def test_countProjects(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countProjects()
self.assertEqual(2, response)
def test_countTestPlans(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestPlans()
self.assertEqual(1, response)
def test_countTestSuites(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestSuites()
self.assertEqual(0, response)
def test_countTestCasesTP(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTP()
self.assertEqual(0, response)
def test_countTestCasesTS(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTS()
self.assertEqual(0, response)
def test_countPlatforms(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countPlatforms()
self.assertEqual(0, response)
def test_countBuilds(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countBuilds()
self.assertEqual(0, response)
# def test_listProjects(self):
# self.api.loadScenario(SCENARIO_A)
# self.api.listProjects()
# no assert check cause method returns nothing
# 'just' prints to stdout
def test_getProjectIDByName(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectIDByName('NEW_PROJECT_API')
self.assertEqual('21', response)
response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
self.assertEqual(-1, response)
示例2: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import loadScenario [as 别名]
class TestLinkAPIOfflineTestCase(unittest.TestCase):
""" TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
works with DummyAPIClientm which returns special test data
"""
example_steps = [{'step_number' : '1', 'actions' : "action A" ,
'expected_results' : "result A", 'execution_type' : "0"},
{'step_number' : '2', 'actions' : "action B" ,
'expected_results' : "result B", 'execution_type' : "1"},
{'step_number' : '3', 'actions' : "action C" ,
'expected_results' : "result C", 'execution_type' : "0"}]
def setUp(self):
self.api = TestLinkHelper().connect(DummyAPIClient)
# def tearDown(self):
# pass
def test_countProjects(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countProjects()
self.assertEqual(2, response)
def test_countTestPlans(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestPlans()
self.assertEqual(2, response)
def test_countTestSuites(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestSuites()
self.assertEqual(0, response)
def test_countTestCasesTP(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTP()
self.assertEqual(0, response)
def test_countTestCasesTS(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTS()
self.assertEqual(0, response)
def test_countPlatforms(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countPlatforms()
self.assertEqual(2, response)
def test_countBuilds(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countBuilds()
self.assertEqual(0, response)
# def test_listProjects(self):
# self.api.loadScenario(SCENARIO_A)
# self.api.listProjects()
# no assert check cause method returns nothing
# 'just' prints to stdout
def test_getProjectIDByName(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectIDByName('NEW_PROJECT_API')
self.assertEqual('21', response)
response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
self.assertEqual(-1, response)
def test_initStep(self):
self.api.initStep("action A", "result A", 0)
steps = self.example_steps[:1]
self.assertEqual(steps, self.api.stepsList)
def test_appendStep(self):
steps = self.example_steps
self.api.stepsList = steps[:1]
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
self.assertEqual(steps, self.api.stepsList)
def test_createTestCaseWithSteps(self):
self.api.loadScenario(SCENARIO_STEPS)
self.api.initStep("action A", "result A", 0)
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird',
'summary 4714')
self.assertEqual(self.example_steps, self.api.callArgs['steps'])
self.assertEqual([], self.api.stepsList)
def test_getTestCaseIDByName_dictResult(self):
"test that getTestCaseIDByName converts dictionary result into a list"
self.api.loadScenario(SCENARIO_A)
# v0.4.0 version for optional args testsuitename + testprojectname
#response = self.api.getTestCaseIDByName('dictResult', None, 'NEW_PROJECT_API')
# v0.4.5 version
response = self.api.getTestCaseIDByName('dictResult',
testprojectname='NEW_PROJECT_API')
self.assertEqual(list, type(response))
self.assertEqual('TESTCASE_B', response[0]['name'])
self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
#.........这里部分代码省略.........
示例3: TestLinkAPIGenericOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import loadScenario [as 别名]
#.........这里部分代码省略.........
self.assertRegex(response, 'createBuild\(<.*>.*\).*')
def test__apiMethodArgNames__MandatoryArgs(self):
response = self.api._apiMethodArgNames('uploadExecutionAttachment')
self.assertGreater(len(response[0]), 0)
self.assertGreater(len(response[1]), 0)
self.assertGreater(len(response[2]), 0)
def test_whatArgs_MandatoryArgs(self):
response = self.api.whatArgs('uploadExecutionAttachment')
self.assertRegex(response,
'uploadExecutionAttachment\(<attachmentfile>, <.*>.*\).*')
def test_whatArgs_unknownMethods(self):
response = self.api.whatArgs('apiUnknown')
self.assertRegex(response,
"callServerWithPosArgs\('apiUnknown', \[apiArg=<apiArg>\]\)")
def test_noWrapperName_apiMethods(self):
" decorator test: API Methods internal function name should be unchanged "
# apiMethod with decorator @decoApiCallWithoutArgs
self.assertEqual('sayHello', self.api.sayHello.__name__)
# apiMethod with decorator @decoApiCallWithArgs
self.assertEqual('repeat', self.api.repeat.__name__)
# apiMethod with decorator @decoApiCallAddDevKey
self.assertEqual('createBuild', self.api.createBuild.__name__)
# apiMethod with decorator @decoMakerApiCallReplaceTLResponseError()
self.assertEqual('getProjectTestPlans', self.api.getProjectTestPlans.__name__)
# apiMethod with decorator @decoApiCallAddAttachment
self.assertEqual('uploadExecutionAttachment', self.api.uploadExecutionAttachment.__name__)
def test_ping(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.ping()
self.assertEqual('Hey Folks!', response)
def test_getProjectTestPlans_noPlan(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectTestPlans('noPlan')
self.assertEqual([], response)
self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
def test_getProjectTestPlans_onePlan(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectTestPlans('onePlan')
self.assertEqual('21', response[0]['testproject_id'])
self.assertEqual(1, len(response))
def test_getProjectPlatforms_noPlatform(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectPlatforms('noPlatform')
self.assertEqual({}, response)
self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
def test_getProjectPlatforms_twoPlatforms(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectPlatforms('twoPlatforms')
self.assertEqual('1', response['dutch']['id'])
self.assertEqual(2, len(response))
def test_getBuildsForTestPlan_noBuild(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getBuildsForTestPlan('noBuild')
示例4: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import loadScenario [as 别名]
class TestLinkAPIOfflineTestCase(unittest.TestCase):
""" TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
works with DummyAPIClientm which returns special test data
"""
example_steps = [{'step_number' : '1', 'actions' : "action A" ,
'expected_results' : "result A", 'execution_type' : "0"},
{'step_number' : '2', 'actions' : "action B" ,
'expected_results' : "result B", 'execution_type' : "1"},
{'step_number' : '3', 'actions' : "action C" ,
'expected_results' : "result C", 'execution_type' : "0"}]
def setUp(self):
self.api = TestLinkHelper().connect(DummyAPIClient)
# def tearDown(self):
# pass
def test_countProjects(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countProjects()
self.assertEqual(2, response)
def test_countTestPlans(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestPlans()
self.assertEqual(2, response)
def test_countTestSuites(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestSuites()
self.assertEqual(0, response)
def test_countTestCasesTP(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTP()
self.assertEqual(0, response)
def test_countTestCasesTS(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTS()
self.assertEqual(0, response)
def test_countPlatforms(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countPlatforms()
self.assertEqual(2, response)
def test_countBuilds(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countBuilds()
self.assertEqual(0, response)
# def test_listProjects(self):
# self.api.loadScenario(SCENARIO_A)
# self.api.listProjects()
# no assert check cause method returns nothing
# 'just' prints to stdout
def test_getProjectIDByName(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectIDByName('NEW_PROJECT_API')
self.assertEqual('21', response)
response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
self.assertEqual(-1, response)
def test_initStep(self):
self.api.initStep("action A", "result A", 0)
steps = self.example_steps[:1]
self.assertEqual(steps, self.api.stepsList)
def test_appendStep(self):
steps = self.example_steps
self.api.stepsList = steps[:1]
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
self.assertEqual(steps, self.api.stepsList)
def test_createTestCaseWithSteps(self):
self.api.loadScenario(SCENARIO_STEPS)
self.api.initStep("action A", "result A", 0)
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird',
'summary 4714')
self.assertEqual(self.example_steps, self.api.callArgs['steps'])
self.assertEqual([], self.api.stepsList)
def test_createTestCaseWithConfusingSteps(self):
self.api.loadScenario(SCENARIO_STEPS)
self.api.initStep("action A", "result A", 0)
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
with self.assertRaisesRegexp(TLArgError, 'confusing createTestCase*'):
self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird',
'summary 4714', steps=[])
def test_getTestCaseIDByName_dictResult(self):
"test that getTestCaseIDByName converts dictionary result into a list"
self.api.loadScenario(SCENARIO_A)
#.........这里部分代码省略.........
示例5: TestLinkAPIGenericOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import loadScenario [as 别名]
#.........这里部分代码省略.........
self.assertRegexpMatches(response, 'createBuild\(<.*>.*\).*')
def test__apiMethodArgNames__MandatoryArgs(self):
response = self.api._apiMethodArgNames('uploadExecutionAttachment')
self.assertGreater(len(response[0]), 0)
self.assertGreater(len(response[1]), 0)
self.assertGreater(len(response[2]), 0)
def test_whatArgs_MandatoryArgs(self):
response = self.api.whatArgs('uploadExecutionAttachment')
self.assertRegexpMatches(response,
'uploadExecutionAttachment\(<attachmentfile>, <.*>.*\).*')
def test_whatArgs_unknownMethods(self):
response = self.api.whatArgs('apiUnknown')
self.assertRegexpMatches(response,
"callServerWithPosArgs\('apiUnknown', \[apiArg=<apiArg>\]\)")
def test_noWrapperName_apiMethods(self):
" decorator test: API Methods internal function name should be unchanged "
# apiMethod with decorator @decoApiCallWithoutArgs
self.assertEqual('sayHello', self.api.sayHello.__name__)
# apiMethod with decorator @decoApiCallWithArgs
self.assertEqual('repeat', self.api.repeat.__name__)
# apiMethod with decorator @decoApiCallAddDevKey
self.assertEqual('createBuild', self.api.createBuild.__name__)
# apiMethod with decorator @decoMakerApiCallReplaceTLResponseError()
self.assertEqual('getProjectTestPlans', self.api.getProjectTestPlans.__name__)
# apiMethod with decorator @decoApiCallAddAttachment
self.assertEqual('uploadExecutionAttachment', self.api.uploadExecutionAttachment.__name__)
def test_ping(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.ping()
self.assertEqual('Hey Folks!', response)
def test_getProjectTestPlans_noPlan(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectTestPlans('noPlan')
self.assertEqual([], response)
self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
def test_getProjectTestPlans_onePlan(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectTestPlans('onePlan')
self.assertEqual('21', response[0]['testproject_id'])
self.assertEqual(1, len(response))
def test_getProjectPlatforms_noPlatform(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectPlatforms('noPlatform')
self.assertEqual({}, response)
self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
def test_getProjectPlatforms_twoPlatforms(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectPlatforms('twoPlatforms')
self.assertEqual('1', response['dutch']['id'])
self.assertEqual(2, len(response))
def test_getBuildsForTestPlan_noBuild(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getBuildsForTestPlan('noBuild')
示例6: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import loadScenario [as 别名]
class TestLinkAPIOfflineTestCase(unittest.TestCase):
""" TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
works with DummyAPIClientm which returns special test data
"""
example_steps = [{'step_number' : '1', 'actions' : "action A" ,
'expected_results' : "result A", 'execution_type' : "0"},
{'step_number' : '2', 'actions' : "action B" ,
'expected_results' : "result B", 'execution_type' : "1"},
{'step_number' : '3', 'actions' : "action C" ,
'expected_results' : "result C", 'execution_type' : "0"}]
def setUp(self):
self.api = TestLinkHelper().connect(DummyAPIClient)
# def tearDown(self):
# pass
def test_countProjects(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countProjects()
self.assertEqual(2, response)
def test_countTestPlans(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestPlans()
self.assertEqual(2, response)
def test_countTestSuites(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestSuites()
self.assertEqual(0, response)
def test_countTestCasesTP(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTP()
self.assertEqual(0, response)
def test_countTestCasesTS(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countTestCasesTS()
self.assertEqual(0, response)
def test_countPlatforms(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countPlatforms()
self.assertEqual(2, response)
def test_countBuilds(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.countBuilds()
self.assertEqual(0, response)
# def test_listProjects(self):
# self.api.loadScenario(SCENARIO_A)
# self.api.listProjects()
# no assert check cause method returns nothing
# 'just' prints to stdout
def test_getProjectIDByName(self):
self.api.loadScenario(SCENARIO_A)
response = self.api.getProjectIDByName('NEW_PROJECT_API')
self.assertEqual('21', response)
response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
self.assertEqual(-1, response)
def test_initStep(self):
self.api.initStep("action A", "result A", 0)
steps = self.example_steps[:1]
self.assertEqual(steps, self.api.stepsList)
def test_appendStep(self):
steps = self.example_steps
self.api.stepsList = steps[:1]
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
self.assertEqual(steps, self.api.stepsList)
def test_createTestCaseWithSteps(self):
self.api.loadScenario(SCENARIO_STEPS)
self.api.initStep("action A", "result A", 0)
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird',
'summary 4714')
self.assertEqual(self.example_steps, self.api.callArgs['steps'])
self.assertEqual([], self.api.stepsList)
def test_createTestCaseWithConfusingSteps(self):
self.api.loadScenario(SCENARIO_STEPS)
self.api.initStep("action A", "result A", 0)
self.api.appendStep("action B", "result B", 1)
self.api.appendStep("action C", "result C", 0)
with self.assertRaisesRegexp(TLArgError, 'confusing createTestCase*'):
self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird',
'summary 4714', steps=[])
def test_getTestCaseIDByName_dictResult(self):
"test that getTestCaseIDByName converts dictionary result into a list"
self.api.loadScenario(SCENARIO_A)
#.........这里部分代码省略.........