Please visit the following link:
http://msdn.microsoft.com/en-us/library/aa730850(vs.80).aspx
The contents of this blog were gathered from the blogger real life experiences and from the different forums related to automated test.
Monday, March 30, 2009
Web and Load Test FAQs
Please visit the following link:
http://social.msdn.microsoft.com/Forums/en-US/vstswebtest/thread/bd3b1caf-ca7b-408e-b415-3b8e3465bb03
http://social.msdn.microsoft.com/Forums/en-US/vstswebtest/thread/bd3b1caf-ca7b-408e-b415-3b8e3465bb03
Web Test Authoring and Debugging Techniques for VS 2008
Please visit the following link:
http://blogs.msdn.com/edglas/archive/2007/12/02/web-test-authoring-and-debugging-techniques-for-vs-2008.aspx
http://blogs.msdn.com/edglas/archive/2007/12/02/web-test-authoring-and-debugging-techniques-for-vs-2008.aspx
Web Test Authoring and Debugging Techniques--Visual Studio 2005 Technical Articles
Please visit the following link:
http://msdn2.microsoft.com/en-us/library/ms364082(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/ms364082(VS.80).aspx
Friday, March 27, 2009
How to capture multiple browser windows using WebTest?
Dear All,
We have a web application when we click on a hyperlink it opens in a new browser window.i want to check functionality of that hyperlink.but, webtest not recording the hyperlink window.
Please guide how to capture it?
Thanks,
Swaroop
-------------------------------------------------------------------------------
Are you saying that when you click in the new window the requests are not recorded in the origningal window?
--------------------------------------------------------------------------------
Blog - http://blogs.msdn.com/slumley/default.aspx
--------------------------------------------------------------------------------
Hi Kasireddy,
"Web Test Recorder" cannot record more then one browser at a time.
If you want to record both browser request you may want to use Fiddler - Please erad this post on how to Recording Web Test Using Fiddler
Good Luck
-------------------------------------------------------------------
After you record the first webpage(a.webtest), you can also also record the second page (b.webtest)
Just put all of the webrequests in b.webtest into a.webtest.
Besides fiddler, it is another way.
--------------------------------------------------------------------------------
Ray
----------------------------------------------------------------------------------
Hi Slumley,
Copying new browser URL into Record browser window solved the problem.
Thanks,
Swaroop
We have a web application when we click on a hyperlink it opens in a new browser window.i want to check functionality of that hyperlink.but, webtest not recording the hyperlink window.
Please guide how to capture it?
Thanks,
Swaroop
-------------------------------------------------------------------------------
Are you saying that when you click in the new window the requests are not recorded in the origningal window?
--------------------------------------------------------------------------------
Blog - http://blogs.msdn.com/slumley/default.aspx
--------------------------------------------------------------------------------
Hi Kasireddy,
"Web Test Recorder" cannot record more then one browser at a time.
If you want to record both browser request you may want to use Fiddler - Please erad this post on how to Recording Web Test Using Fiddler
Good Luck
-------------------------------------------------------------------
After you record the first webpage(a.webtest), you can also also record the second page (b.webtest)
Just put all of the webrequests in b.webtest into a.webtest.
Besides fiddler, it is another way.
--------------------------------------------------------------------------------
Ray
----------------------------------------------------------------------------------
Hi Slumley,
Copying new browser URL into Record browser window solved the problem.
Thanks,
Swaroop
List separator for csv files in web test
I use csv files in my web tests as data source. On my PC those tests run fine, but sometimes on other PC there is a problem with list separator. Where can I change list separator as I like (it didn't work with computer regional settings)?
Thanks!
----------------------------------------------------------------------------------
Do you mean that you are running on a machine with a different language. Check for this registry key and see what values you have for the 2 different machines:
Key: HKEY_CURRENT_USER\Control Panel\International
Name: sList
Blog - http://blogs.msdn.com/slumley/default.aspx
---------------------------------------------------------------------------------
This issue wont help. When I ran my test from VS, list separator isn't taken from regional settings (this reg key). I'm running my tests on machines with one language (in key sList separator are equal), but in VS on some PC a different list separator is needed...
---------------------------------------------------------------------------------
If you are still having trouble, I suggest using a different datasource such as xml, excel or a database.
--------------------------------------------------------------------------------
Blog - http://blogs.msdn.com/slumley/default.aspx
Thanks!
----------------------------------------------------------------------------------
Do you mean that you are running on a machine with a different language. Check for this registry key and see what values you have for the 2 different machines:
Key: HKEY_CURRENT_USER\Control Panel\International
Name: sList
Blog - http://blogs.msdn.com/slumley/default.aspx
---------------------------------------------------------------------------------
This issue wont help. When I ran my test from VS, list separator isn't taken from regional settings (this reg key). I'm running my tests on machines with one language (in key sList separator are equal), but in VS on some PC a different list separator is needed...
---------------------------------------------------------------------------------
If you are still having trouble, I suggest using a different datasource such as xml, excel or a database.
--------------------------------------------------------------------------------
Blog - http://blogs.msdn.com/slumley/default.aspx
IP Switching Question
Hi,
When setting a range for the IP switching feature, does it have to be a range of IP addresses that are not in use already? I know about not using an address already configured on the chosen nic from Bill's blog, I am talking about addresses that may be in use by other physical hosts on the network.
The reason I am asking is that common sense says they should be free otherwise there will be a conflict, but I ran a test the other day using a range that I later found out had loads of real hosts! And while none of the IP's were actually used during the test (they were not web tests), the agent logs show that all the binds succeeded with no problems. And then today I ran the same load test with no changes and the moment I started it, the agent went off the network! I checked the event log when it came back and the reason was that on the very final IP address bind of the range, it had a duplicate IP conflict with another box on the network and as a result, disabled its own nic!
So I am really confused now as I did a ping scan and found that virtually all of the addresses I used in my range do have real hosts allocated and also, why did it work first time round, then second time round only fail on the very last one it tried to bind?
Cheers
Dan
----------------------------------------------------------------------------------
can anyone confirm whether the ip addresses for ip switching need to be free ones or if it doesn't matter if they are in use?
i really need to know this as i cannot chance using this again as if it goes bad i have to call out a support guy to physically reset the network card!
----------------------------------------------------------------------------------
They need to be free.
--------------------------------------------------------------------------------
Blog - http://blogs.msdn.com/slumley/default.aspx
When setting a range for the IP switching feature, does it have to be a range of IP addresses that are not in use already? I know about not using an address already configured on the chosen nic from Bill's blog, I am talking about addresses that may be in use by other physical hosts on the network.
The reason I am asking is that common sense says they should be free otherwise there will be a conflict, but I ran a test the other day using a range that I later found out had loads of real hosts! And while none of the IP's were actually used during the test (they were not web tests), the agent logs show that all the binds succeeded with no problems. And then today I ran the same load test with no changes and the moment I started it, the agent went off the network! I checked the event log when it came back and the reason was that on the very final IP address bind of the range, it had a duplicate IP conflict with another box on the network and as a result, disabled its own nic!
So I am really confused now as I did a ping scan and found that virtually all of the addresses I used in my range do have real hosts allocated and also, why did it work first time round, then second time round only fail on the very last one it tried to bind?
Cheers
Dan
----------------------------------------------------------------------------------
can anyone confirm whether the ip addresses for ip switching need to be free ones or if it doesn't matter if they are in use?
i really need to know this as i cannot chance using this again as if it goes bad i have to call out a support guy to physically reset the network card!
----------------------------------------------------------------------------------
They need to be free.
--------------------------------------------------------------------------------
Blog - http://blogs.msdn.com/slumley/default.aspx
Wednesday, March 25, 2009
Need to get all urls from a web page
Hi ,
I m doing my first webtest using VS i m trying to get all urls from the page and them later use those urls.but i tried different things to get urls for example when i place extrace rule for html tag.start tag = a and attribute = href then it returns only first this is main issue.
2nd how i can get my my context variable value .following is the code.
Thanks
awais
WebTestRequest request1 = new WebTestRequest("http://www.worldgolf.com/courses/usa/alabama/");
ExtractAttributeValue extractionRule1 = new ExtractAttributeValue();
extractionRule1.TagName = "a";
extractionRule1.AttributeName = "href";
extractionRule1.MatchAttributeName = "";
extractionRule1.MatchAttributeValue = "";
extractionRule1.HtmlDecode = true;
extractionRule1.Required = true;
extractionRule1.Index = 0;
extractionRule1.ContextParameterName = "";
extractionRule1.ContextParameterName = "values";
request1.ExtractValues += new EventHandler(extractionRule1.Extract);
//string a = this.Context["address"].ToString();
yield return request1;
aq
-------------------------------------------------------------------------------------
Hi Awais,
Here is a complete coded webtest that shows retreiving all URL's from anchor tags that contain hrefs. The urls are all stored in a List, and will only add unique urls.
1 //------------------------------------------------------------------------------
2 //
3 // This code was generated by a tool.
4 // Runtime Version:2.0.50727.3521
5 //
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
8 //
9 //------------------------------------------------------------------------------
10
11 namespace TestExperimentMar09
12 {
13 using System;
14 using System.Collections.Generic;
15 using System.Text;
16 using Microsoft.VisualStudio.TestTools.WebTesting;
17
18
19 public class WebTest3Coded : WebTest
20 {
21 List urlList = new List();
22
23 public WebTest3Coded()
24 {
25 this.PreAuthenticate = true;
26
27 }
28
29 public override IEnumerator GetRequestEnumerator()
30 {
31
32 this.PostRequest += new EventHandler(WebTest3Coded_PostRequest);
33 WebTestRequest request1 = new WebTestRequest("http://msdn.microsoft.com/");
34 request1.ExpectedResponseUrl = "http://msdn.microsoft.com/en-us/default.aspx";
35 yield return request1;
36 request1 = null;
37
38
39 }
40
41 void WebTest3Coded_PostRequest(object sender, PostRequestEventArgs e)
42 {
43 //lets make sure that we have a valid HTML response before we start to work on the Response.HtmlDocument
44 if (e.Response.IsHtml)
45 {
46 //check a filtered list of html tags that are anchor tags
47 foreach (HtmlTag htmlTag in e.Response.HtmlDocument.GetFilteredHtmlTags(new string[] {"a"}))
48 {
49 //makes sure our htmlTag has some attributes, otherwise no need to continue
50 if (htmlTag.Attributes != null)
51 {
52 //loop through all the htmlTag.attributes to see if what we need is there
53 foreach (HtmlAttribute attributeTag in htmlTag.Attributes)
54 {
55 //lets make sure we dont have a bad htmlTag
56 if ( !string.IsNullOrEmpty(attributeTag.Name) )
57 {
58 //we are only concerned with href attributes , other checks could be done here
59 if (attributeTag.Name.Equals("href", StringComparison.InvariantCultureIgnoreCase))
60 {
61 //if the list has the url we dont need to add it again
62 if (! this.urlList.Contains(attributeTag.Value))
63 {
64 //add the url to our master list
65 this.urlList.Add(htmlTag.GetAttributeValueAsString("href"));
66 }
67
68 }
69 }
70 }
71 }
72 }
73 }
74 }
75 }
76 }
77
------------------------------------------------------------------------------
Thanks a lot :)
awais
-------
aq
I m doing my first webtest using VS i m trying to get all urls from the page and them later use those urls.but i tried different things to get urls for example when i place extrace rule for html tag.start tag = a and attribute = href then it returns only first this is main issue.
2nd how i can get my my context variable value .following is the code.
Thanks
awais
WebTestRequest request1 = new WebTestRequest("http://www.worldgolf.com/courses/usa/alabama/");
ExtractAttributeValue extractionRule1 = new ExtractAttributeValue();
extractionRule1.TagName = "a";
extractionRule1.AttributeName = "href";
extractionRule1.MatchAttributeName = "";
extractionRule1.MatchAttributeValue = "";
extractionRule1.HtmlDecode = true;
extractionRule1.Required = true;
extractionRule1.Index = 0;
extractionRule1.ContextParameterName = "";
extractionRule1.ContextParameterName = "values";
request1.ExtractValues += new EventHandler
//string a = this.Context["address"].ToString();
yield return request1;
aq
-------------------------------------------------------------------------------------
Hi Awais,
Here is a complete coded webtest that shows retreiving all URL's from anchor tags that contain hrefs. The urls are all stored in a List
1 //------------------------------------------------------------------------------
2 //
3 // This code was generated by a tool.
4 // Runtime Version:2.0.50727.3521
5 //
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
8 //
9 //------------------------------------------------------------------------------
10
11 namespace TestExperimentMar09
12 {
13 using System;
14 using System.Collections.Generic;
15 using System.Text;
16 using Microsoft.VisualStudio.TestTools.WebTesting;
17
18
19 public class WebTest3Coded : WebTest
20 {
21 List
22
23 public WebTest3Coded()
24 {
25 this.PreAuthenticate = true;
26
27 }
28
29 public override IEnumerator
30 {
31
32 this.PostRequest += new EventHandler
33 WebTestRequest request1 = new WebTestRequest("http://msdn.microsoft.com/");
34 request1.ExpectedResponseUrl = "http://msdn.microsoft.com/en-us/default.aspx";
35 yield return request1;
36 request1 = null;
37
38
39 }
40
41 void WebTest3Coded_PostRequest(object sender, PostRequestEventArgs e)
42 {
43 //lets make sure that we have a valid HTML response before we start to work on the Response.HtmlDocument
44 if (e.Response.IsHtml)
45 {
46 //check a filtered list of html tags that are anchor tags
47 foreach (HtmlTag htmlTag in e.Response.HtmlDocument.GetFilteredHtmlTags(new string[] {"a"}))
48 {
49 //makes sure our htmlTag has some attributes, otherwise no need to continue
50 if (htmlTag.Attributes != null)
51 {
52 //loop through all the htmlTag.attributes to see if what we need is there
53 foreach (HtmlAttribute attributeTag in htmlTag.Attributes)
54 {
55 //lets make sure we dont have a bad htmlTag
56 if ( !string.IsNullOrEmpty(attributeTag.Name) )
57 {
58 //we are only concerned with href attributes , other checks could be done here
59 if (attributeTag.Name.Equals("href", StringComparison.InvariantCultureIgnoreCase))
60 {
61 //if the list has the url we dont need to add it again
62 if (! this.urlList.Contains(attributeTag.Value))
63 {
64 //add the url to our master list
65 this.urlList.Add(htmlTag.GetAttributeValueAsString("href"));
66 }
67
68 }
69 }
70 }
71 }
72 }
73 }
74 }
75 }
76 }
77
------------------------------------------------------------------------------
Thanks a lot :)
awais
-------
aq
Analysis on 1000 Vusers
Affuu - Posted on Tuesday, March 24, 2009 1:50:06 AM
I want to do an analysis by loading an application with 1000 users and the SUT,controller,agent are on the same system will I be able to do it,if yes I want to know what will be the Run time settings i need to do,I want to go for constant load of 1000 users,please help me by providing more information on this,I need to check out the CPU utilization,RPS,Memory utilization etc.What counters exactly i need to select so that I can come to a conclusion that how many agents i need to add if I increase the load from 1000 to 2000 to 3000....
What will be the best configuration i.e the number of agents,controller,SUT(its only one system) and SQL express(load store)
One more thing when I run the webtest before adding it to load few of the dependant requests are failing but the mail request page is displaying fine do i need to rectify/make it pass completely before adding to load or is it fine as long as the main requests are rendered successfully
please help me as I am new to VSTS 2008 tool
------------------------------------------------------------------------------------
Hi
For hardware sizing and the number of required agents, please refer to Performance Considerations section in Load Agent and Load Controller Installation and Configuration Guide for more information. In a test rig, you just need 1 controller.
There are many performance counter category available by default. You can use counters in Processor and Memory category to check the CPU and memory usage. If you are testing an ASP.NET application, Performance Counters for ASP.NET might also be helpful.
It's correct to fix web tests before adding them in load tests. About the failing of dependent requests, please take a look at Masking a 404 error in a dependent request. If you are in a different situation, could you give us more details?
-------------------------------------------------------------------------------------
Hi Aff,
you basically need more than 1 computer.. try to get such as 1 computer for Controller and a few PCs for Agents.. by putting agent and controller at the same computer, the result will not be accurate.
To load 1000 users for a simple system, that will be fine.
But, make sure you start at small number of users, and check the CPU load if it can handle such number of users.
YOu can check the CPU utilization and etc from the perfmon in ur server.
Run time setting is based on what is ur need. If you think all this 1000 users will be using the system for 1 hour flat, then set it as 1 hour.
Benny.
-------------------------------------------------------------------------------------
Hi Affu,
Let me clairfy one part of your question. Are you saying that your Application you want to test (the System Under Test) will also be on the same box as your Controller, Agent?
This would invalidate the testing given that you want to monitor the CPU utilization, Memory consumption, etc.
The controller, agents also require memory, cpu, etc. Also, if you are executing the load test in the local configuration, not using a controller, agent, then your test process will only use a Single CPU on the system, even if you have more. Thats why its important to size your Controller, Agent(s) correctly so you will not skew your results by overloading your client.
Hope this helps.
Robert
I want to do an analysis by loading an application with 1000 users and the SUT,controller,agent are on the same system will I be able to do it,if yes I want to know what will be the Run time settings i need to do,I want to go for constant load of 1000 users,please help me by providing more information on this,I need to check out the CPU utilization,RPS,Memory utilization etc.What counters exactly i need to select so that I can come to a conclusion that how many agents i need to add if I increase the load from 1000 to 2000 to 3000....
What will be the best configuration i.e the number of agents,controller,SUT(its only one system) and SQL express(load store)
One more thing when I run the webtest before adding it to load few of the dependant requests are failing but the mail request page is displaying fine do i need to rectify/make it pass completely before adding to load or is it fine as long as the main requests are rendered successfully
please help me as I am new to VSTS 2008 tool
------------------------------------------------------------------------------------
Hi
For hardware sizing and the number of required agents, please refer to Performance Considerations section in Load Agent and Load Controller Installation and Configuration Guide for more information. In a test rig, you just need 1 controller.
There are many performance counter category available by default. You can use counters in Processor and Memory category to check the CPU and memory usage. If you are testing an ASP.NET application, Performance Counters for ASP.NET might also be helpful.
It's correct to fix web tests before adding them in load tests. About the failing of dependent requests, please take a look at Masking a 404 error in a dependent request. If you are in a different situation, could you give us more details?
-------------------------------------------------------------------------------------
Hi Aff,
you basically need more than 1 computer.. try to get such as 1 computer for Controller and a few PCs for Agents.. by putting agent and controller at the same computer, the result will not be accurate.
To load 1000 users for a simple system, that will be fine.
But, make sure you start at small number of users, and check the CPU load if it can handle such number of users.
YOu can check the CPU utilization and etc from the perfmon in ur server.
Run time setting is based on what is ur need. If you think all this 1000 users will be using the system for 1 hour flat, then set it as 1 hour.
Benny.
-------------------------------------------------------------------------------------
Hi Affu,
Let me clairfy one part of your question. Are you saying that your Application you want to test (the System Under Test) will also be on the same box as your Controller, Agent?
This would invalidate the testing given that you want to monitor the CPU utilization, Memory consumption, etc.
The controller, agents also require memory, cpu, etc. Also, if you are executing the load test in the local configuration, not using a controller, agent, then your test process will only use a Single CPU on the system, even if you have more. Thats why its important to size your Controller, Agent(s) correctly so you will not skew your results by overloading your client.
Hope this helps.
Robert
Friday, March 20, 2009
Coded web test - How to Send an email after test run and after test success or fail
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2724147&SiteID=1
Hi,
I want to send a successful email to a user through smtp server if test run success and on the other hand if web test fail, then i want to sent a failed email message to the user as notification.
I can send normal email from the coded scripts.
But I don't know how to retrieve web test run result status: pass or fail .........
I want to know the exact command or code as if I can able to send an email after the test run and after it's run success or fail
I very much appreciate your help. Noted that I am using VSTS 2005
Thanks,
Jaeed
-----------------------------------------------------------------------------------------
Answer Re: Coded web test - How to Send an email after test run and after test success or fail Was this post helpful ?
In VSTS 2008, in your coded web test, you can call this.Outcome.ToString(). In VSTS 2005, the property is not exposed.
Thanks.
------------------------------------------------------------------------------------------------
Re: Coded web test - How to Send an email after test run and after test success or fail
Thanks a lot Yutong. Jaeed
Hi,
I want to send a successful email to a user through smtp server if test run success and on the other hand if web test fail, then i want to sent a failed email message to the user as notification.
I can send normal email from the coded scripts.
But I don't know how to retrieve web test run result status: pass or fail .........
I want to know the exact command or code as if I can able to send an email after the test run and after it's run success or fail
I very much appreciate your help. Noted that I am using VSTS 2005
Thanks,
Jaeed
-----------------------------------------------------------------------------------------
Answer Re: Coded web test - How to Send an email after test run and after test success or fail Was this post helpful ?
In VSTS 2008, in your coded web test, you can call this.Outcome.ToString(). In VSTS 2005, the property is not exposed.
Thanks.
------------------------------------------------------------------------------------------------
Re: Coded web test - How to Send an email after test run and after test success or fail
Thanks a lot Yutong. Jaeed
How to add local text or tif or pdf files from local PC into the web test scripts
How to add local text or tif or pdf files from local PC into the web test scripts
Hello,
One of our site has a feature to upload document(text, tiff or pdf files) through its User Interface and after uploading the documents they get inserted into some database table and finally they show up to the UI.
I tried to record this by using VSTS 2008 beta/VSTS 2005 SP1 as a web test and it was not working.
I wonder - is there any alternative way or best way to make the script workable for uploading document(tiff file) from local location through the website by VSTS
Thanks,
------------------------------------------------------------------------------------------------
Answer Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
add the file to your test solution and add it to the deployment section of your test run configuration.
So far this is what we've had to do any time we had a test that uploads a file of any sort to the server
--Chuck
----------------------------------------------------------------------------------------------
Answer Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
You shouldn't have to add it to the solution, but Chuck is right, you need to add it to the deployment section of your testrunconfig
--Mike
-------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts
Thanks Chuck and Mike. It helped.
------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
Hi Chuck and Mike,Same scenario discussed by Jaeed but let me explain.I have a simple web page with uploading files (any txt, doc or pdf) from any location and after uploading all the files displayed to some UI. I record a web test and during the recording I have successfully upload the text file on my required application. So then according to ur solutions I then add the files to deployment area and then re-run my recorded test, The run successfully but non of the file present in deployment area is uploaded to the required applicaiton. Is there any thing which i missing.Your response in this regard will be highly appreciated.Regards,Waseem.
---------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
I presume you are still at the stage of getting the webtest working, and we are running in webtest mode, not loadtest mode.
So did your test generate any errors?
Open up the test results and walk through and examine the responses from the server for each step of the test.. did everything go as expected, or did you get some kind of error from the server.. (especially if you end up trying to do something like upload a file that already exists.. I'd expect some kind of different response from the server than if the file did not already exist (as in some kind of overwrite confirmation)
One thing to keep in mind with VSTS is that when page content is dynamic, if the right page URL is returned in response to the request, in the abscence of other validation checks VSTS will consider that request to be a success, NO MATTER what is actually on the page.
In that instance a very limited number of things could cause the action to fail:
unable to find a match for an extraction rule
total abscence of any hidden values if hidden values are being extracted from the page
404 error for some dependant resource
For example, if I'm doing something to update a user's credit card data on a commerce site.. after posting the data I might get back a page called updatecc.aspx.. On that page might be text to the effect of "Credit Card Updated" or "Invalid Credit Card" or "expiration date required" or some other error..
If I don't add a validation to that page to look for the success message, or to look for error messages and FAIL if they are found, then VSTS can't tell if the actual page content was correct, and the test will pass by default just because a page with the right URL came back.
--Chuck
----------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
Hi Chuck,I upload the files on my web application using the same recorded script by changing its some parameters. After recording the test I simply go on the step on which upload URL is present, I then change the file path of FileUploadParameter under the FromPostParameters from its properties and give the path of another file to which I want to upload and then re-run the test and I got success. But still confusing with the option which you told me for files uploading through 'Deployment' area under Test -> Edit Test Run Configurations -> Deployment .Could u plz tell me the steps by executing them I am able to upload the files through Test -> Edit Test Run Configurations -> Deployment option instead of changing the file path of FileUploadParameter .Regards,Waseem
-----------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
One of the MS folks might be able to explain this better (and will hopefully correct me if I have any of this wrong), but my general understanding is along these lines.
Webtests get run from more than a single machine.. They could be run by other people in your org (assuming they are checked into source control) and they can end up being run on Agent systems when run as part of a larger scale loadtests or on a dedicated workstation used for smaller scale loadtests.
So the deployment section of the test run configuration is a way to tell the system 'these are files I need to run this test' the items there might be datafiles used for databindings, or files being uploaded, or for some other purpose, but when the test runs it will need access to those files.
This is why (I believe) when a test records a file upload action, what is recorded in the test is only the filename, and not the full path. Because the system is going to expect to find that file in the deployment directory (which is created when the test runs), which is the only place it can reliably know the file will be able to be found. (after all, an agent machine, or a co-worker's system likely does not have access to your hard drive, and may not have access to the same network shares you do.)
So adding the files to the deployment list doesn't upload them anywhere, it's not an alternative to the file upload parameter.. it's a way to make sure whatever you spec in that parameter is available to the test no matter where the test is run.
One thing I'm not clear on is where the system looks for the file when it goes to deploy it. It seems the file needs to be in the same directory as your test. (which is why with my stuff being checked into source control and all, I've been adding the file to the solution.. I'm not sure if it's the 'best' way of dealing with it, but it's working for me so far.)
--Chuck
Hello,
One of our site has a feature to upload document(text, tiff or pdf files) through its User Interface and after uploading the documents they get inserted into some database table and finally they show up to the UI.
I tried to record this by using VSTS 2008 beta/VSTS 2005 SP1 as a web test and it was not working.
I wonder - is there any alternative way or best way to make the script workable for uploading document(tiff file) from local location through the website by VSTS
Thanks,
------------------------------------------------------------------------------------------------
Answer Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
add the file to your test solution and add it to the deployment section of your test run configuration.
So far this is what we've had to do any time we had a test that uploads a file of any sort to the server
--Chuck
----------------------------------------------------------------------------------------------
Answer Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
You shouldn't have to add it to the solution, but Chuck is right, you need to add it to the deployment section of your testrunconfig
--Mike
-------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts
Thanks Chuck and Mike. It helped.
------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
Hi Chuck and Mike,Same scenario discussed by Jaeed but let me explain.I have a simple web page with uploading files (any txt, doc or pdf) from any location and after uploading all the files displayed to some UI. I record a web test and during the recording I have successfully upload the text file on my required application. So then according to ur solutions I then add the files to deployment area and then re-run my recorded test, The run successfully but non of the file present in deployment area is uploaded to the required applicaiton. Is there any thing which i missing.Your response in this regard will be highly appreciated.Regards,Waseem.
---------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
I presume you are still at the stage of getting the webtest working, and we are running in webtest mode, not loadtest mode.
So did your test generate any errors?
Open up the test results and walk through and examine the responses from the server for each step of the test.. did everything go as expected, or did you get some kind of error from the server.. (especially if you end up trying to do something like upload a file that already exists.. I'd expect some kind of different response from the server than if the file did not already exist (as in some kind of overwrite confirmation)
One thing to keep in mind with VSTS is that when page content is dynamic, if the right page URL is returned in response to the request, in the abscence of other validation checks VSTS will consider that request to be a success, NO MATTER what is actually on the page.
In that instance a very limited number of things could cause the action to fail:
unable to find a match for an extraction rule
total abscence of any hidden values if hidden values are being extracted from the page
404 error for some dependant resource
For example, if I'm doing something to update a user's credit card data on a commerce site.. after posting the data I might get back a page called updatecc.aspx.. On that page might be text to the effect of "Credit Card Updated" or "Invalid Credit Card" or "expiration date required" or some other error..
If I don't add a validation to that page to look for the success message, or to look for error messages and FAIL if they are found, then VSTS can't tell if the actual page content was correct, and the test will pass by default just because a page with the right URL came back.
--Chuck
----------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
Hi Chuck,I upload the files on my web application using the same recorded script by changing its some parameters. After recording the test I simply go on the step on which upload URL is present, I then change the file path of FileUploadParameter under the FromPostParameters from its properties and give the path of another file to which I want to upload and then re-run the test and I got success. But still confusing with the option which you told me for files uploading through 'Deployment' area under Test -> Edit Test Run Configurations -> Deployment .Could u plz tell me the steps by executing them I am able to upload the files through Test -> Edit Test Run Configurations -> Deployment option instead of changing the file path of FileUploadParameter .Regards,Waseem
-----------------------------------------------------------------------------------------------
Re: How to add local text or tif or pdf files from local PC into the web test scripts Was this post helpful ?
One of the MS folks might be able to explain this better (and will hopefully correct me if I have any of this wrong), but my general understanding is along these lines.
Webtests get run from more than a single machine.. They could be run by other people in your org (assuming they are checked into source control) and they can end up being run on Agent systems when run as part of a larger scale loadtests or on a dedicated workstation used for smaller scale loadtests.
So the deployment section of the test run configuration is a way to tell the system 'these are files I need to run this test' the items there might be datafiles used for databindings, or files being uploaded, or for some other purpose, but when the test runs it will need access to those files.
This is why (I believe) when a test records a file upload action, what is recorded in the test is only the filename, and not the full path. Because the system is going to expect to find that file in the deployment directory (which is created when the test runs), which is the only place it can reliably know the file will be able to be found. (after all, an agent machine, or a co-worker's system likely does not have access to your hard drive, and may not have access to the same network shares you do.)
So adding the files to the deployment list doesn't upload them anywhere, it's not an alternative to the file upload parameter.. it's a way to make sure whatever you spec in that parameter is available to the test no matter where the test is run.
One thing I'm not clear on is where the system looks for the file when it goes to deploy it. It seems the file needs to be in the same directory as your test. (which is why with my stuff being checked into source control and all, I've been adding the file to the solution.. I'm not sure if it's the 'best' way of dealing with it, but it's working for me so far.)
--Chuck
Subscribe to:
Comments (Atom)
Unix/Linux Commands
Flow control Syntax break Exit a loop. continue Exit the current iteration of the loop and proceed with the next iteration. Ctrl+C Key com...
-
%systemroot%\system32\inetsrv\config\applicationHost.config https://docs.microsoft.com/en-us/iis/configuration/system.applicationhos...
-
hi everybody, i am doing load test for 10 users,20users,30users working fine upto to this point if increase to 40 users iam getting error a...