VS2010负载测试运行准备并验证一次 [英] VS2010 Load Test Run Prepare and Verify Once

查看:69
本文介绍了VS2010负载测试运行准备并验证一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个负载测试,可以运行100个并发用户.我们还希望在整个负载测试的开始和结束时仅运行一次准备"和验证"测试-并非针对负载测试中的每个模拟用户(* 100).

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?

推荐答案

您可以创建

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

这篇关于VS2010负载测试运行准备并验证一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