• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testlink.TestLinkHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中testlink.TestLinkHelper的典型用法代码示例。如果您正苦于以下问题:Python TestLinkHelper类的具体用法?Python TestLinkHelper怎么用?Python TestLinkHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TestLinkHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main(config_module=None):
    from testlinktool.main.config import TESTLINK_SERVER, TESTLINK_PROJECT_ID, TESTLINK_PROJECT_NAME,\
                                         TESTLINK_API_KEY, CUSTOM_FIELD_NAME_LIST, UI_TEST_KEYWORD

    # use configuration
    try:
        if config_module is not None:
            TESTLINK_SERVER = getattr(config_module, "TESTLINK_SERVER")
            TESTLINK_PROJECT_ID = getattr(config_module, "TESTLINK_PROJECT_ID")
            TESTLINK_PROJECT_NAME = getattr(config_module, "TESTLINK_PROJECT_NAME")
            TESTLINK_API_KEY = getattr(config_module, "TESTLINK_API_KEY")
            CUSTOM_FIELD_NAME_LIST = getattr(config_module, "CUSTOM_FIELD_NAME_LIST")
            UI_TEST_KEYWORD = getattr(config_module, "UI_TEST_KEYWORD")
        elif exists(join(getcwd(), 'config.json')):
            with open(join(getcwd(), 'config.json')) as j_file:
                conf_dic = json_read_file(j_file)
                TESTLINK_SERVER = conf_dic["TESTLINK_SERVER"]
                TESTLINK_PROJECT_ID = conf_dic["TESTLINK_PROJECT_ID"]
                TESTLINK_PROJECT_NAME = conf_dic["TESTLINK_PROJECT_NAME"]
                TESTLINK_API_KEY = conf_dic["TESTLINK_API_KEY"]
                CUSTOM_FIELD_NAME_LIST = conf_dic["CUSTOM_FIELD_NAME_LIST"]
                UI_TEST_KEYWORD = conf_dic["UI_TEST_KEYWORD"]
    except ImportError:
        print("Warning we are using default parameters")
    parser = argparse.ArgumentParser(description='')
    group = parser.add_argument_group()
    group.add_argument('-d', '--test-dir', dest='dest_dir',
                       help="The directory path where generated tests will be sent (defaults to 'tests')",
                       default="tests")
    group.add_argument('-p', '--plan', dest='plan', help="the test plan", default=None, required=True)
    group.add_argument('-a', '--download-all', dest='download_all', default=False, action="store_true",
                       help="if used will download all tests, even those which are already coded")
    group.add_argument('-v', '--verbose', dest='verbose', default=False, action="store_true",
                       help="verbosity")
    
    args = parser.parse_args()

    tl_helper = TestLinkHelper(TESTLINK_SERVER, TESTLINK_API_KEY)
    testlink_client = tl_helper.connect(TestlinkAPIClient)
    plan_id = int(testlink_client.getTestPlanByName(TESTLINK_PROJECT_NAME, args.plan)[0]['id'])
    suites = testlink_client.getTestSuitesForTestPlan(plan_id)
    # build a id/name relation dictionary
    suites_tc_dic = {
        suite["id"]: suite["name"] for suite in suites
    }
    cases = get_tests(testlink_client, UI_TEST_KEYWORD, plan_id, TESTLINK_PROJECT_ID, CUSTOM_FIELD_NAME_LIST)
    names = [n["tcase_name"] for n in cases]
    other_cases = get_tests(testlink_client, None, plan_id, TESTLINK_PROJECT_ID, CUSTOM_FIELD_NAME_LIST)
    cases += [n for n in other_cases if n["tcase_name"] not in names]
    for case in cases:
        case["suite"] = suites_tc_dic[case["testsuite_id"]]

    tests = []
    # if we do not force to download everythin we get already defined tests to avoid erasing them
    if not args.download_all:
        tests += list(set([a for a in get_test_names(defaultTestLoader.discover(args.dest_dir))]))
    # launch true creation
    for to_be_created in cases:
        if to_be_created["tcase_name"] not in tests:
            create_test_file(to_be_created, args.dest_dir, to_be_created["keyword"] == UI_TEST_KEYWORD, args.plan)
开发者ID:dcolam,项目名称:test-automation-framework,代码行数:60,代码来源:generate_test.py


