Shai Raiten

Hello everyone,

I made a Web Test that perform login to a site, the user and password is taken dynamicly from Access DB.

When i config the DB in the TFS to ramdom and run the test every time he gives me another user and password, and this is just fine.

Now, when i creates a load test from this Web Test he only use one user and password from the DB.

How can i config the load test to act like the Web Test to take a different user and password for each run in the load test.

Thanks



Re: Visual Studio Team System - Web and Load Testing Load Test with DB

slumley MSFT

It is suppose to just work without making changes. Can you generate a coded test from your web test and post the code






Re: Visual Studio Team System - Web and Load Testing Load Test with DB

Shai Raiten

This is the code.

In the load test result i"m looking in the Scenario1 -> WebTest1 -> Failed Test , Passed Tests

And i see 0 Failed tests.

Maybe i"m looking not in the right place

Code Snippet

namespace TestProject15

{

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.VisualStudio.TestTools.WebTesting;

using Microsoft.VisualStudio.TestTools.WebTesting.Rules;

[DataSource("DataSource1", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"C:\\Documents and Settings\\shai\\Desk" +

"top\\Db.mdb\";Persist Security Info=False", Microsoft.VisualStudio.TestTools.WebTesting.DataBindingAccessMethod.Sequential, "Table1")]

[DataBinding("DataSource1", "Table1", "Password", "DataSource1.Table1.Password")]

[DataBinding("DataSource1", "Table1", "User", "DataSource1.Table1.User")]

public class WebTest1Coded : WebTest

{

public WebTest1Coded()

{

this.PreAuthenticate = true;

}

public override IEnumerator<WebTestRequest> GetRequestEnumerator()

{

WebTestRequest request1 = new WebTestRequest("http://www.hagaydoron.com/mambo");

request1.ThinkTime = 9;

yield return request1;

WebTestRequest request2 = new WebTestRequest("http://www.hagaydoron.com/mambo/access.php");

request2.ThinkTime = 13;

request2.Method = "POST";

request2.Encoding = System.Text.Encoding.GetEncoding("windows-1255");

FormPostHttpBody request2Body = new FormPostHttpBody();

request2Body.FormPostParameters.Add("user", this.Context["DataSource1.Table1.User"].ToString());

request2Body.FormPostParameters.Add("pass", this.Context["DataSource1.Table1.Password"].ToString());

request2.Body = request2Body;

if ((this.Context.ValidationLevel >= Microsoft.VisualStudio.TestTools.WebTesting.ValidationLevel.High))

{

ValidationRuleFindText rule1 = new ValidationRuleFindText();

rule1.FindText = "Worng Pass or User";

rule1.IgnoreCase = false;

rule1.UseRegularExpression = false;

rule1.PassIfTextFound = false;

request2.ValidateResponse += new EventHandler<ValidationEventArgs>(rule1.Validate);

}

yield return request2;

WebTestRequest request3 = new WebTestRequest("http://www.hagaydoron.com/mambo/");

request3.Encoding = System.Text.Encoding.GetEncoding("windows-1255");

yield return request3;

}

}

}





Re: Visual Studio Team System - Web and Load Testing Load Test with DB

slumley MSFT

are you still seeing this problem






Re: Visual Studio Team System - Web and Load Testing Load Test with DB

Shai Raiten

Yes.

Still got 0 errors in the report.





Re: Visual Studio Team System - Web and Load Testing Load Test with DB

slumley MSFT

I think I know what you are running into. Validation rules have a valiation level associated with them. By default the level is high. When the web test runs by itselfm, we always execute all the rules. We do not do this when the load test runs. Executing rules can affect the amount of load you generate, so we execute rules which are at the same validation or lower than the validation level for the load test. For example, if the validation level for the load test is set to

medium, we will execute rules that have a validation level of medium and low. By defaul the validation level is set to low, so only execute rules with validation level of low. You can see in your coded test that your rule is urrounded by a check for the level being high. So if you did not change the default validation level, this rule will not fire.

You can change the validation level by

1) Opening the load test in the loadtest editor

2) Click on the Run Setting node

3) Open property browser

4) Set the validation level property to high

Let me know if this was the problem.






Re: Visual Studio Team System - Web and Load Testing Load Test with DB

Shai Raiten

Thank You.

Now it's working...

But i dont understand one thing:

When i change the validation level in the web test to low and in the load test the validation level is High it's still shows me Passed test but when the validation in the load test is low he shows me more Passed tests.