TestLink-API-Python-client icon indicating copy to clipboard operation
TestLink-API-Python-client copied to clipboard

Testlink API with Sikuli- Not working

Open aady6497 opened this issue 9 years ago • 4 comments

Hi all, I am trying to integrate sikuli python scripts with testlink API. I am able to import the required testlink module into sikuli-IDE but, unable to connect & perform any actions. The same steps are working fine with python standalone.

Could anyone suggest me, what I am doing wrong.

aady6497 avatar Feb 11 '16 07:02 aady6497

I have a small experience in such thing but I never tried what you're trying to do. I suggest you try to do the following :

  • Execute the steps with python standalone
  • call sikuli script with subproces. Example :

sikuli = Popen(["C:\SikuliX\runIDE.cmd", "-r", "installIC.sikuli"], shell=True, stdout=PIPE) sikuli.wait()' errorfound = False' for msg in sikuli.stdout.readlines():' print msg' if "[error]" in msg: errorfound = True`

This is the method I use to perform 'nosetest' format. I Use this format to be able to export in Junit XML. Because I know sikuli doesnt support nosetest for now.

samsalas avatar Feb 11 '16 08:02 samsalas

Thanks Sam, for the quick response. I will check this approach :)

aady6497 avatar Feb 11 '16 09:02 aady6497

I am trying to install latest testlink on ubunto16 hosted on vm, then try to run python scripts to update test results in test link , also try to invoke test run in testlink. the key strategy I am going to use is to call the test method in testlink APIs via xmlrpc. not sure this is possible. any suggestions warnings here, it it is possible what is the version of testlink, xmlrpc, or even python testlink driver? thanks

lilinyueyue avatar Mar 01 '18 16:03 lilinyueyue

Hi,

This is my way to access the Testlink API with a Python class (Python 2.7)

import xmlrpclib

class TestlinkAPIClient:        
    # substitute your server URL Here
    SERVER_URL = "http://testlinkserver/lib/api/xmlrpc/v1/xmlrpc.php"
    DEVKEY = "jbeijbeidnboiuenfoiunoufn"

    def __init__(self, devKey):
        self.server = xmlrpclib.ServerProxy(self.SERVER_URL)

    def getInfo(self):
        return self.server.tl.about()

    def getProjects(self):
        data = {}
        data["devKey"] = self.DEVKEY
        return self.server.tl.getProjects(data)

    def getTestPlans(self, projectid):
        data = {}
        data["devKey"] = self.DEVKEY
        data["testprojectid"] = int(projectid)
        return self.server.tl.getProjectTestPlans(data)

    def getBuildsForTestPlan(self, testplanid):
        data = {}
        data["devKey"] = self.DEVKEY
        data["testplanid"] = int(testplanid)
        return self.server.tl.getBuildsForTestPlan(data)

client = TestlinkAPIClient("45e0f3340075d1e6f826aa42a0daa514")
print client.getInfo()
projects = client.getProjects()
print "Projects in Testlink: %d" % len(projects)

I suggest you read the testlink api code. You have the list of functions in the last lines in the file "TestlinkSources\lib\api\xmlrpc\v1\xmlrpc.class.php"

samsalas avatar Mar 02 '18 08:03 samsalas