示例2: test_callServer_ProtocollError

 def test_callServer_ProtocollError(self):
     """ test _callServer() - Server raises ProtocollError """
     
     server_url = TestLinkHelper()._server_url
     bad_server_url = server_url.split('xmlrpc.php')[0] 
     client = TestLinkHelper(bad_server_url).connect(TestlinkAPIClient)
     def a_func(api_client): api_client._callServer('sayHello')
     self.assertRaises(testlinkerrors.TLConnectionError, a_func, client)
开发者ID:MarynaQA,项目名称:TestLink-API-Python-client,代码行数:8,代码来源:testlinkapicallservertest.py


示例3: afterEditing

 def afterEditing(self):
     self.parentApp.host = self.hostBox.value
     self.parentApp.devkey = self.devkeyBox.value
     try:
         self.statusBox.value = 'Connecting...'
         tlh = TestLinkHelper(server_url='http://'+self.parentApp.host+'/lib/api/xmlrpc/v1/xmlrpc.php', devkey=self.parentApp.devkey)
         self.parentApp.tl = tlh.connect(TestlinkAPIClient)
         self.parentApp.tl.sayHello()
     except testlinkerrors.TLConnectionError as err:
         self.statusBox.value = err
     else:
         self.parentApp.setNextForm('IMPORT')
开发者ID:galen-elfert,项目名称:TLimport,代码行数:12,代码来源:TLimport.py


示例4: __init__

 def __init__(self, server_url, project_id,
              platformname, must_create_build,
              testlink_key, verbose=False, generate_xml=False):
     self.server_url = server_url
     self.generate_xml = generate_xml
     self.project_id = project_id
     self.platformname = platformname
     self.must_create_build = must_create_build
     self.testlink_key = testlink_key
     tl_helper = TestLinkHelper(self.server_url, self.testlink_key)
     self.testlink_client = tl_helper.connect(TestlinkAPIClient)
     self.plans = self.testlink_client.getProjectTestPlans(self.project_id)
     self.verbose = verbose
开发者ID:artragis,项目名称:test-automation-framework,代码行数:13,代码来源:TestLinkReport.py


示例5: create_api_client

    def create_api_client(self, client_class='TestlinkAPIClient', 
                          server_url=None, devkey=None):
        """Creates a new TestLink-API-Python-client (XMLRPC), using Python class 
        TestlinkAPIClient or TestlinkAPIGeneric. 
        """

        a_server_url  = server_url or self._server_url
        a_devkey      = devkey or self._devkey
        a_helper = TestLinkHelper(a_server_url, a_devkey)
        
        a_class_name  = client_class or self._client_class
        a_api_class   = globals()[a_class_name]
        self.api_client  = a_helper.connect(a_api_class)
        return self.api_client 
开发者ID:Maberi,项目名称:TestLink-API-Python-client,代码行数:14,代码来源:TestlinkAPILibrary.py


示例6: TestClass

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 = {'testProjectName': 'Automatique',
                '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)
开发者ID:manojpkr,项目名称:TestLink-API-Python-client,代码行数:46,代码来源:test.py


示例7: setUp

    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)
开发者ID:manojpkr,项目名称:TestLink-API-Python-client,代码行数:8,代码来源:test.py


示例8: run_report

def run_report():
    failed_list = []
    tls = TestLinkHelper().connect(TestlinkAPIClient)  # connect to Testlink
    testplan_id_result = tls.getTestPlanByName(test_project, test_plan)  # get test plan id
    testplan_id = testplan_id_result[0]['id']
    testcases = get_testcase()

    for i in testcases:
        test_result = i[0]
        test_notes = i[1]
        testcase_name = i[2]
        index = i[3]
        #
        # testcase_id_result = tls.getTestCaseIDByName(testcase_name)  # get test case id
        # testcase_id = testcase_id_result[0]['id']
        # tls.reportTCResult(testcase_id, testplan_id, test_build, test_result, test_notes)

        try:
            testcase_id_result = tls.getTestCaseIDByName(testcase_name)  # get test case id
            testcase_id = testcase_id_result[0]['id']
            tls.reportTCResult(testcase_id, testplan_id, test_build, test_result, test_notes)
        except TestLinkError:
            failed_list.append((index, testcase_name))

    if len(failed_list) > 0:
        log_name = 'logFile_%s.txt' % time.time()
        curr_dir = os.path.dirname(os.path.abspath(__file__))
        dest_dir = os.path.join(curr_dir, new_dir)
        try:
            os.makedirs(dest_dir)
        except OSError:
            pass
        log_file = os.path.join(dest_dir, log_name)
        with open(log_file, 'w') as f:
            for item in failed_list:
                f.write(','.join(str(i) for i in item) + '\n')
