How to use NUnit GUI with C # / ASP.NET website?

I have a C # / ASP.NET site with some code files (* .cs) in the App_Code directory. I would like to test them using NUnit. I wrote a test file with the corresponding [TestFixture] and [Test] annotations and posted it here: App_Code / Test / TestClassName.cs.

I download the NUnit GUI to run it, but it wants me to select the .exe or .dll file. There is not one in the bin folder of my project. My project starts and builds successfully, and that’s all, but still not an exe or dll file. How can I get NUnit Gui to just run a test in this class?

+3
source share
3 answers

, .

, , Business.UnitTest(, nUnit, , ). -, App_Code, "". Business.UnitTest -. nUnit ( , nUnit -, , 100%).

-, - -. , , .

+3

.NET Website , , . , , , , NUnit .exe .dll .

- - ; , -. -, , -. , , (.dll) (.exe). NUnit , .

, ; - , . , ​​ . - , .

, - , , . NUnit . - , NUnit .

+2
  • . - , InternalsVisibleToAttribute, , "" . , Assembly.info "" .

  • "" .

  • , (assembly.dll);

  • Open TestsProjectAssembly.dllNUnit from your GUI, making sure that you are browsing the desired folder;

  • You may also want the NUnit GUI to reload your assembly each time you run tests (there is an option for this in the options properties);

  • Run the tests.

Make absolutely sure that your path or folder for viewing is the one in which your test project is created.

0
source

Source: https://habr.com/ru/post/1746604/


All Articles