gpt4 book ai didi

c# - 平台不支持异常 : The following constructor parameters did not have matching fixture data

转载 作者:行者123 更新时间:2023-11-30 12:54:42 25 4
gpt4 key购买 nike

我用 dotnet core 2 写了一些测试。这个测试驱动了一些 Selenium 的浏览器。我在本地开发了第一个测试(使用 dotnet core 2.0 和 xunit),它运行得非常棒。

然后我将该项目移至 Azure DevOps 管道,但出现此错误:

System.PlatformNotSupportedException : Operation is not supported on this platform.

The following constructor parameters did not have matching fixture data

在本地开发(一个简单的 VS Code 编辑器)中,似乎有人会像这样自动在构造函数中注入(inject)一个 Fixture:

public AConstructor(TestFixture tf)
{
this.tf = tf;
}

所以我大致改写为:

public AConstructor(TestFixture tf)
{
this.tf = new TestFixture();
}

但问题仍然存在,我不知道问题出在哪里。在本地开发中,我们使用与真实网格相同版本的 Docker 设置了 Selenium Grid。在 Azure DevOps 管道中,我们重用了在本地环境中使用的示例命令。

有什么想法吗?

最佳答案

当我这样做时,我通常会这样构造它:

public class TestClass
{
protected TestFixture testFixture { get; set; }

public TestClass(TestFixture testFixture)
{
this.testFixture = testFixture;
}
}

这允许您创建一个本地实例以用于您的代码。

试试这个,让我知道它是否适合你。

关于c# - 平台不支持异常 : The following constructor parameters did not have matching fixture data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53836213/

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