scenario
Hi,
I am testing one win form application. I have written unit test and I am calling this unit test in my load test to test the web services.
As per the business logic, user should login and create the survey and checkout the survey. I have created the unit test for the above scenario.
I have created the load test using step load option andgiven the max user count as 25. But all the 25 users are login with same username and password and complete the load test. But in real time same user cannot login for 25 times.
- Weather 25 users are creating the survey with same user name or different user names ever time they login they will create the load on sever. Will there be any difference in load test results using VSTS if I use same login or different logins for 25 users in the above scenario?
- Is it right that using same login for 25 users?
3.If I want to login with different user names for 25 users then where should I modify the script? In Unit test or load test? Can you please tell me that where should I modify the script for 25 users for different logins every time they login in application?
Thanks,
Shankar
[2875 byte] By [
ShankarK] at [2007-12-20]
1. The load could depend on your application. If your application does any kind of caching for a user, then it is possible that the load would not be the same. On the otherhand, if your app goes through the same set of steps everytime a user logs in, then it may be the same load.
2. Another thing to consider, is would all 25 users be of the same role/group. If the users were in different roles, then your app might be loading different information based on the users role. In this case, the same user woul not generate the same load as 25 different users. It is probably better to use more than one user to better simulate how your application will be used.
3. You would defintely need to modify the unit test, but you may also want to add a load test plugin to help with this. I assume that your unit test is passing in the login info in one of the web service calls. You could add databinding to the unit test with 25 different users. This way each time you run the unit test, it will execute 25 times. Once with each user defined. This works a little different that data binding in a web test, in that the each iteration of the web test will just pick up the next row in the datasource. It will not execute one iteration of the test for each row in the datasource. If you wanted to get behavior similar to a web test, you would need to do some custom databinding. You could add a load test plugin, which adds the username and password to the unit test context in the Test Starting event:
public
class Class1 : ILoadTestPlugin {
#region
ILoadTestPlugin Members public void Initialize(LoadTest loadTest) {
loadTest.TestStarting +=
new EventHandler<TestStartingEventArgs>(loadTest_TestStarting); }
void loadTest_TestStarting(object sender, TestStartingEventArgs e) {
e.TestContextProperties.Add(
"user", "user1"); }
#endregion
}
You could then access the property like the following:
[
TestClass] public class UnitTest1 {
private TestContext m_testContext; public UnitTest1() {
// // TODO: Add constructor logic here // }
public TestContext TestContext {
get { return m_testContext; } set { m_testContext = value; } }
[
TestMethod] public void TestMethod1() {
string t = TestContext.Properties["user"].ToString(); Console.WriteLine("User: {0}", TestContext.DataRow["user"]); }
}
Instead of hardcoding the username and password, you could do some kind of custom databinding similar to what is explained in the following post: http://blogs.msdn.com/slumley/archive/2006/04/07/570772.aspx If you did this, you would call the customDS each time the testStarting event is called and you would get a different user.
Here are some links for data driven unit tests, but I think the custom databinding approach will realisticly simulate your application:
http://msdn2.microsoft.com/en-us/library/ms182528(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/ms182527(VS.80).aspx