Web performance testing with datasource in vs 2012

2019-03-04 14:31发布

问题:

I'm having some issues with my web performance test that I created in Visual Studio 2012. I've created a test to go through our order system, but on the first run of the test it has errors on the page where you select orders. If I run that same test again it seems to work.

Since I am using a data source containing usernames and passwords, I only have one performance test and it runs once for each user in the data source. When it runs it passes the first test, but each additional user causes errors on that page which results in an empty shopping cart. It seems like an issue with POST variables not being generated or passed for each user after the first in the test.

Does anyone know how to fix this without having to create a web performance test specifically for each user? Using one performance test with a data source is so much nicer.

Thanks!

回答1:

The web performance system is intended to allow data driven tests in the style you want. Your web site probably has some parameters that Visual Studio has not detected. The mechanisms built in to Visual Studio for detecting dynamic parameters are good, but not infallible.

First step. Just read through the recorded test including form parameters looking for things that may have been missed. You learn what they are through experience.

Another step. Record two versions of the same test, as closely as possible perform identical steps. (But do not worry about think times.) Then compare the two recorded tests. Look for form post parameters and other values that differ and consider whether they should be taken from earlier responses. Find which responses the values come from and write the appropriate extraction rules to create the context parameter.

It can also be worth recording and comparing two tests that are identical expect for user name and password used.

As well as recording tests with Visual Studio and comparing the files, it can be worth recording with a program such as Fiddler.

I have found that comparing the ".webtest" files with a good text comparison program helps find the differences, then make the edits within Visual Studio. If you are confident and keep backups you might edit the XML in the ".webtest" files.

Update: Note on comparing the .webtest files. Look at where the RecordedValue="..." fields differ but the associated parameter fields are not replaced by context variables.