Skip to content

How to use Python TestLink Runner

parthibann edited this page Jan 11, 2014 · 8 revisions

Pre-requesties : https://github.com/parthibann/Python-TestLink-Runner/wiki/Enabling-Test-Automation-in-Testlink

Step 1: Login into testlink and create some test suites and test cases in the api enabled project.

Step 2: After creating the test case manually right click on it will display the testcase API ID testcaseid

Step 3: Create a testplan and assign the testcases to the test plan.

Step 4: Create a build for the above testplan.

Step 5: checkout TestLinkRunner.py file or clone "https://github.com/parthibann/Python-TestLink-Runner.git" repository.

Step 6: Use the above runner in your automation test case, Example given below.

import unittest
from TestlinkRunner import TestLinkRunner
class demonstratingTLRunner(unittest.TestCase):
    def test_20_TestPass(self):
        pass
    
    def test_23_TestFailure(self):
        self.fail("test fail")

testlinkURL = "http://servername/testlink/lib/api/xmlrpc/v1/xmlrpc.php"
userKey = "857f401ec22e47ee5bf6dadd1f839a20"
suite = unittest.TestLoader().loadTestsFromTestCase(demonstratingTLRunner)
runner = TestLinkRunner(testlinkURL,userKey,_testPlanId=1,_buildName="testbuild1")
runner.run(suite)

Step 7: Make sure all your testcases contain the api id within the second (_) underscore character in the test name and no other numeric value other than the api id should be present there.

Clone this wiki locally