To answer your question, I am sure that this cannot be done out of the box of MSTest and NUnit ( this approach will not be this scenario).
But, IMHO, just not there ... In my experience, simulating ~ 1000 users from one machine will lead to bad results, because in the test all kinds of client restrictions will be encountered - problems of the thread pool, outgoing and problems with incoming traffic, etc. . I am not saying that this cannot be overcome, but he twisted enough to consider a different approach.
In fact, I do not recommend using load testing tools (in this case there are a lot of them), since it is enough to simply write a small tool and skip configuration problems and learning curves of the 3rd party.
What I recommend is writing your own tool and running it from individual machines. It does not need to be run using the testing framework (I cannot force myself to call it unit test, because it is not), the console application will do the trick. Here is the code to get you started:
private ConcurrentBag<string> logs = new ConcurrentBag<string>(); public void GetLoad(int numberOfUsers, List<string> myParams) { var users = new string[numberOfUsers]; for (int i = 0; i < numberOfUsers; i++) { users[i] = string.Format("LoadTest{0}", i + 1); } var userThreads = new List<Thread>(); for (int i = 0; i < numberOfUsers; i++) { int index = i; userThreads.Add(new Thread(()=> CallWebService(users[index], myParams[index]))); } Parallel.ForEach(userThreads, thread=>thread.Start()); foreach (var userThread in userThreads) { userThread.Join(); } var outputFilename = string.Format("LoadTest.{0}Users.txt", numberOfUsers); File.AppendAllLines(outputFilename, logs); }
source share