Fixing Visual Studio Web Test Errors

Learn how to fix Visual Studio web test playback errors and configure dynamic parameters automatically using Web Test Builder.

Microsoft Visual Studio, fixing errors, best practices, parameterization


Transcript

If you have used Visual Studio for load testing, you may have experienced playback issues of a recorded scenario. In this video, you will learn how to fix such errors to make your web test run correctly. Let's begin with creating a new web performance test. IE opens to record my application traffic. I record a scenario in Microsoft Dynamics 365. First I'll login. Then go to "Sales", "Accounts", click "New", populate with some pre-defined data, and click Save & Close. A new account called "Major Car Auto", was created. Let's click Stop to return back to Visual Studio. It is going to analyze the test for dynamic parameters. While it is doing this, I will switch to Firefox opened to "my active accounts" page, hit F5 to refresh it, and here is the "Major Car Auto" record created during recording. Back in Visual Studio, the scanning is done, and it found a few dynamic parameters. I click OK to accept them. As we will find out soon, these are not all of the parameters necessary for successful playback. Now I'll run the test. Visual Studio replays the recording and checks for errors. If the playback is successful, then another "Major Car Auto" record will be created, but as you can see there are a number of errors. At the end, the test failed. To double check, I'll go to Firefox, hit F5 to refresh, and there is still only one "Major Car Auto" record. The recorded script doesn't work. Some parameters are missing. This type of error happens more often when you test a highly dynamic website or a web application with enhanced security. There are several Microsoft instructions for assisting in such situations. Generally they recommend finding dynamic parameters and creating extractors manually. Unfortunately, these recommendations are too general and do not offer specific resolution steps for your test scenario. Manual parameterization is difficult, requires experience, and is not very efficient when you need to get results quickly. I will show you an easier way to overcome web-test playback errors automatically without manual parameterization in Visual Studio. I will use StresStimulus as a script generator. It will create all necessary parameters and then generate a web-test for Visual Studio where it will playback successfully. In StresStimulus, I start recording a new test case, and follow the test Wizard steps. It opens IE. Here's the recorder. I will navigate through the same scenario as before: login, go to "Sales", "Accounts", click "New", populate the web form with the same data, and click Save & Close. Now I have two "Major Car Auto" records. I stop recording. StresStimulus is analyzing the test for dynamic parameters, and it found a lot more parameters than Visual Studio. I will cancel the wizard, as our goal today is to continue testing in Visual Studio. Go to "Managing Test Cases", right-click on the test case, select "Export as Visual Studio web-test", and save it in the Visual studio project folder. The dialog says that the StresStimulus-web-test dll must be referenced in the Visual Studio project. It is located in the StresStimulus installation folder. In Visual Studio I refresh the file list and include the StresStimulus web test in the project. Before running the test, let's confirm that we still have just two "Major Car Auto" records. Now let's run the test. There are no errors, and the test passed. Let's switch to Firefox, refresh, and there is a third record that was created by Visual Studio replay. Our test works now because it has all necessary parameters automatically created by StresStimulus. Finding and creating all of these parameters manually in Visual Studio would be difficult and time-consuming. Using StresStimulus as a test generator for Visual Studio when you have playback issues will not only save you time, but also enables you to test some applications which previously were virtually un-testable. Thank you for watching.