visual-studio-2010 - VS2010负载测试: How can I perform custom action that is run once prior to each load test

标签 visual-studio-2010 testing load load-testing

基本上,我需要在运行每个负载测试之前重新启动特定服务,并且重新启动本身没有问题。我已经研究了一段时间,但还没有找到一种方法来放置一些操作或脚本或只是另一个负载测试,以便我可以确保它在每次负载测试之前执行,并且每次负载测试仅执行一次。

任何有关如何使其以这种方式运行的想法都值得赞赏。

最佳答案

创建 LoadTest Plugin并使用 LoadTestStarting 事件调用重新启动服务的方法。

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)
    {
        // Restart your service
    }

    void loadTest_LoadTestFinished(object sender, System.EventArgs e)
    {
    }
}

然后在负载测试编辑器中右键单击根目录并选择添加负载测试插件... 将插件添加到负载测试

关于visual-studio-2010 - VS2010负载测试: How can I perform custom action that is run once prior to each load test,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9990917/

相关文章:

dom中所有图像加载后jquery回调?

javascript - jQuery 不能在 Chrome 中 $(...).load() 标题

c# - 根据特定条件在列表末尾移动列表项的有效方法

scala - 在 akka 中测试定时器事件

swift - 无法在 xctest 中导入主应用程序模块

c# - 测试公共(public)交通消费者

c++ - 使用继承编译报错lnk2019和c4930

visual-studio-2010 - Visual Studio Intellisense无法正常工作

c# - Windows 服务启动然后立即停止

java - 读取纯文本文件