nunit

How to teach SpecFlow to add additional NUnit attributes to my test class

南笙酒味 提交于 2020-01-12 07:45:08
问题 SpecFlow is great - and it helps us very much to do proper integration testing. One thing I was wondering is whether there's a way to tell SpecFlow to add additional NUnit attributes to the test class it creates in the feature code-behind file. Right now, my test class gets generated something like this: [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.8.1.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit

Test Explorer (VS) shows '<Unknown project>'

旧巷老猫 提交于 2020-01-12 06:27:06
问题 Everthing below is made in VS2019, using .NET Framework 4.7 and NUnit + NUnit3TestAdapter I created an assembly called Exitus.Tests, and added a few unit tests. However, do to some issues with Nuget, that I could not solve, I made another project called Exitus.UnitTests and removed the once file I had in the old project (including changing the namespace). Now the new test project showed op correctly in the explorer, but a "ghost" of the old project remained: If I try to run the test, the

Test Explorer (VS) shows '<Unknown project>'

谁都会走 提交于 2020-01-12 06:24:08
问题 Everthing below is made in VS2019, using .NET Framework 4.7 and NUnit + NUnit3TestAdapter I created an assembly called Exitus.Tests, and added a few unit tests. However, do to some issues with Nuget, that I could not solve, I made another project called Exitus.UnitTests and removed the once file I had in the old project (including changing the namespace). Now the new test project showed op correctly in the explorer, but a "ghost" of the old project remained: If I try to run the test, the

How to Configure Specflow 3.0.199 with NUnit 3.11?

蓝咒 提交于 2020-01-11 13:57:45
问题 I have done this a couple of times before, but it's not working today. Am I missing something? I want to configure Specflow from the scract, using NUnit and to execute inside Visual Studio. I've seen many tutorials but they are not working to me :P. I'm trying to use the latest versions. These are the steps I'm doing on Visual Studio 2017: Create a test project (.NET Framework) Install Specflow plugin for Visual Studio (Tools > Extensions and Updates) Delete reference of MSTests from the

NullReferenceException when using NUnit

巧了我就是萌 提交于 2020-01-11 12:34:03
问题 I'm trying to set up unit tests for a card game application, but my code is throwing a NullReferenceException: Object reference not set to an instance of an object. As far as I can tell I should not be getting this error, but there it is. Here is my code: [TestFixture] public class Tests { CardTable aTable = null; [SetUp] public void setup() { aTable = new CardTable(); } [Test] public void setPlayerGold_setTo0_return0() { //arrange //act aTable.setPlayerGold(0); //assert Assert.AreEqual(0,

Configuring the NUnit command line to run MonoTouch tests

。_饼干妹妹 提交于 2020-01-11 12:22:33
问题 I've got a unit test in my MonoTouch project that I can't run from inside MonoDevelop -- it fails with "Unix transport error." Poking around on the web it looks like that's associated with the NUnit test runner blowing up, so I thought I'd try using the command-line test runner. I used MonoDevelop's "Create Package" to build and package up all the DLLs, and then tried running my tests with nunit-console FooTest.dll . This blows up, but I'm pretty sure it's not for the same reason it blows up

Issue with MvcContrib TestHelper Fluent Route Testing and Specific HttpVerbs

ぐ巨炮叔叔 提交于 2020-01-11 10:48:42
问题 I'm attempting to use the MvcContrib TestHelper fluent route testing API, but I'm seeing odd behavior. The .WithMethod(HttpVerb) extension method does not seem to be executing as expected. Here's my controller showing (2) actions (identically named) that accept different HttpVerbs: [HttpGet] public ActionResult IdentifyUser() { return View(new IdentifyUserViewModel()); } [HttpPost] public ActionResult IdentifyUser(IdentifyUserInputModel model) { return null; } And here is the test that should

Attempting to run multiple Selenium Webdriver tests using Nunit fails

冷暖自知 提交于 2020-01-11 07:37:30
问题 I was wondering if anyone could help me here. I'm using selenium Webdriver with C# and Nunit, and when I'm attempting to run multiple tests, I'm getting the following error: OpenQA.Selenium.WebDriverException : Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:7055 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,

How do you instruct NUnit to load an assembly's dll.config file from a specific directory?

做~自己de王妃 提交于 2020-01-10 18:01:07
问题 If an assembly contains an app.config file, ConfigurationManager will load it as long as it is in the same directory as the NUnit project that is executing through NUnit-Gui. To illustrate consider the following folder structure. + TestFolder testProject.nunit + AssemblyAFolder assemblyA.dll assemblyA.dll.config + AssemblyBFolder assemblyB.dll assemblyB.dll.config Both AssemblyA and AssemblyB exercise code that calls into ConfigurationManager . If I run these test assemblies independently in

How to make NUnit stop executing tests on first failure

≯℡__Kan透↙ 提交于 2020-01-10 02:30:21
问题 We use NUnit to execute integration tests. These tests are very time consuming. Often the only way to detect a failure is on a timeout. I would like the tests to stop executing as soon as a single failure is detected. Is there a way to do this? 回答1: This is probably not the ideal solution, but it does what you require i.e. Ignore remaining tests if a test has failed. [TestFixture] public class MyTests { [Test] public void Test1() { Ascertain(() => Assert.AreEqual(0, 1)); } [Test] public void