Blazemeter / taurus

Automation-friendly framework for Continuous Testing by
http://gettaurus.org
Apache License 2.0
1.97k stars 461 forks source link

locustio-taurus-wrapper.py csv writer can't handle error messages which have comments in them #1720

Open piratheeshrabendran-GC opened 1 year ago

piratheeshrabendran-GC commented 1 year ago

Hello,

I've discovered an issue with the locustio-taurus-wrapper.py in Taurus, when handling failed requests. It doesn't seem to account for error messages which might contain commas or serialized json data. Please see below is an extract from the locust.log for the error message I've seen:

[2023-05-03 16:40:17,446] COMP/ERROR/root: Uncaught exception in event handler: 
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\site-packages\locust\event.py", line 40, in fire
    handler(**kwargs)
  File "C:\Program Files\Python311\Lib\site-packages\bzt\resources\locustio-taurus-wrapper.py", line 75, in __on_request_write
    self.writer.writerow(self.__getrec(request_type, name, response_time, response_length, exception))
  File "C:\Program Files\Python311\Lib\csv.py", line 154, in writerow
    return self.writer.writerow(self._dict_to_list(rowdict))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_csv.Error: need to escape, but no escapechar set

Here is the error message that is being returned from locust.io :

Error report
# occurrences Error
------------------|---------------------------------------------------------------------------------------------------------------------------------------------
117 POST LogoutApi: CatchResponseError('Failed to Logout, Status: 429, error: {"HttpStatus":429,"ErrorMessage":"Request throttled","ErrorCode":5002}')
------------------|---------------------------------------------------------------------------------------------------------------------------------------------

I pinpointed it is relating to line 106 where the dialog is being set. I fixed this locally by setting the dialog to csv.QUOTE_NONNUMERIC but this needs to be change for it to work on blazemeter too

piratheeshrabendran-GC commented 7 months ago

Hi I was wondering if there has been any update on this? this is still a blocker