本文整理汇总了Python中testlink.TestLinkHelper.getProjectIDByName方法的典型用法代码示例。如果您正苦于以下问题:Python TestLinkHelper.getProjectIDByName方法的具体用法?Python TestLinkHelper.getProjectIDByName怎么用?Python TestLinkHelper.getProjectIDByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testlink.TestLinkHelper
的用法示例。
在下文中一共展示了TestLinkHelper.getProjectIDByName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [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: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [as 别名]
#.........这里部分代码省略.........
self.assertEqual(5000, response[0]['code'])
def test_getTestCaseCustomFieldDesignValue_unknownID(self):
response = self.client.getTestCaseCustomFieldDesignValue(
4712, 1, 4711, 'a_field', 'a_detail')
self.assertIn('4711', response[0]['message'])
self.assertEqual(7000, response[0]['code'])
def test_getTestCaseIDByName_unknownID(self):
response = self.client.getTestCaseIDByName('Big Bird')
self.assertIn('getTestCaseIDByName', response[0]['message'])
self.assertEqual(5030, response[0]['code'])
def test_getTestCasesForTestPlan_unknownID(self):
response = self.client.getTestCasesForTestPlan(4711)
self.assertIn('4711', response[0]['message'])
self.assertEqual(3000, response[0]['code'])
def test_getTestCasesForTestSuite_unknownID(self):
response = self.client.getTestCasesForTestSuite(4711, 2, 'a_detail')
self.assertIn('4711', response[0]['message'])
self.assertEqual(8000, response[0]['code'])
def test_getTestPlanByName_unknownID(self):
response = self.client.getTestPlanByName('project 4711', 'plan 4712')
self.assertIn('4711', response[0]['message'])
self.assertEqual(7011, response[0]['code'])
def test_getTestPlanPlatforms_unknownID(self):
response = self.client.getTestPlanPlatforms(4711)
self.assertIn('4711', response[0]['message'])
self.assertEqual(3000, response[0]['code'])
def test_getTestProjectByName_unknownID(self):
response = self.client.getTestProjectByName('project 4711')
self.assertIn('4711', response[0]['message'])
self.assertEqual(7011, response[0]['code'])
def test_getTestSuiteByID_unknownID(self):
response = self.client.getTestSuiteByID(4711)
self.assertIn('4711', response[0]['message'])
self.assertEqual(8000, response[0]['code'])
def test_getTestSuitesForTestPlan_unknownID(self):
response = self.client.getTestSuitesForTestPlan(4711)
self.assertIn('4711', response[0]['message'])
self.assertEqual(3000, response[0]['code'])
def test_getTestSuitesForTestSuite_unknownID(self):
response = self.client.getTestSuitesForTestSuite(4711)
self.assertIn('4711', response[0]['message'])
self.assertEqual(8000, response[0]['code'])
def test_getTotalsForTestPlan_unknownID(self):
response = self.client.getTotalsForTestPlan(4711)
self.assertIn('4711', response[0]['message'])
self.assertEqual(3000, response[0]['code'])
def test_createTestProject_unknownID(self):
response = self.client.createTestProject('', 'P4711')
self.assertIn('Empty name', response[0]['message'])
self.assertEqual(7001, response[0]['code'])
def test_createBuild_unknownID(self):
response = self.client.createBuild(4711, 'Build 4712', 'note 4713')
self.assertIn('4711', response[0]['message'])
self.assertEqual(3000, response[0]['code'])
def test_createTestPlan_unknownID(self):
response = self.client.createTestPlan('plan 4711', 'project 4712')
self.assertIn('4712', response[0]['message'])
self.assertEqual(7011, response[0]['code'])
def test_createTestSuite_unknownID(self):
response = self.client.createTestSuite( 4711, 'suite 4712', 'detail 4713')
self.assertIn('4711', response[0]['message'])
self.assertEqual(7000, response[0]['code'])
def test_createTestCase_unknownID(self):
response = self.client.createTestCase('case 4711', 4712, 4713,
'Big Bird', 'summary 4714')
self.assertIn('4713', response[0]['message'])
self.assertEqual(7000, response[0]['code'])
def test_reportTCResult_unknownID(self):
response = self.client.reportTCResult(4711, 4712, 'build 4713', 'p',
'note 4714')
# FAILURE in 1.9.3 API message: replacement does not work
# The Test Case ID (testcaseid: %s) provided does not exist!
#self.assertIn('4711', response[0]['message'])
self.assertEqual(5000, response[0]['code'])
# def test_uploadExecutionAttachment_unknownID(self):
# response = self.client.uploadExecutionAttachment('file 4711', 4712,
# 'title 4713', 'descr. 4714')
# self.assertIn('4711', response[0]['message'])
def test_getProjectIDByName_unknownID(self):
response = self.client.getProjectIDByName('project 4711')
self.assertEqual(-1, response)
示例3: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [as 别名]
#.........这里部分代码省略.........
def test_createTestProject_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7001.*Empty name'):
self.client.createTestProject('', 'P4711')
def test_createBuild_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.createBuild(4711, 'Build 4712', 'note 4713')
def test_createTestPlan_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7011.*4712'):
self.client.createTestPlan('plan 4711', 'project 4712')
def test_createTestSuite_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
self.client.createTestSuite( 4711, 'suite 4712', 'detail 4713')
def test_createTestCase_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4713'):
self.client.createTestCase('case 4711', 4712, 4713,
'Big Bird', 'summary 4714')
def test_reportTCResult_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '5000.*4711'):
self.client.reportTCResult(4711, 4712, 'build 4713', 'p',
'note 4714')
def test_uploadExecutionAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '6004.*4712'):
self.client.uploadExecutionAttachment(attachemantFile, 4712,
'title 4713', 'descr. 4714')
def test_getProjectIDByName_unknownID(self):
response = self.client.getProjectIDByName('project 4711')
self.assertEqual(-1, response)
def test_createPlatform_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7011.*4711'):
self.client.createPlatform('Project 4711', 'Platform 4712',
notes='note 4713')
def test_addTestCaseToTestPlan_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
self.client.addTestCaseToTestPlan(4711, 4712, 'N-4713', 1)
def test_updateTestCase_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '5040.*N-4711'):
self.client.updateTestCase('N-4711', version=1)
def test_createTestCaseSteps_unknownID(self):
steps = [{'actions' : "Step action 6 -b added by updateTestCase" ,
'expected_results' : "Step result 6 - b added",
'step_number' : 6, 'execution_type' : 1}]
with self.assertRaisesRegexp(TLResponseError, '5040.*N-4711'):
self.client.createTestCaseSteps('update', steps,
testcaseexternalid='N-4711', version=1)
def test_deleteTestCaseSteps_unknownID(self):
steps = [2,8]
with self.assertRaisesRegexp(TLResponseError, '5040.*N-4711'):
self.client.deleteTestCaseSteps('N-4711', steps, version=1)
def test_uploadRequirementSpecificationAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '6004.*4712'):
示例4: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [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: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [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'])
#.........这里部分代码省略.........
示例6: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [as 别名]
#.........这里部分代码省略.........
def test_getTotalsForTestPlan_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "3000.*40000711"):
self.client.getTotalsForTestPlan(40000711)
def test_createTestProject_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "7001.*Empty name"):
self.client.createTestProject("", "P40000711")
def test_createBuild_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "3000.*40000711"):
self.client.createBuild(40000711, "Build 40000712", "note 40000713")
def test_createTestPlan_projectname_posArg_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "7011.*40000712"):
self.client.createTestPlan("plan 40000711", "project 40000712")
def test_createTestSuite_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "7000.*40000711"):
self.client.createTestSuite(40000711, "suite 40000712", "detail 40000713")
def test_createTestCase_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "7000.*40000713"):
self.client.createTestCase("case 40000711", 40000712, 40000713, "Big Bird", "summary 40000714")
def test_reportTCResult_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "5000.*40000711"):
self.client.reportTCResult(40000711, 40000712, "build 40000713", "p", "note 40000714")
def test_uploadExecutionAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), "r")
with self.assertRaisesRegex(TLResponseError, "6004.*40000712"):
self.client.uploadExecutionAttachment(attachemantFile, 40000712, "title 40000713", "descr. 40000714")
def test_getProjectIDByName_unknownID(self):
response = self.client.getProjectIDByName("project 40000711")
self.assertEqual(-1, response)
def test_createPlatform_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "7011.*40000711"):
self.client.createPlatform("Project 40000711", "Platform 40000712", notes="note 40000713")
def test_addTestCaseToTestPlan_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "7000.*40000711"):
self.client.addTestCaseToTestPlan(40000711, 40000712, "N-40000713", 1)
def test_updateTestCase_unknownID(self):
with self.assertRaisesRegex(TLResponseError, "5040.*N-40000711"):
self.client.updateTestCase("N-40000711", version=1)
def test_createTestCaseSteps_unknownID(self):
steps = [
{
"actions": "Step action 6 -b added by updateTestCase",
"expected_results": "Step result 6 - b added",
"step_number": 6,
"execution_type": 1,
}
]
with self.assertRaisesRegex(TLResponseError, "5040.*N-40000711"):
self.client.createTestCaseSteps("update", steps, testcaseexternalid="N-40000711", version=1)
def test_deleteTestCaseSteps_unknownID(self):
steps = [2, 8]
with self.assertRaisesRegex(TLResponseError, "5040.*N-40000711"):
self.client.deleteTestCaseSteps("N-40000711", steps, version=1)
示例7: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [as 别名]
#.........这里部分代码省略.........
def test_getProjects(self):
response = self.client.getProjects()
self.assertIsNotNone(response)
def test_getProjectTestPlans_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
self.client.getProjectTestPlans(4711)
def test_getTestCase_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '5000.*4711'):
self.client.getTestCase(4711)
def test_getTestCase_unknownExternalID(self):
with self.assertRaisesRegexp(TLResponseError, '5040.*N-2'):
self.client.getTestCase(testcaseexternalid='N-2')
def test_getTestCaseAttachments_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '5000.*4711'):
self.client.getTestCaseAttachments(4711)
def test_getTestCaseCustomFieldDesignValue_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
self.client.getTestCaseCustomFieldDesignValue(
'TC-4712', 1, 4711, 'a_field', 'a_detail')
def test_getTestCaseIDByName_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '5030.*Cannot find'):
self.client.getTestCaseIDByName('Big Bird')
def test_getTestCasesForTestPlan_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getTestCasesForTestPlan(4711)
def test_getTestCasesForTestSuite_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '8000.*4711'):
self.client.getTestCasesForTestSuite(4711, 2, 'a_detail')
def test_getTestPlanByName_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7011.*4711'):
self.client.getTestPlanByName('project 4711', 'plan 4712')
def test_getTestPlanPlatforms_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getTestPlanPlatforms(4711)
def test_getTestProjectByName_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7011.*4711'):
self.client.getTestProjectByName('project 4711')
def test_getTestSuiteByID_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '8000.*4711'):
self.client.getTestSuiteByID(4711)
def test_getTestSuitesForTestPlan_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getTestSuitesForTestPlan(4711)
def test_getTestSuitesForTestSuite_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '8000.*4711'):
self.client.getTestSuitesForTestSuite(4711)
def test_getTotalsForTestPlan_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getTotalsForTestPlan(4711)
def test_createTestProject_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7001.*Empty name'):
self.client.createTestProject('', 'P4711')
def test_createBuild_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.createBuild(4711, 'Build 4712', 'note 4713')
def test_createTestPlan_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7011.*4712'):
self.client.createTestPlan('plan 4711', 'project 4712')
def test_createTestSuite_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
self.client.createTestSuite( 4711, 'suite 4712', 'detail 4713')
def test_createTestCase_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4713'):
self.client.createTestCase('case 4711', 4712, 4713,
'Big Bird', 'summary 4714')
def test_reportTCResult_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '5000.*4711'):
self.client.reportTCResult(4711, 4712, 'build 4713', 'p',
'note 4714')
def test_uploadExecutionAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '6004.*4712'):
self.client.uploadExecutionAttachment(attachemantFile, 4712,
'title 4713', 'descr. 4714')
def test_getProjectIDByName_unknownID(self):
response = self.client.getProjectIDByName('project 4711')
self.assertEqual(-1, response)
示例8: TestClass
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [as 别名]
class TestClass():
def setUp(self):
"""Initialisation
"""
# precondition - SERVEUR_URL and KEY are defined in environment
# TESTLINK_API_PYTHON_SERVER_URL=http://localhost/testlink/lib/api/xmlrpc.php
# TESTLINK_API_PYTHON_DEVKEY=7ec252ab966ce88fd92c25d08635672b
self.client = TestLinkHelper().connect(TestLink)
def test_getTestCaseIDByName(self):
""" getTestCaseIDByName test
"""
val = self.client.getTestCaseIDByName("Fin de programme", "Séquence 2", "Test 2")
# 31 is test case id
assert_equal(val, '31' )
# Check if an error is raised in case of bad parameters
assert_raises(TestLinkError, self.client.getTestCaseIDByName, "Initialisation", "Séquence 1", "Test 2")
def test_getTestProjectByName(self):
project = self.client.getTestProjectByName("Test 2")
assert_equals(type(project), dict)
# Check if an error is raised in case of bad parameters
assert_raises(TestLinkError, self.client.getTestProjectByName, "Unknown project")
def test_getTestPlanByName(self):
plan_ok = self.client.getTestPlanByName("Test 2", "Full")
# Assume that plan id is 33
assert_equal(plan_ok['id'], '33')
assert_raises(TestLinkError, self.client.getTestPlanByName, "Test 2", "Name Error")
def test_getBuildByName(self):
pass
def test_reportResult(self):
dico = {'testPlanName': 'FullAuto',
'buildName': 'V0.1'}
execid = self.client.reportResult("p", "test1", "S1", "An example of note", **dico)
assert_equal(type(execid), str)
execid = self.client.reportResult("f", "test2", "S1", **dico)
assert_equal(type(execid), str)
def test_getTestCasesForTestPlan(self):
results = self.client.getTestCasesForTestPlan("Automatique", "FullAuto")
for result in results:
print result
#TODO
# assert_equal(type(results), list)
#for elem in results:
#assert_equal(type(elem), dict)
def test_getTestCaseCustomFieldDesignValue(self):
test_list = self.client.getTestCasesForTestPlan("Automatique", "FullAuto")
for test in test_list:
#print test
results = self.client.getTestCaseCustomFieldDesignValue("AutomaticTestFunction", "Automatique", test )
if results != '':
assert_equal(results, 'Fonction_auto-5')
def test_getProjectIDByName(self):
projectid = self.client.getProjectIDByName("Automatique")
assert_equal(projectid, '52')
def test_getTestCaseByExtID(self):
"""getTestCaseByExtID test method"""
assert_raises(TestLinkErrors, self.client.getTestCaseByExtID, 'Id not known')
extid = 'auto-5'
tc = self.client.getTestCaseByExtID(extid)
assert_equal(tc.extid, extid)
def test_getTestCase(self):
"""getTestCase test method"""
tc = self.client.getTestCase(testcaseexternalid='auto-5')
# tc must be an TestCase object
assert_equal(tc.extid, 'auto-5')
# Test failed Return
assert_raises(TestLinkErrors, self.client.getTestCase, 'Id not known')
示例9: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [as 别名]
#.........这里部分代码省略.........
def test_createTestProject_unknownITS(self):
with self.assertRaisesRegex(TLResponseError, '13000.*Unable to find'):
self.client.createTestProject(testprojectname='aProject',
testcaseprefix='aPrefix', itsname='unknownITS')
def test_createBuild_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '3000.*40000711'):
self.client.createBuild(40000711, 'Build 40000712', 'note 40000713')
def test_createTestPlan_projectname_posArg_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '7011.*40000712'):
self.client.createTestPlan('plan 40000711', 'project 40000712')
def test_createTestSuite_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '7000.*40000711'):
self.client.createTestSuite( 40000711, 'suite 40000712', 'detail 40000713')
def test_createTestCase_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '7000.*40000713'):
self.client.createTestCase('case 40000711', 40000712, 40000713,
'Big Bird', 'summary 40000714')
def test_reportTCResult_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '5000.*40000711'):
self.client.reportTCResult(40000711, 40000712, 'build 40000713', 'p',
'note 40000714')
def test_uploadExecutionAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegex(TLResponseError, '6004.*40000712'):
self.client.uploadExecutionAttachment(attachemantFile, 40000712,
'title 40000713', 'descr. 40000714')
def test_getProjectIDByName_unknownID(self):
response = self.client.getProjectIDByName('project 40000711')
self.assertEqual(-1, response)
def test_createPlatform_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '7011.*40000711'):
self.client.createPlatform('Project 40000711', 'Platform 40000712',
notes='note 40000713')
def test_addTestCaseToTestPlan_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '7000.*40000711'):
self.client.addTestCaseToTestPlan(40000711, 40000712, 'N-40000713', 1)
def test_updateTestCase_unknownID(self):
with self.assertRaisesRegex(TLResponseError, '5040.*N-40000711'):
self.client.updateTestCase('N-40000711', version=1)
def test_createTestCaseSteps_unknownID(self):
steps = [{'actions' : "Step action 6 -b added by updateTestCase" ,
'expected_results' : "Step result 6 - b added",
'step_number' : 6, 'execution_type' : 1}]
with self.assertRaisesRegex(TLResponseError, '5040.*N-40000711'):
self.client.createTestCaseSteps('update', steps,
testcaseexternalid='N-40000711', version=1)
def test_deleteTestCaseSteps_unknownID(self):
steps = [2,8]
with self.assertRaisesRegex(TLResponseError, '5040.*N-40000711'):
self.client.deleteTestCaseSteps('N-40000711', steps, version=1)
def test_uploadRequirementSpecificationAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '6004.*40000712'):
示例10: TestLinkAPIOfflineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import getProjectIDByName [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)
#.........这里部分代码省略.........