Test failing on Jenkins run - %20 stripped from encoded url

396 Views Asked by At

I have a set of API tests which are failing on a Jenkins run via the MSTest runner plugin. On investigation, the exception message returned is the following

Status: BadRequest. Reason: {"Message":"The request is invalid."}

The encoded url is getting the %20 stripped from DateTime type'd parameters and the request url at this point now is attempting to post with spaces.

Example of query string /GenerateReport?startDate=09/05/2017 09:58:45&endDate=14/05/2017 09:58:45

If I run these tests directly from Visual Studio they pass and on capturing the post request, it is passed encoded as expected.

Anyone able to explain why this would be happening when executing these tests only via Jenkins/MSTest plugin? And if so, do you have a work around/config change available?

1

There are 1 best solutions below

0
jwelsh On

@Kobi - you were correct, sorry I haven't replied earlier.

  1. Is it possible your machine and the server are using different locale (CultureInfo.CurrentCulture / Region and Language, date format)?

I'm now parsing the DateTime param with the culture specific format (CultureInfo.CurrentCulture). I hadn't also hadn't read your response properly, our development environment is on a US server and I'm UK based so that would be expected.

Thank you.