VS2010 Load Test Run Prepare and Verify Once

淺唱寂寞╮ 提交于 2019-12-11 03:44:24

问题


We have a load test that runs of 100 concurrent users. We also have "Prepare" and "Verify" tests that we'd like to run just once at the beginning and end of the whole load test - NOT for each emulated user (*100) in the load test.

Can anyone please advise the easiest way to configure this?


回答1:


You can create a Load Test Plug-In and use the LoadTestStarting & LoadTestFinished events to call the methods you want:

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
    }
}


来源:https://stackoverflow.com/questions/10946556/vs2010-load-test-run-prepare-and-verify-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!