Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1100 by [email protected]: --loglevel TRACE option crashed test case
http://code.google.com/p/robotframework/issues/detail?id=1100

I did implemented webservices library using following code

from suds.client import Client
from suds.sax.enc import Encoder
from suds.sax.text import Raw
from robot.api import logger

class SoapWebService(object):

    def __init__(self):
        self._client = None
        self._response = None

def call_soap_webservice(self, url="http://10.10.9.153:18080/ocs1/ws/CCGateway?wsdl";):
        try:
            self._client = Client(url)
        except:
            raise Exception("Can't call web-service by WSDL %s" % url)

    def invoke_method(self, name, *parameters):
        parameters = [self._decode_text(i)
                      if self._check_if_need_to_encode(i) else i
                      for i in parameters]
        try:
exec "self._response = self._client.service.%s(*parameters)" % name
        except:
raise Exception("Can't invoke method %s with parameters %s" % (name, parameters)) logger.debug("Get response as result of invoking method \n%s" % self._response)
        self.load_data_for_assertion(str(self._response))
        return str(self._response)


    def _check_if_need_to_encode(self, text):
        return Encoder().needsEncoding(text)

    def _decode_text(self, text):
        return Raw(text)


Test Case is following:


*** Settings ***
Resource          ../global_settings.txt

*** Test Cases ***
ws1
call soap webservice http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
    ${response}=    invoke method    ConversionRate    UAH    USD


- When I run test case like this:
pybot -P libs -t ws1 .
everything is fine for each test run, tried 10 times.

- but when I run it like this
pybot -P libs -t ws1 --loglevel TRACE .
got issue AttributeError: 'NoneType' object has no attribute 'str'

All files I've attached to the issue.

My configuration:
- python 2.7 win 32
- Win 7 RU
- RF 2.7

Attachments:
        WebServicesLibrary.rar  77.8 KB

Reply via email to