使用Fake构建和测试ASP.NET 5 / MVC 6应用程序?

时间:2021-03-23 03:38:09

I am attempting to use FAKE to build and test a solution that includes an ASP.NET 5 / MVC 6 site (beta 8) and a unit test project for the site. I'm using the latest xUnit and have set up the xunit.runner.dnx command in my unit test project. Visual Studio can see the tests and run them without issue.

我正在尝试使用FAKE构建和测试包含ASP.NET 5 / MVC 6站点(beta 8)和该站点的单元测试项目的解决方案。我正在使用最新的xUnit并在我的单元测试项目中设置了xunit.runner.dnx命令。 Visual Studio可以查看测试并毫无问题地运行它们。

Using FAKE I've been able to get standard xUnit tests to run, but I'm unsure how to properly compile the site and run the DNX tests. If it matters, I'm targeting the full CLR, not just CORECLR.

使用FAKE我已经能够运行标准的xUnit测试,但我不确定如何正确编译站点并运行DNX测试。如果重要的是,我的目标是完整的CLR,而不仅仅是CORECLR。

2 个解决方案

#1


0  

What they basically do is create a DNX command that will run the unit tests in the context of a command line. You can see how they did it there.

他们基本上做的是创建一个DNX命令,它将在命令行的上下文中运行单元测试。你可以看到他们是如何做到的。

Now... if you want to run this in the context of Visual Studio, it's already built-in with MSTest Runner (haven't managed to make it work with ReSharper).

现在......如果你想在Visual Studio的上下文中运行它,它已经内置了MSTest Runner(还没有设法让它与ReSharper一起工作)。

If you want to run the tests in command line mode, go to your test project folder (with project.json in there) and run dnx test.

如果要在命令行模式下运行测试,请转到测试项目文件夹(其中包含project.json)并运行dnx test。

As far as compilation goes, Roslyn will take care of it and you do not need to emit DLLs.

就编译而言,Roslyn会处理它,你不需要发出DLL。

#2


0  

Take a look at https://github.com/djanosik/FAKEX. It was designed to do FAKE builds on DNX.

看看https://github.com/djanosik/FAKEX。它被设计为在DNX上进行FAKE构建。

#1


0  

What they basically do is create a DNX command that will run the unit tests in the context of a command line. You can see how they did it there.

他们基本上做的是创建一个DNX命令,它将在命令行的上下文中运行单元测试。你可以看到他们是如何做到的。

Now... if you want to run this in the context of Visual Studio, it's already built-in with MSTest Runner (haven't managed to make it work with ReSharper).

现在......如果你想在Visual Studio的上下文中运行它,它已经内置了MSTest Runner(还没有设法让它与ReSharper一起工作)。

If you want to run the tests in command line mode, go to your test project folder (with project.json in there) and run dnx test.

如果要在命令行模式下运行测试,请转到测试项目文件夹(其中包含project.json)并运行dnx test。

As far as compilation goes, Roslyn will take care of it and you do not need to emit DLLs.

就编译而言,Roslyn会处理它,你不需要发出DLL。

#2


0  

Take a look at https://github.com/djanosik/FAKEX. It was designed to do FAKE builds on DNX.

看看https://github.com/djanosik/FAKEX。它被设计为在DNX上进行FAKE构建。