lczub / TestLink-API-Python-client

A Python client to use the TestLink API
105 stars 63 forks source link

countProjects() raise 'Empty Response!' error, when no project exist #55

Closed lczub closed 9 years ago

lczub commented 9 years ago

with v0.6.1, countProjects() does not handle the special case "no project exist" . Expectation is, that countProjects() returns 0 in this case.

Traceback (most recent call last):
  File "D:\Projekte\git\TestLink-API-Python-client\example\TestLinkExample.py", line 147, in <module>
    print("Number of Projects in TestLink: %s " % (myTestLink.countProjects()))
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkapi.py", line 377, in countProjects
    projects=self.getProjects()
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 105, in wrapperAddDevKey
    return methodAPI(self, *argsPositional, **argsOptional)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 93, in wrapperWithArgs
    *argsPositional, **argsOptional)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1299, in callServerWithPosArgs
    self._checkResponse(response, methodNameAPI, argsOptional) 
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1527, in _checkResponse
    'Empty Response! ')
testlink.testlinkerrors.TLResponseError: Empty Response! 
getProjects({'devKey': '94cc922ff3a62291a7cb9c4adbb60501'})
lczub commented 9 years ago

Travis reports a broken build.

Seams that the online tests must be updated, too.

lczub commented 9 years ago

failures reported by travis on a linux build environment running against the TL demo server 1.9.13 (dev 20141226) are not reproducible on a win8.1 environment, running the tox test against a TL 1.9.14 (dev) application

============================= test session starts ==============================

platform linux2 -- Python 2.6.9 -- py-1.4.26 -- pytest-2.6.4
collected 145 items 

test/utest-online/testlinkapi_callserver_test.py .....
test/utest-online/testlinkapi_generic_online_test.py ..x...............x..........F.........xx.x................x...............
test/utest-online/testlinkapi_online_test.py .x..............x........F...F.....xx.x.............x............

=================================== FAILURES ===================================
__________________ TestLinkAPIOnlineTestCase.test_getProjects __________________

self = <testlinkapi_generic_online_test.TestLinkAPIOnlineTestCase testMethod=test_getProjects>

    def test_getProjects(self):
>       response = self.client.getProjects()

test/utest-online/testlinkapi_generic_online_test.py:98: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

../../../virtualenv/python2.6.9/lib/python2.6/site-packages/testlink/testlinkdecorators.py:133: in wrapperReplaceTLResponseError
    response = methodAPI(self, *argsPositional, **argsOptional)
../../../virtualenv/python2.6.9/lib/python2.6/site-packages/testlink/testlinkdecorators.py:105: in wrapperAddDevKey
    return methodAPI(self, *argsPositional, **argsOptional)
../../../virtualenv/python2.6.9/lib/python2.6/site-packages/testlink/testlinkdecorators.py:93: in wrapperWithArgs
    *argsPositional, **argsOptional)
../../../virtualenv/python2.6.9/lib/python2.6/site-packages/testlink/testlinkapigeneric.py:1300: in callServerWithPosArgs
    response = self._callServer(methodNameAPI, argsOptional)
../../../virtualenv/python2.6.9/lib/python2.6/site-packages/testlink/testlinkapigeneric.py:1408: in _callServer
    response = getattr(self.server.tl, methodNameAPI)(argsAPI)
/opt/python/2.6.9/lib/python2.6/xmlrpclib.py:1199: in __call__
    return self.__send(self.__name, args)
/opt/python/2.6.9/lib/python2.6/xmlrpclib.py:1489: in __request
    verbose=self.__verbose
/opt/python/2.6.9/lib/python2.6/xmlrpclib.py:1253: in request
    return self._parse_response(h.getfile(), sock)
/opt/python/2.6.9/lib/python2.6/xmlrpclib.py:1387: in _parse_response
    p.feed(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xmlrpclib.ExpatParser instance at 0x233c7e8>

data = '\r\n\t- Comprehend Requirements and Test Management in a&lt;br /&gt;\r\n\tsmall scale project&lt;/p&gt;\r\n&lt;p&gt;\...e></member>\n  <member><name>option_priority</name><value><string>0</string></value></member>\n  <member><name>option_'

    def feed(self, data):
>       self._parser.Parse(data, 0)
E       ExpatError: not well-formed (invalid token): line 9874, column 58

/opt/python/2.6.9/lib/python2.6/xmlrpclib.py:601: ExpatError
lczub commented 9 years ago

failures reported by travis is reproducible on a win8.1 environment, when these tox test also runs against the TL demo server 1.9.13 (dev 20141226) .

======================================================================
ERROR: test_getProjects (utest-online.testlinkapi_generic_online_test.TestLinkAPIOnlineTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Projekte\git\TestLink-API-Python-client\test\utest-online\testlinkapi_generic_online_test.py", line 98, in test_getProjects
    response = self.client.getProjects()
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 133, in wrapperReplaceTLResponseError
    response = methodAPI(self, *argsPositional, **argsOptional)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 105, in wrapperAddDevKey
    return methodAPI(self, *argsPositional, **argsOptional)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 93, in wrapperWithArgs
    *argsPositional, **argsOptional)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1300, in callServerWithPosArgs
    response = self._callServer(methodNameAPI, argsOptional)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1408, in _callServer
    response = getattr(self.server.tl, methodNameAPI)(argsAPI)
  File "D:\Programme\Python34\lib\xmlrpc\client.py", line 1089, in __call__
    return self.__send(self.__name, args)
  File "D:\Programme\Python34\lib\xmlrpc\client.py", line 1419, in __request
    verbose=self.__verbose
  File "D:\Programme\Python34\lib\xmlrpc\client.py", line 1131, in request
    return self.single_request(host, handler, request_body, verbose)
  File "D:\Programme\Python34\lib\xmlrpc\client.py", line 1147, in single_request
    return self.parse_response(resp)
  File "D:\Programme\Python34\lib\xmlrpc\client.py", line 1312, in parse_response
    p.feed(data)
  File "D:\Programme\Python34\lib\xmlrpc\client.py", line 445, in feed
    self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 9968, column 58

----------------------------------------------------------------------
Ran 75 tests in 24.422s

FAILED (errors=1, expected failures=6)
lczub commented 9 years ago

failures are also not reproducibly running the tox tests against a final TL 1.9.13 server. So problem seams to be related by the TL DEMO 1.9.13 (dev) server.

lczub commented 9 years ago

Commit 5c659c6 marks the getProjects() related online test as may fail. Travis build passed for them

lczub commented 9 years ago

problematic test project inside TL demo was EA975 - Lab. 6 (ID 131604)

The description includes '\x1c' control chars, which produces the parser error . After replacing them with '?', the parser error does not occur any more. So the "may fail" marker can be removed again.

<p>
    1. Create a Project and Test Plan.<br />
    2. Create a set of Requirements to verify / validate all elds from the Lab 04 user form: http://goo.gl/forms/SDwswUVyx6<br />
    3. Create a Test Plan, dening at least one Test Case per Requirement (Note that the Requirement of validating a single eld may require multiple test cases to cover multiple wrong inputs)<br />
    4. Connect Requirements to Test Cases<br />
    5. Connect Test Cases to the Test Plan<br />
    6. Print a PDF le listing the Requirements and the Test Plan</p>