运行 .NETPortable NUnit 在 linux 上使用单声道进行测试
Running .NETPortable NUnit tests on linux with mono
我有一个 xamarin PCL 项目和一个 NUnit 项目。
我想 运行 mono-nunit docker 图像中的 NUnit 测试。
我 运行 测试:
nunit -framework=4.0 bin/Debug/MY_AppTests.dll
并得到:
.NETPortable test assemblies are not yet supported by the engine
这是决赛吗?有什么方法可以 运行 .NETProtale 测试 mono-nunit 图像中的程序集?
这不是最终版本,我们将很快将可移植(或更可能是 .NET Standard)支持添加到引擎中,希望是在 3.7 版本中。
同时,将您的测试项目切换为可执行文件,添加对 NUnitLite 的引用并将以下代码添加到 program.cs
public class Program
{
public static int Main(string[] args)
{
return new AutoRun(typeof(Program).GetTypeInfo().Assembly)
.Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
}
}
这将创建 self-executing 个测试。您可以传递通常传递给 NUnit 控制台的大多数命令行选项。
有关详细信息,请参阅 Testing .NET Core RC2 Using NUnit 3。除了.NET Core项目格式外,其他信息都是一样的。
我有一个 xamarin PCL 项目和一个 NUnit 项目。
我想 运行 mono-nunit docker 图像中的 NUnit 测试。
我 运行 测试:
nunit -framework=4.0 bin/Debug/MY_AppTests.dll
并得到:
.NETPortable test assemblies are not yet supported by the engine
这是决赛吗?有什么方法可以 运行 .NETProtale 测试 mono-nunit 图像中的程序集?
这不是最终版本,我们将很快将可移植(或更可能是 .NET Standard)支持添加到引擎中,希望是在 3.7 版本中。
同时,将您的测试项目切换为可执行文件,添加对 NUnitLite 的引用并将以下代码添加到 program.cs
public class Program
{
public static int Main(string[] args)
{
return new AutoRun(typeof(Program).GetTypeInfo().Assembly)
.Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
}
}
这将创建 self-executing 个测试。您可以传递通常传递给 NUnit 控制台的大多数命令行选项。
有关详细信息,请参阅 Testing .NET Core RC2 Using NUnit 3。除了.NET Core项目格式外,其他信息都是一样的。