nunit-3.0

Selenium Parallel testing with extension methods

天涯浪子 提交于 2019-12-12 19:52:01
问题 I have configured tests to run in parallel in Selenium with Nunit which works fine but I'm not sure how to add a custom method into the mix without a second instance of the browser opening and breaking the test. I have the Base: namespace ParallelTests { public class Base { public IWebDriver Driver { get; set; } } } ...and the Hooks: public class Hooks : Base { public Hooks() { Driver = new ChromeDriver(@"D:\Data\user\Documents\Visual Studio 2012\Projects\ParallelTests\ParallelTests\bin"); }

Passing an argument to TestFixture OneTimeSetUp From SetUpFixture

让人想犯罪 __ 提交于 2019-12-12 19:04:44
问题 I'm currently building an automation project using C#, nunit and Selenium and I'm trying to have a setup class that will initialize the selenium webdriver before any TestFixture will run and after all of them have ended and trying to get that webdriver from the TestFixture in each TestFixture OneTimeSetUp attribute, can it be done or should I change the selenium class to static in order to be able to get the driver field in each TestFixture setup? so the basic structure is this: [SetUpFixture

NUnit not looking the file in the right folder

送分小仙女□ 提交于 2019-12-11 13:38:54
问题 I just updated nUnit from 2.6.4 to 3.0.1 on my VS2015. Everything went well with just ONE problem. In my Test method, I have to load a xml file, let's call it UnitTestConfiguration.xml , it is saved inside the same root folder as the app.Config and package.Config file. With NUnit 2.6.4, this xml file is being found and load perfectly. But, with Nunit 3.0.1, I receive this error: System.IO.FileNotFoundException : Could not find file 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7

NUnit Multiple TestFixture with different Category attribute

百般思念 提交于 2019-12-11 00:49:38
问题 I have a test class with multiple TestFixture and I want to provide different category per testfixture like: [TestFixture("WebsiteA"), Category("A")] [TestFixture("WebsiteB"), Category("B")] public class LoginTests { public LoginTests(string websiteName) { } [Test] //test } When I am running test with nunit3-console runner giving stating --where "cat==A" then it still run the test method for both websites. Is there a way to run test for just one category in this kind of model? 回答1: You have a

Run all tests in namespace using Nunit3-console.exe

妖精的绣舞 提交于 2019-12-11 00:34:09
问题 After pouring over the NUnit 3 documentation on Test Selection Language and trying a few combinations, I still cannot figure out how to run all the tests within a specific namespace. The most obvious attempt being: nunit3-console.exe --where "test == 'MyNamespace.Subnamespace'" Tests.dll Unfortunately, this reports zero matching tests, although using the --explore options I can see many tests within that namespace. Do I need to use regular expression/wildcards to accomplish this? The NUnit

NUnit 3: OneTimeSetUp doesn't fire

﹥>﹥吖頭↗ 提交于 2019-12-07 00:57:28
问题 In NUnit 3, they've replaced the attribute "TestFixtureSetUp" with "OneTimeSetUp". However, it doesn't actually seem to work, unless I'm being a complete idiot. This is my code below: [TestFixture] public class DiskServiceTests { private readonly Mock<IDriveInfoWrapper> _driveInfoWrapper = new Mock<IDriveInfoWrapper>(); private IDiskService _diskService; [OneTimeSetUp] public void Init() { _diskService = new DiskService(_driveInfoWrapper.Object); } [Test] public void GetDriveInfo

Unit Tests failing when I Run All Tests but pass when I Debug

走远了吗. 提交于 2019-12-06 20:41:48
问题 I'm using NUnit3 in Visual Studio 2017 and doing TDD. Something really strange is happening since I updated my code to make my latest test pass. Now, 3 of my other tests are failing when I click Run All Tests, as below: It is telling me that the actual and expected values in my Assert method are not equal. However, when I put a breakpoint at the line where the Assert method is and start debugging, the stacktrace is showing that expected and actual are the same value and then the test passes,

Are there any ways to create HTML report for NUnit3?

佐手、 提交于 2019-12-06 08:24:08
问题 I saw several solutions for NUnit 2.x version. For example, I can create XSLT, or use Allure Reporter. But how can I do it for NUnit 3.x version (without writing my own XSLT for NUnit XML results)? Allure does not work with NUnit3. 回答1: I would suggest using GHPReporter. You can create reports for NUnit 3, SpecFlow and MSTest. No additional attributes required for NUnit 3. Just set up addin (see short instruction in README file: https://github.com/GHPReporter/Ghpr.NUnit) and run your tests

NUnit 3: OneTimeSetUp doesn't fire

陌路散爱 提交于 2019-12-05 04:43:42
In NUnit 3, they've replaced the attribute "TestFixtureSetUp" with "OneTimeSetUp". However, it doesn't actually seem to work, unless I'm being a complete idiot. This is my code below: [TestFixture] public class DiskServiceTests { private readonly Mock<IDriveInfoWrapper> _driveInfoWrapper = new Mock<IDriveInfoWrapper>(); private IDiskService _diskService; [OneTimeSetUp] public void Init() { _diskService = new DiskService(_driveInfoWrapper.Object); } [Test] public void GetDriveInfo_ShouldReturnDriveInfo() { // Act var result = _diskService.GetDriveInfo(); // Assert Assert.IsNotNull(result); } }

How to install nUnit 3 nunit3-console.exe in TeamCity 9.x

穿精又带淫゛_ 提交于 2019-12-03 16:53:44
问题 NUnit 3.0 is supported by TeamCity 9.1.x now however you have to install the runner and specify the path to the nunit3.console.exe in the step. My question is where do I copy the nunit3-console.exe? Do I have to put this on all the agents? Do I put it in a directory on my main TeamCity server and it will get shared or pulled by the agents? There doesn't seem to be good documentation on where to copy these files so that all the agents can use them. 回答1: You should have the NUnit console on the