Esempio n. 1
0
def main(*argv):
    if (argv):
        client = TestlinkAPIClient()
        projects = client.getProjects()
        opts, args = getopt.getopt(argv, None, ["project"])
        p = [x for x in projects if x['name'].lower() == args[0].lower()]
        print dir(p)
        pass
Esempio n. 2
0
 def __init__(self,test_project,test_plan,build_name,url = 'http://10.99.101.4/testlink/lib/api/xmlrpc/v1/xmlrpc.php',key = '4eb2733b98b4697bfd69d46cd8090c8c'):
     self._url = url
     self._key = key
     self.t = TestlinkAPIClient(url,key)
     self.test_project = test_project
     self.test_plan = test_plan
     self.build_name = build_name
     self.get_info()
Esempio n. 3
0
 def __init__(self,
              enable=is_test,
              test_project=test_porject,
              test_plan=test_plan,
              build_name=build_name,
              url=url,
              key=key):
     self._url = url
     self._key = key
     self.t = TestlinkAPIClient(url, key)
     self.test_project = test_project
     self.test_plan = test_plan
     self.build_name = build_name
     self.enable = enable
     self.get_info()
    def __init__(self,
                 xml=None,
                 testlinkUpdate=False,
                 autoGenerate=False,
                 skipMissing=False,
                 stream=None,
                 testResultClass=TestLinkTestResult,
                 testsdir=None,
                 browser=None):
        print 'Setting up the environment'
        #LOAD THE TESTS from the Directory
        self.testsdir = testsdir or runner_config.TESTS_DIRECTORY
        sys.path.append(self.testsdir)
        from selenium import SeleniumTestCase
        #Setup the browser
        self.browser = browser or selenium_config.browser
        SeleniumTestCase.browser = self.browser
        #End Setup the browser

        #Setup the plan
        self.testcases = []
        if not xml:
            self.xml = open(runner_config.DEFAULT_PLAN, 'r').read()
        else:
            self.xml = open(xml, 'r').read()
        #End Setup the plan

        self.tlupdate = testlinkUpdate
        self.stream = stream
        if not os.path.exists(self.testsdir):
            if self.stream:
                self.stream.write('Tests directory ' + self.testsdir +
                                  ' does not exists, Creating it now...')
            os.makedirs(self.testsdir)
            if self.stream:
                self.stream.write('Tests directory created.')
        self.dom = md.parseString(self.xml)
        self.autoGen = autoGenerate
        self.client = TestlinkAPIClient()
        self.loadTestParams()
        self.loadTCs()
        if self.autoGen: self.createTCs()
        if skipMissing: self.removeMissingTCs()
        self.suite = unittest.TestLoader().loadTestsFromNames(
            [x['fullname'] for x in self.testcases])
        self.tcdict = dict([(x['fullname'], x) for x in self.testcases])
        self.testresult = testResultClass(self)
Esempio n. 5
0
        }
        try:
            if tc_full_id and (self.enable == True or self.enable == 'True'):
                if isinstance(tc_full_id, list):
                    for case in tc_full_id:
                        case_id = self.get_case_id(case)
                        self.t.reportTCResult(testcaseid=case_id,
                                              testplanid=self.plan_id,
                                              status=status_dict.get(status),
                                              buildname=self.build_name,
                                              notes=notes)
                    return True
                case_id = self.get_case_id(tc_full_id)
                self.t.reportTCResult(testcaseid=case_id,
                                      testplanid=self.plan_id,
                                      status=status_dict.get(status),
                                      buildname=self.build_name,
                                      notes=notes)
                return True
        except Exception, e:
            print e.__repr__()
            return False


if __name__ == '__main__':
    projects = u'湖北日报'
    plan = u'湖北日报3.2.3发布性测试'
    b = u'Android湖北日报3.2.3发布性测试'
    tkh = TestlinkHandler()
    t = TestlinkAPIClient(url, key)
Esempio n. 6
0
# @{
##
import sys
import time
import pymysql
from testlink import TestlinkAPIClient
from config import getconfig
reload(sys)
sys.setdefaultencoding('utf-8')

testlink_url = getconfig("testlink", "testlink_url")
ip = testlink_url.split("/")[2]
TLURL = testlink_url + "/lib/api/xmlrpc/v1/xmlrpc.php"
DEVKey = getconfig("testlink", "DEVKey")
test_user_name = getconfig("testlink", "test_user_name")
tls = TestlinkAPIClient(TLURL, DEVKey)
nowtime = time.strftime("%Y-%m-%d")


def getsql(sql):
    """
    根据项目名称和文件夹名称查找文件夹对应的
    此方法只能查找到根目录下的文件夹的id,多级目录无法查找
    :param sql: sql语句
    :return:查询结果
    """
    db = pymysql.connect(ip, "testlink", "testlink", "testlink", use_unicode=True, charset="utf8")
    cursor = db.cursor()
    cursor.execute(sql)
    results = cursor.fetchall()
    if len(results) == 0:
Esempio n. 7
0
        self.createFieldsAndBuildMaps(testlinkprojectid, qtestprojectid,
                                      userlist, usermap, project_manager)
        top_module = self.qclient.createModule(qtestprojectid, testprojectname)
        modules = self.tclient.getFirstLevelTestSuitesForTestProject(
            testprojectid=testlinkprojectid)
        for suite in modules:
            self.buildSuite(testlinkprojectid,
                            suite['id'],
                            qtestprojectid,
                            qtestparentid=top_module)


if __name__ == '__main__':
    with open("config.json") as f:
        c = f.read()
    config = json.loads(c)
    qclient = QtestClient(config["qtest_server_url"], config["qtesttoken"])
    tclient = TestlinkAPIClient(config["testlink_server_url"],
                                config["testlink_devkey"])
    t2q = Testlink2qTest(tclient, qclient)
    qtestproject_list = config["qtestproject_list"]
    testlink_project_list = config["testlink_project_list"]
    userlist = config["project_members"]
    usermap = config["user_map"]
    project_manager = config["project_owner"]
    for testprojectname, qtestprojectname in zip(testlink_project_list,
                                                 qtestproject_list):
        print("Migrating Project " + testprojectname + " ...")
        t2q.move_recursively(testprojectname, qtestprojectname, userlist,
                             usermap, project_manager)