Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid URI error during web test run

I have create a very simple webtest that had just one request to one simple URL that is like that: https://www.domain.com/.

When I run the test though I get Failed and this message:

Request failed: Invalid URI: The format of the URI could not be determined.

But the Response tab has the proper response HTTP/1.1 200 OK with lots of HTML. Is this a bug in Visual Studio or something and is there a way to ensure that it does not treat proper requests as failed?

P.S. I have also noticed that request takes like 10 - 15 seconds, even though the RequestTime (that the visual studio shows) is really less than 1.

like image 414
Ilya Chernomordik Avatar asked May 27 '16 11:05

Ilya Chernomordik


2 Answers

The HTML of most web pages requires a collection of other files to be downloaded, such as images, JSON, CSS, JavaScript, etc. These are the dependant requests. Visual Studio examines the HTML to find the set of dependant requests. They should all be valid URLs. The Visual Studio code that extracts these dependant requests is less forgiving than many browsers. Visual Studio requires them to be valid URLs. Many real browsers work hard to cope with bad HTML so that something sensible can be shown.

The reason for the exception is probably badly formatted HTML in the response. Some browsers have developer facilities that will describe errors found in the downloaded html. Check what these developer facilities say about errors on the page; it may be worth trying several browsers to get different assessments of the page.

One example: a malformed base tag can lead to the exception you report.


When looking at the web test execution log for a successful request you will see the dependant requests listed. It appears that Visual Studio "trusts" that these requests form valid URLs, ie they are properly formatted. Your test has a badly formatted URL. If you had given a properly formatted URL but there was no resource then you would have seen the dependant request and seen it get 404 error. This is an edge case and you might argue that Visual Studio should report it differently.

By "web test execution log" I refers to the way the results of a web test are shown. That is the tabular form with the column titles: Request + Status + Total time + Request time + Request bytes + Response bytes. Below that there are tabs showing details of the selected item, the tabs are labelled Web browser + Request + Response + Context + Details. If you click the little triangles at the left-hand side of the "Request" column you will see the redirections and the dependant requests. (Note that logs for web tests run within a load test omit dependant request details.)

like image 121
AdrianHHH Avatar answered Nov 17 '22 15:11

AdrianHHH


Setting "Parse Dependent Requests" to False for that specific call helps.

like image 20
Selvan Dhurai Avatar answered Nov 17 '22 13:11

Selvan Dhurai