nunit-2.5

Using PartCover 2.3 with .NET 4.0 runtime?

不羁岁月 提交于 2019-12-05 05:44:58
I've successfully got PartCover 2.3 working with VS 2008 on my 64-bit machine . I'm now trying to get it to work with VS 2010 and NUnit 2.5.3. I've got NUnit using the correct CLR version , but I can't get PartCover to produce any output. All I get is an "empty" report XML file: <PartCoverReport date="2010-03-30T16:09:05.1009099+01:00" /> How do I get PartCover 2.3 (or 2.2, I guess) to work with NUnit 2.5.3 on .NET 4.0? I have recently completed a portcover fork that will hook into the .NET4 CLR - maybe you could give that a try http://github.com/sawilde/partcover.net4 If you're not able to

Nunit parameterised TestFixtures with parameters set at runtime?

落爺英雄遲暮 提交于 2019-12-04 12:54:14
I'm interested in being able to instantiate multiple testfixtures with constructor arguments passed to it at runtime by a static method or property returning an IEnumerable. In Nunit 2.5 they introduced parameterised tests and test fixtures. These allow you to write a single test and run it with several inputs provided using the TestCase attribute, and write a single test class and instantiate multiple instances of it with different constructor arguments respectively. In addition to this, it is possible to create several test cases based on the output of a property or method, using the

NUnit. Passing parameters into teardown method

◇◆丶佛笑我妖孽 提交于 2019-12-04 03:58:33
I'm using NUnit. I have my test method defined likeso: [Test] [TestCase("Fred", "Bloggs")] [TestCase("Joe", "Smith")] public void MyUnitTest(string firstName, string lastName) { ... } After a TestCase has finished, it goes into the TearDown Method. What'd like to do, is have those TestCase parameters that are passed into the test method but also passed into the TearDown method. Something like this: [TearDown] public void TearDown(string firstName, string lastName) { ... } I'm hoping that NUnit supports this out-of-the-box. Otherwise, I need to write bespoke code in the test method to store the

What happended to nunit extensions/rowtest?

匆匆过客 提交于 2019-12-03 09:50:58
In NUnit 2.4.7, nunit.framework.extensions.dll was included which made it possible to do RowTests. When downloading the newest version (2.5.8) I can't find it. What happened to it? Instead of using RowTest , you can use TestCase . A previous testing using RowTest would look like: [RowTest] [Row("foo", false)] [Row("", true)] public void Some_test(string value, bool expected) { // test } And the same thing with TestCase looks like this: [TestCase("foo", false)] [TestCase("", true)] public void Some_test(string value, bool expected) { // test } RowTest was an extension that was merged in

NUnit - cleanup after test failure

雨燕双飞 提交于 2019-11-30 10:55:19
问题 We have some NUnit tests that access the database. When one of them fails it can leave database in inconsistent state - which is not an issue, since we rebuild database for every test run - but it can cause other tests to fail in the same run. Is it possible to detect that one of the tests failed and perform some sort of cleanup? We don't want to write cleanup code in every test, we already do that now. I'd like to perfrom cleanup in Teardown but only if test failed, as cleanup might be

Why do my tests fail when run together, but pass individually?

有些话、适合烂在心里 提交于 2019-11-30 06:47:52
When I write a test in Visual Studio, I check that it works by saving, building and then running the test it in Nunit (right click on the test then run). The test works yay... so I Move on... Now I have written another test and it works as I have saved and tested it like above. But, they dont work when they are run together. Here are my two tests that work when run as individuals but fail when run together: using System; using NUnit.Framework; using OpenQA.Selenium.Support.UI; using OpenQA.Selenium; namespace Fixtures.Users.Page1 { [TestFixture] public class AdminNavigateToPage1 :

Data-driven testing in NUnit?

你。 提交于 2019-11-30 02:41:53
In MSTest you can do something like: [TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "testdata.csv", "testdata#csv", DataAccessMethod.Sequential)] public void TestSomething() { double column1 = Convert.ToDouble(TestContext.DataRow["column1"]); ... Assert.AreEqual(...); } What is the equivalent code in NUnit 2.5? I would look at the parameterized tests documentation in NUnit 2.5 and see if you can do something like what you're doing there. I do not recall NUnit having a built-in CSV reading attribute to drive parameterized tests. There may be a community plug-in

NUnit - cleanup after test failure

梦想的初衷 提交于 2019-11-29 22:51:15
We have some NUnit tests that access the database. When one of them fails it can leave database in inconsistent state - which is not an issue, since we rebuild database for every test run - but it can cause other tests to fail in the same run. Is it possible to detect that one of the tests failed and perform some sort of cleanup? We don't want to write cleanup code in every test, we already do that now. I'd like to perfrom cleanup in Teardown but only if test failed, as cleanup might be expensive. Update : To clarify - I would like tests to be simple and NOT include any cleanup or error

NUnit extension

杀马特。学长 韩版系。学妹 提交于 2019-11-29 14:27:25
Hi All i have a question regarding NUnit Extension (2.5.10). What i am trying to do is write some additional test info to the database. For that i have created NUnit extension using Event Listeners. The problem i am experiencing is that public void TestFinished(TestResult result) method is being called twice at runtime. And my code which writes to the database is in this method and that leaves me with duplicate entries in the database. The question is: Is that the expected behaviour? Can i do something about it? The extension code is below. Thanks. using System; using NUnit.Core; using NUnit

Initialize log4Net as early as possible with NUnit

心已入冬 提交于 2019-11-29 12:24:35
I'm wondering what is the best way to initialize log4Net in a NUnit project. Of course I want to call the init code (ie. XmlConfigurator.Configure() ) as soon as I can to get as many early log output as I can. But since my project is run through NUnit, I have little control on its entry point. According to NUnit documentation, it should call some constructors first, then a method marked with the [SetUp] attribute in a class marked with [TestFixtureSetup] . So, First, I created a static helper class which I can call several times without trouble. public static class LoggingFacility { private