|
index > Visual Studio Team System - Testers > Using XML files as Webtest DataSources |
|
Using XML files as Webtest DataSources |
|
|
I have a series of BVT tests for our web service. Some of these tests require being logged in as a user of the service. Other tests require doing searches for service members.
I set up a Database table with Usernames and passwords, and set the BVT's up to use a Datasource pointed at the table.
That works great, for Test. The developers want to be able to run these tests before they check thier code in. The problem is that when they are working anywhere but at the office (we all like to hit startbucks and work from there sometimes, and sometimes we work from home) the SQL server the datasource points to is unreachable (Firewall and NAT in the way.) Exposing the SQL Server to the internet is not a possibiltiy since we have a production SQL Server being exposed.
The logical solution to me was to use an XML File as a datasource. So I added code to the webtestPlugin I already have and created an instance of System.Data.DataSet, Loaded up an XML File that I created from the Data in the Table. and called WebTest.DataSources.Add(<DataSet>)
And That's when I notice the differences between System.Data.DataSource and Microsoft.VisualStudio.QualityTools.WebTestFramework.DataSource.
So the question is "How do I use an XML File as a data source for a webtest" And if I can't, why not? When will it be implemented?
| | Jaeger Mitchell | Currently to use an xml file as a data source, you need to implement the datasource functionality. You would need to write a class which reads in the xml file and then changes the value in the context for each test case iteration. This can be done with a WebTestPlugin. To implement a plugin, you extend the WebTestPlugin class. In the PreWebTest method, you would want to write code which reads in the xml file one time. You also want to add a different value to the context for each iteration. If you want more information on how this would work please let me know.
Another way to do this that would work with your current setup, is to use a csv file to hold your data. A csv file can be used the same way a sql server datasource is used. To add a csv file as a datasource, do the following: 1) Create a csv file that looks like the following: username,password user1,password1 user2,password2
The first row is for column headers.
2) Click the add datasource button for the webtest 3) Choose Microsoft Jet 4.0 OLE DB Provider as the OLE DB Provider 4) Click the Datalinks button 5) On the connection tab, enter the directory that the csv file is in for the "Select or enter a database name:" text box. Enter just the directory. 6) Click on the all tab. 7) Double Click Extended Properties 8) Enter text and hit OK 9) Click Ok for the Data Link Properties dialog 10) Click Ok for the connection properties dialog 11) Choose the csv file in the choose tables dialog. 12) Add the datasource to the field you want to bind to. The column headers in the csv file will be used for the field names.
Blog - http://blogs.msdn.com/slumley/default.aspx | | slumley |
|
|
| reply 2 |
|
|
|
You can use google to search for other answers |
|
|
|
|
More Articles |
|
| Ending a load test Early |
| How do i create validation to verify that form field is in read o... |
| Data Source and Error handling during a Load Test |
| Ordered Load Tests |
| Why test case's name becomes lowercase |
| .trx insert to DB, Distributed web testing across networks? |
| Question about validation rule - validating in a data grid contro... |
| Load Test Page Results? |
| Create Unit Tests: default template & IDisposable |
| Adequacy of web tests at HTTP layer rather than UI? |
|