| || |
Running web test is very slow
I realize there were some different posts on this, but they're all a bit dated, so I'm reposting.
We're trying to do a smoke test of several of our web pages. One page opens and there are several links to pdf files. All I want to do is click each link, and close the new browser window that opens. Go down to the next link, and repeat the process.
It's super slow when I try to run this script, and I understand there are some different methods to tweak our scripts.
What would be the best way for us to write/run these simple link clicking tests?
We're using VBScript and we're running version 6.40.
Thank you in advance,
Re: Running web test is very slow
I'd recommend not testing the browser (we can let Microsoft do that). Instead just do a bunch of direct connections to the URLs contained on the page.
<font class="small">Code:</font><hr /><pre>
set page = (you web Page object)
'//Find all hyperlink tag obects under your page.
propArry = Array("tagname")
valueArry = Array("A")
resultSet = page.FindAll(propArry, valueArry, 10)
for each linkObj in resultSet
'//open an http connection to the URL contained in the link.
url = linkObj.href
set http = CreateObject("MSXML2.ServerXMLHTTP")
http.setOption 2, SSH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
http.Open "GET", strLinkURL, false
'check http.status for 400 range errors.
if http.status >= 400 and http.status < 500 then
Log.Error "Broken link, URL:" & strLinkURL
Note this is a bit simplified. You'll need to add more code to suit your needs. Things like relative URL needs some translating to make them into full URLs.. and stuff like that.
There might be some easier way (probably there is) using some of the load testing methods. I'm not really familiar with those, but essentially load testing is sort of doing the same thing, opening a ton of different pages.