Page 1 of 1

Integrating Python Webdriver with jenkins and testlink

PostPosted: Mon Sep 09, 2013 7:28 am
by vbsorin
Hello guys I have some problems using the TestLink plugin for Jenkins. It seems that the execution status is not changing when I trigger the job from Jenkins. I'm using https://github.com/orenault/TestLink-API-Python-client to connect to TestLink API. The results of tests are updated in TestLink using the python client but in jenkins for each build the execution status remains "Not Run". I'm using https://github.com/danielfm/unittest-xml-reporting to generate the xml files. Here is a sample test:

Code: Select all
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time, re
import xmlrunner

class Sample(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "https://www.google.com/"
        self.verificationErrors = []
        self.accept_next_alert = True

    def test_sample(self):
        driver = self.driver
        driver.find_element_by_id("gbqfq").send_keys("test")
        driver.find_element_by_id("gbqfb").click()

    def tearDown(self):
        self.driver.quit()
        self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))


Here is a screenshot from Jenkins:

Image

Do I miss something? Tests are started from Jenkins using a batch file:

Code: Select all
call "C:\VirtualEnv\Scripts\activate.bat"
python "C:\Jenkins\workspace\Web_Auto\test_name.py"
call "C:\VirtualEnv\Scripts\deactivate.bat"


Test result seeking strategy is jUnit class name. Here is a sample of the xml results file:

Code: Select all
<?xml version="1.0" ?>
<testsuite errors="0" failures="0" name="aaa-20130903091534" tests="1" time="21.453">
   <testcase classname="ClassName" name="testClassName" time="21.453"/>
   <system-out>
<![CDATA[
]]>   </system-out>
   <system-err>
<![CDATA[]]>   </system-err>
</testsuite>


I'm struggling with this issue for two weeks, does anyone have a solution? Thank you!

Re: Integrating Python Webdriver with jenkins and testlink

PostPosted: Mon Sep 09, 2013 8:52 am
by fman
TestLink dev team has no knowledge regarding TestLink Jenkis plugin. You have to post on their site / issue tracker.