简体   繁体   中英

Run Nunit tests using teamcity on deployed site

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM