taurus icon indicating copy to clipboard operation
taurus copied to clipboard

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

Open piratheeshrabendran-GC opened this issue 2 years ago • 1 comments

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 avatar May 05 '23 09:05 piratheeshrabendran-GC

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

piratheeshrabendran-GC avatar Nov 21 '23 17:11 piratheeshrabendran-GC