Run Nunit tests using teamcity on deployed site

2019-06-14 11:28发布

I have configured TeamCity with Git to get my ASP.NET MVC project. I added tests with NUnit as the last step.

But one test checks method which works only on the machine where my project is deployed (access restriction peculiarity).

So test fails because it tests code that is being deployed on TeamCity deploying agent machine. I have to run tests against deployed environment somehow.

Can I somehow make my tests check functionality of projects on the deployed to machine site or run dll with tests from the directory where the site has been deployed to?

1条回答
等我变得足够好
2楼-- · 2019-06-14 11:50

One approach would be to mark that test [Explicit] so that it only runs if you select it. That would basically mean you could only run it manually.

Another approach is to use a unique category on that test and exclude it in your TC runs. When you don't exclude it on the command-line, it will be run.

You could combine the two approaches as [Explicit, Category("Deployed")] if you like. In that case, you would have to include the Deployed category in your run using the --include option in NUnit V2 or --where in NUnit V3.

查看更多
登录 后发表回答