gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 20:09:20 25 4
gpt4 key购买 nike

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

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

最佳答案

创建一个 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)
{
}
}

然后在负载测试编辑器中右键单击根并选择 Add Load Test Plug-in... 将插件添加到您的Load Test

关于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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com