开发者ID:bingli88,项目名称:TestLink_API_Python,代码行数:36,代码来源:runTest.py


示例9: TestLinkAPIOnlineTestCase

class TestLinkAPIOnlineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - interacts with a TestLink Server.
    works with the example project NEW_PROJECT_API (see TestLinkExample.py)
    """

    def setUp(self):
        self.client = TestLinkHelper().connect(TestlinkAPIClient)


#    def tearDown(self):
#        pass


    def test_checkDevKey(self):
        response = self.client.checkDevKey()
        self.assertEqual(True, response)
        
    def test_about(self):
        response = self.client.about()
        self.assertIn('Testlink API', response)

    def test_ping(self):
        response = self.client.ping()
        self.assertEqual('Hello!', response)

    def test_echo(self):
        response = self.client.echo('Yellow Submarine')
        self.assertEqual('You said: Yellow Submarine', response)
        
    def test_doesUserExist_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '10000.*Big Bird'):
            self.client.doesUserExist('Big Bird')
        
    def test_getBuildsForTestPlan_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
            self.client.getBuildsForTestPlan(4711)
        
    def test_getFirstLevelTestSuitesForTestProject_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
            self.client.getFirstLevelTestSuitesForTestProject(4711)

    def test_getFullPath_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, 'getFullPath.*234'):
            self.client.getFullPath('4711')

    def test_getLastExecutionResult_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
            self.client.getLastExecutionResult(4711, 4712)
        
    def test_getLatestBuildForTestPlan_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
            self.client.getLatestBuildForTestPlan(4711)
        
    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_getProjectPlatforms_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
            self.client.getProjectPlatforms(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'):
#.........这里部分代码省略.........
开发者ID:Maberi,项目名称:TestLink-API-Python-client,代码行数:101,代码来源:testlinkapi_online_test.py


示例10: TestLinkHelper

# precondition a)
# SERVER_URL and KEY are defined in environment
# TESTLINK_API_PYTHON_SERVER_URL=http://YOURSERVER/testlink/lib/api/xmlrpc.php
# TESTLINK_API_PYTHON_DEVKEY=7ec252ab966ce88fd92c25d08635672b
# 
# alternative precondition b)
# SERVEUR_URL and KEY are defined as command line arguments
# python TestLinkExample.py --server_url http://YOURSERVER/testlink/lib/api/xmlrpc.php
#                           --devKey 7ec252ab966ce88fd92c25d08635672b
#
# ATTENTION: With TestLink 1.9.7, cause of the new REST API, the SERVER_URL 
#            has changed from 
#               (old) http://YOURSERVER/testlink/lib/api/xmlrpc.php
#            to
#               (new) http://YOURSERVER/testlink/lib/api/xmlrpc/v1/xmlrpc.php
tl_helper = TestLinkHelper()
tl_helper.setParamsFromArgs('''Shows how to use the TestLinkAPI for CustomFields.
=> requires an existing project NEW_PROJECT_API-*''')
myTestLink = tl_helper.connect(TestlinkAPIClient) 

#projNr=len(myTestLink.getProjects())+1
projNr=len(myTestLink.getProjects())

NEWPROJECT="NEW_PROJECT_API-%i" % projNr
NEWPREFIX="NPROAPI%i" % projNr
NEWTESTPLAN_A="TestPlan_API A"
# NEWTESTPLAN_B="TestPlan_API B"
# NEWPLATFORM_A='Big Bird %i' % projNr
NEWPLATFORM_B='Small Birds'
# NEWPLATFORM_C='Ugly Bird'
NEWTESTSUITE_A="A - First Level"
开发者ID:savagecm,项目名称:TestLink-API-Python-client,代码行数:31,代码来源:TestLinkExample_CF_KW.py


示例11: TestLinkAPIOnlineTestCase

class TestLinkAPIOnlineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - interacts with a TestLink Server.
    works with the example project NEW_PROJECT_API (see TestLinkExample.py)
    """

    def setUp(self):
        self.client = TestLinkHelper().connect(TestlinkAPIClient)


