并行多次执行单个硒测试
Execute single selenium test multiple times in parallel
我想知道是否有人对简单的方法或并行多次执行单个 selenium 测试有任何建议。
我有 1 个测试要执行,然后它会启动 10 个 chrome 实例和 运行 并行测试 10 次,测试 load/performance.
我可以将测试分成单独的 类 并让它们并行进行 运行 但这有点矫枉过正,有没有更简单的方法 运行尼尼特?
测试是用 c# 编写的,我们在测试中使用 NUnit 运行我们正在使用 BDDfy 作为测试语言。
这个问题很难写下来,但希望有人能理解我想要实现的目标
你可以通过在同一个测试中添加多个测试用例来做到这一点,即使你没有任何参数传递给测试,并在 fixture 上使用 ParallelScope.All
到 运行 所有夹具内的测试用例并行。
[TestFixture, Parallelizable(ParallelScope.All)]
public class MyTestFixture
{
private static readonly IEnumerable<string> TestCases = new List<string>(new string[10]);
[TestCaseSource(nameof(TestCases))]
public void SingleTestRepeatedMultipleTimes(string testCase)
{
//test steps
}
}
我想知道是否有人对简单的方法或并行多次执行单个 selenium 测试有任何建议。
我有 1 个测试要执行,然后它会启动 10 个 chrome 实例和 运行 并行测试 10 次,测试 load/performance.
我可以将测试分成单独的 类 并让它们并行进行 运行 但这有点矫枉过正,有没有更简单的方法 运行尼尼特?
测试是用 c# 编写的,我们在测试中使用 NUnit 运行我们正在使用 BDDfy 作为测试语言。
这个问题很难写下来,但希望有人能理解我想要实现的目标
你可以通过在同一个测试中添加多个测试用例来做到这一点,即使你没有任何参数传递给测试,并在 fixture 上使用 ParallelScope.All
到 运行 所有夹具内的测试用例并行。
[TestFixture, Parallelizable(ParallelScope.All)]
public class MyTestFixture
{
private static readonly IEnumerable<string> TestCases = new List<string>(new string[10]);
[TestCaseSource(nameof(TestCases))]
public void SingleTestRepeatedMultipleTimes(string testCase)
{
//test steps
}
}