コード例 #1
0
ファイル: tltrack.py プロジェクト: Ilyiad/PATI
    def tl_verify_build(self, uri="", key="", project="", testplan="", build=""):

        tl_helper = TestLinkHelper()
        tls = tl_helper.connect(TestlinkAPIClient)
        tpid = tls.getTestPlanByName(project, testplan)
        tl_testplanid = tpid[0]['id']

        testit = tls.getLatestBuildForTestPlan(tl_testplanid)
        log("BUILD " +str(testit['name']))

        if build != "":
            if build not in str(testit['name']):
                log("CREATING TESTLINK BUILD")

        return str(testit['name'])
コード例 #2
0
ファイル: tltrack.py プロジェクト: Ilyiad/PATI
    def tl_teststatus_update(self, teststatus):

        status = 1

        if self.tl_track:
            log("TESTLINK: Tracking Test Metrics - test = " +teststatus)
            tl_helper = TestLinkHelper()
            tls = tl_helper.connect(TestlinkAPIClient)
            tpid = tls.getTestPlanByName(self.tl_project, self.tl_testplan)
            tl_testplanid = tpid[0]['id']
                                                
            # Check is test plan is open and active
            if tpid[0]['is_open'] != '1' or tpid[0]['active'] != '1':
                status = 0
                log("ERROR : Testlink Result Report TestPlan \"" +TL_TEST_PLAN+ "\" is not open or active")
                
            temp = tls.reportTCResult(self.tl_testid, tl_testplanid, self.tl_build, teststatus, "", platformname=self.tl_platform)
            log("TESTLINK: " +str(temp))
        else:
            if getOpt('JENKINS_TRACK'):
                log("JENKINS: Tracking Test Metrics - test = " +teststatus)
                local_shell = shell("local")
                datetime = local_shell.run("date +\"%m-%d-%Y-%T\"", 0)
                temp = local_shell.run("ls -ls ~/runfiles")
                #log("DIR : " +temp)
                log("Tracking Test Metrics To: ~/runfiles/" + str(self.tl_build) + "_test_results.csv")
                resfile = os.path.expanduser("~/runfiles/") + self.tl_build + "_test_results.csv"
                try:
                    file = open(resfile, 'a+')
                except IOError:
                    file = open(resfile, 'w+')

                if teststatus == "p": 
                    file.write("PASS, " +datetime+ ", " +self.tl_build+ ", " +self.testcase_name+ "\n")
                else:
                    file.write("FAIL, " +datetime+ ", " +self.tl_build+ ", " +self.testcase_name+ "\n")
                
                file.close()

        return status
コード例 #3
0
# 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(server_url="http://192.168.1.67/testlink/lib/api/xmlrpc/v1/xmlrpc.php", devkey="9fcab75a07b343c40fbe91c98a1bb326")
tl_helper.setParamsFromArgs('''Shows how to use the TestLinkAPI.
=> Counts and lists the Projects 
=> Create a new Project with the following structure:''')
myTestLink = tl_helper.connect(TestlinkAPIClient)

myPyVersion = python_version()   # 本地python版本
myPyVersionShort = myPyVersion.replace('.', '')[:2]

NEWTESTPLAN_A = "TestPlan_API A"
NEWTESTPLAN_B = "TestPlan_API B"
NEWTESTPLAN_C = "TestPlan_API C - DeleteTest"
NEWPLATFORM_A = 'Big Birds %s' % myPyVersionShort
NEWPLATFORM_B = 'Small Birds'
NEWPLATFORM_C = 'Ugly Birds'
NEWTESTSUITE_A = "A - First Level"