#    def tearDown(self):
#        pass


    def test_checkDevKey(self):
        response = self.client.checkDevKey()
        self.assertEqual(True, response)
        
    def test_about(self):
        response = self.client.about()
        self.assertIn('Testlink API', response)

    def test_ping(self):
        response = self.client.ping()
        self.assertEqual('Hello!', response)

    def test_echo(self):
        response = self.client.echo('Yellow Submarine')
        self.assertEqual('You said: Yellow Submarine', response)
        
    def test_doesUserExist_unknownID(self):
        response = self.client.doesUserExist('Big Bird')
        self.assertIn('Big Bird', response[0]['message'])
        self.assertEqual(10000, response[0]['code'])
        
    def test_getBuildsForTestPlan_unknownID(self):
        response = self.client.getBuildsForTestPlan(4711)
        self.assertIn('4711', response[0]['message'])
        self.assertEqual(3000, response[0]['code'])
        
    def test_getFirstLevelTestSuitesForTestProject_unknownID(self):
        response = self.client.getFirstLevelTestSuitesForTestProject(4711)
        self.assertIn('4711', response[0]['message'])
        self.assertEqual(7000, response[0]['code'])

    def test_getFullPath_unknownID(self):
        response = self.client.getFullPath(4711)
        self.assertIn('getFullPath', response[0]['message'])
        self.assertEqual(234, response[0]['code'])

    def test_getLastExecutionResult_unknownID(self):
        response = self.client.getLastExecutionResult(4711, 4712)
        self.assertIn('4711', response[0]['message'])
        self.assertEqual(3000, response[0]['code'])
        
    def test_getLatestBuildForTestPlan_unknownID(self):
        response = self.client.getLatestBuildForTestPlan(4711)
        self.assertIn('4711', response[0]['message'])
        self.assertEqual(3000, response[0]['code'])
        
    def test_getProjects(self):
        response = self.client.getProjects()
        self.assertIsNotNone(response)
        
    def test_getProjectTestPlans_unknownID(self):
        response = self.client.getProjectTestPlans(4711)
        self.assertIn('4711', response[0]['message'])
        self.assertEqual(7000, response[0]['code'])
        
    def test_getTestCase_unknownID(self):
        response = self.client.getTestCase(4711)
        # 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_getTestCaseAttachments_unknownID(self):
        response = self.client.getTestCaseAttachments(4711)
        # 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_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')
#.........这里部分代码省略.........
开发者ID:pade,项目名称:TestLink-API-Python-client,代码行数:101,代码来源:testlinkapi_online_test.py


示例12: TestLinkHelper

# precondition a)
# SERVER_URL and KEY are defined in environment
# TESTLINK_API_PYTHON_SERVER_URL=http://YOURSERVER/testlink/lib/api/xmlrpc.php
# TESTLINK_API_PYTHON_DEVKEY=7ec252ab966ce88fd92c25d08635672b
# 
# alternative precondition b)
# SERVEUR_URL and KEY are defined as command line arguments
# python TestLinkExample.py --server_url http://YOURSERVER/testlink/lib/api/xmlrpc.php
#                           --devKey 7ec252ab966ce88fd92c25d08635672b
#
# ATTENTION: With TestLink 1.9.7, cause of the new REST API, the SERVER_URL 
#            has changed from 
#               (old) http://YOURSERVER/testlink/lib/api/xmlrpc.php
#            to
#               (new) http://YOURSERVER/testlink/lib/api/xmlrpc/v1/xmlrpc.php
tl_helper = TestLinkHelper()
tl_helper.setParamsFromArgs('''Shows how to use the TestLinkAPI for CustomFields.
=> requires an existing project PROJECT_API_GENERIC-*''')
myTestLink = tl_helper.connect(TestlinkAPIGeneric) 

myPyVersion = python_version()
myPyVersionShort = myPyVersion.replace('.', '')[:2]

NEWTESTPLAN_A="TestPlan_API_GENERIC A"
# NEWTESTPLAN_B="TestPlan_API_GENERIC B"
# NEWTESTPLAN_C="TestPlan_API_GENERIC C - DeleteTest"
# NEWPLATFORM_A='Big Bird %s' % myPyVersionShort
NEWPLATFORM_B='Small Bird'
# NEWPLATFORM_C='Ugly Bird'
NEWTESTSUITE_A="A - First Level"
NEWTESTSUITE_B="B - First Level"
开发者ID:lczub,项目名称:TestLink-API-Python-client,代码行数:31,代码来源:TestLinkExampleGenericApi_Req.py


