我们有一个运行 100 个并发用户的负载测试。我们还有“准备”和“验证”测试,我们希望在整个负载测试的开始和结束时仅运行一次 - 不是针对负载测试中的每个模拟用户 (*100)。
任何人都可以建议最简单的配置方法吗?
最佳答案
您可以创建 Load Test Plug-In并使用 LoadTestStarting
和 LoadTestFinished
事件来调用您想要的方法:
public class Plugin : ILoadTestPlugin
{
private LoadTest _loadTest;
public void Initialize(LoadTest loadTest)
{
_loadTest = loadTest;
_loadTest.LoadTestStarting += new System.EventHandler(loadTest_LoadTestStarting);
_loadTest.LoadTestFinished += new System.EventHandler(loadTest_LoadTestFinished);
}
void loadTest_LoadTestStarting(object sender, System.EventArgs e)
{
//call your prepare method
}
void loadTest_LoadTestFinished(object sender, System.EventArgs e)
{
//call your verify method
}
}
关于visual-studio-2010 - VS2010负载测试运行准备和验证一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10946556/