示例13: test_callServer_withArgs

 def test_callServer_withArgs(self):
     """ test _callServer() - calling method with args """
     
     client = TestLinkHelper().connect(TestlinkAPIClient)
     response = client._callServer('repeat', {'str' : 'some arg'})
     self.assertEqual('You said: some arg', response)
开发者ID:MarynaQA,项目名称:TestLink-API-Python-client,代码行数:6,代码来源:testlinkapicallservertest.py


示例14: test_callServer_noArgs

 def test_callServer_noArgs(self):
     """ test _callServer() - calling method with no args """
     
     client = TestLinkHelper().connect(TestlinkAPIClient)
     response = client._callServer('sayHello')
     self.assertEqual('Hello!', response)
开发者ID:MarynaQA,项目名称:TestLink-API-Python-client,代码行数:6,代码来源:testlinkapicallservertest.py


示例15: TestLinkAPIOfflineTestCase

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)
#.........这里部分代码省略.........
开发者ID:Maberi,项目名称:TestLink-API-Python-client,代码行数:101,代码来源:testlinkapi_offline_test.py


示例16: TestLinkAPIOfflineTestCase

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'])
        
#.........这里部分代码省略.........
开发者ID:citizen-stig,项目名称:TestLink-API-Python-client,代码行数:101,代码来源:testlinkapi_offline_test.py


示例17: TestClass

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')
开发者ID:pade,项目名称:TestLink-API-Python-client,代码行数:87,代码来源:test.py


示例18: setUp

 def setUp(self):
     self.api = TestLinkHelper().connect(DummyAPIClient)
开发者ID:MarynaQA,项目名称:TestLink-API-Python-client,代码行数:2,代码来源:testlinkapi_offline_test.py


示例19: TestLinkAPIOnlineTestCase

class TestLinkAPIOnlineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - interacts with a TestLink Server.
    works with the example project NEW_PROJECT_API (see TestLinkExample.py)
    """

    def setUp(self):
        self.client = TestLinkHelper().connect(TestlinkAPIGeneric)

#    def tearDown(self):
#        pass

    def test_checkDevKey(self):
        response = self.client.checkDevKey()
        self.assertEqual(True, response)
        
    def test_checkDevKey_unknownKey(self):
        with self.assertRaisesRegexp(TLResponseError, '2000.*invalid'):
            self.client.checkDevKey(devKey='unknownKey')
        
    def test_sayHello(self):
        response = self.client.sayHello()
        self.assertEqual('Hello!', response)

    def test_repeat(self):
        response = self.client.repeat('Yellow Submarine')
        self.assertEqual('You said: Yellow Submarine', response)
        
    def test_about(self):
        response = self.client.about()
        self.assertIn('Testlink API', response)

    def test_doesUserExist_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '10000.*Big Bird'):
            self.client.doesUserExist('Big Bird')
        
    def test_createTestProject_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '7001.*Empty name'):
            self.client.createTestProject(testprojectname='', 
                                                 testcaseprefix='P4711')
 
    def test_getProjects(self):
        response = self.client.getProjects()
        self.assertIsNotNone(response)
         
    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):
        tc_steps = []
        with self.assertRaisesRegexp(TLResponseError, '7000.*4713'):
            self.client.createTestCase('case 4711', 4712, 4713, 
                                        'Big Bird', 'summary 4714', tc_steps)
 
    def test_getBuildsForTestPlan_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
            self.client.getBuildsForTestPlan(4711)
         
    def test_getFirstLevelTestSuitesForTestProject_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
            self.client.getFirstLevelTestSuitesForTestProject(4711)
 
    def test_getFullPath_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, 'getFullPath.*234'):
            self.client.getFullPath('4711')
 
    def test_getLastExecutionResult_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
            self.client.getLastExecutionResult(4711, testcaseid=4712)
         
    def test_getLatestBuildForTestPlan_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
            self.client.getLatestBuildForTestPlan(4711)
         
    def test_getProjectTestPlans_unknownID(self):
        with self.assertRaisesRegexp(TLResponseError, '7000.*4711'):
            self.client.getProjectTestPlans(4711)
         
    def test_getTestCase_unknownID(self):
        with self.assertRaisesRegexp(TLResponseErr 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python unit.patch函数代码示例发布时间:2022-05-27
下一篇:
Python testutil.datafile函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap