Search Results

Search found 582 results on 24 pages for 'nunit addins'.

Page 5/24 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Do I need something more to run NUnit under any directory?

    - by prosseek
    I have NUnit installed at this directory. C:\Program Files\NUnit 2.5.5\bin\net-2.0 When I try to run my unit test (mut.dll) in some random directory. I get the following error. I have to copy the mut.dll under the NUnit directory in order to run it. ProcessModel: Default DomainUsage: Single Execution Runtime: net-2.0 Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=n eutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cannot find the file specified. What's wrong? Is there anything that I have to configure to run NUNit under any directory?

    Read the article

  • Why does trying to unit test with two .NET 4.0 assemblies under NUnit 2.5.4 fail?

    - by GiddyUpHorsey
    I have an MSBuild script that uses NUnit to run tests in two assemblies. These were on .NET Framework 3.5 and it worked perfectly for a long time. The command line was: (actual paths & names simplified) nunit-console tests1\bin\debug\tests1.dll tests2\bin\tests2.dll I've upgraded to VS2010 and have now made the two test assemblies target .NET 4.0. I've also upgraded to NUnit 2.5.4. I can unit test a single assembly with the following: nunit-console tests1\bin\debug\tests1.dll /framework=4.0.30319 It works fine with either tests1.dll or tests2.dll. If I try to specify both like before, it now fails. nunit-console tests1\bin\debug\tests1.dll tests2\bin\debug\tests2.dll /framework=4.0.30319 The error is: Could not load file or assembly 'tests2' or one of its dependencies. The system cannot find the file specified. I've had a look in fuslogvw and it shows tests2 being searched for in the tests1\bin\debug and nunit-console folders. It never searches tests2\bin\debug even though it's specified on the command line. What's up with that?

    Read the article

  • NUnit vs. MsTest: NUnit wins for Unit Testing.

    People are still wondering what are the differences between the two most popular unit testing frameworks in the .NET world: the open source NUnit and the commercial MsTest). Heres a short list of what i remember instantly: Nunit contains a [TestCase] attribute that allows implementing parametrized tests. this does not exist in msTest MsTest's ExpectedException attribute has a bug where the expected message is never really asserted even if it's wrong - the test will pass. Nunit has an...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Registering NUnit DynamicMock Instances in a UnityContainer

    - by Phil
    I'm somewhat new to Unity and dependency injection. I'm trying to write a unit test that goes something like this: [Test] public void Test() { UnityContainer container = new UnityContainer(); DynamicMock myMock = new DynamicMock(typeof(IMyInterface)); container.RegisterInstance(typeof(IMyInterface), myMock.MockInstance); //Error here // Continue unit test... } When this test executes, the container throws an ArgumentNullException inside the RegisterInstance method with the message Value cannot be null. Parameter name: assignmentValueType. The top line of the stack trace is at Microsoft.Practices.Unity.Utility.Guard.TypeIsAssignable(Type assignmentTargetType, Type assignmentValueType, String argumentName). Why can't I register a MockInstance with the UnityContainer, and how do I work around this?

    Read the article

  • How to access project files from NUnit tests

    - by Daren Thomas
    I have some Tests that I run with ReSharpers "Run All Tests from Solution" feature. One of the classes being tested has a dependency on a file in the same folder as the assembly containing it. This file is copied to the output directory via MSBuild (set "Copy To Output Directory" to "Copy always"). Problem: The tests are not being run from the normal assembly output directory, but instead some temporary location in my user profile. Therefore, I don't really know where to look for the file - the test runner does not copy it there. Can I force it to?

    Read the article

  • How to generate NUnit fixtures programmatically?

    - by pmezard
    Hello, Say I have a test like: void TestSomething(int someParam) { // Test code } I would like to execute this test with a set of "someParam" values. I could write explicit [Test] fixtures calling TestSomething() with the parameters, which means having N methods for every TestSomething() method. I could write another [Test] method looping on "someParam" values and calling TestSomething(), it means 2 methods for every test, and the test report is not as good as with individual TestSomethingWithXValue() methods. So, is there any way to programmatically generate fixtures for every test methods and input values?

    Read the article

  • NUnit doesn't work well with Assert.AreEqual

    - by stasal
    Hi! I'm new to unit-testing and NUit in particular. I'm just typing some examples from the book which refers to Java and JUnit. But I'm using C# instead. The problem is: I've got a class with overriden methods such as Equals() and GetHashCode(), but when I am trying to compare two objects of this class with Assert.AreEqual() my code is not called, so I get an exception. Assert.True(MyClass.Equals(MyClass2)) does work well. But I don't wanna use this construction instead of Assert.AreEqual(). Where the problem can be? Here is the class: public class Money { public int amount; protected string currency; public Money(int amount, string currency) { this.amount = amount; this.currency = currency; } public new bool Equals(object obj) { if (obj == null) return false; Money money = (Money)obj; return (amount == money.amount) && (Currency().Equals(money.Currency())); } public new int GetHashCode() { return (string.Format("{0}{1}", amount, currency)).GetHashCode(); } public static Money Dollar(int amount) { return new Money(amount, "USD"); } public static Money Franc(int amount) { return new Money(amount, "CHF"); } public Money Times(int multiplier) { return new Money(amount * multiplier, currency); } public string Currency() { return currency; } } And the test method itself: [TestFixture] public class DollarTest { [Test] public void TestMultiplication() { Money five = Money.Dollar(5); Assert.True(Money.Dollar(10).Equals(five.Times(2))); // ok Assert.AreEqual(Money.Dollar(10), five.Times(2)); // fails } } Thanks.

    Read the article

  • NUnit: Assert.Throws

    - by epitka
    How do I use Assert.Throws to assert type of the exception and the actual message workding. Something like this: Assert.Throws<Exception>( ()=>user.MakeUserActive()).WithMessage("Actual exception message") Method I am testing throws multiple messages of the same type, with different message and I need a way to test that correct message is thrown depending on the context.

    Read the article

  • NUnit Assert a list of objects in no order

    - by Shawn Mclean
    How do I Assert a collection of items in no particular order? I just want to make sure all the items are in the list. I'm heard of CollectionAssert but I do not see any method that would do what I want. My object looks like this: public class Vector2{ public float X {get; set;} public float Y {get; set;} } Assert - I want something like this: CollectionAssert.ContainsAll(mesh.GetPolygonVertices(0), aListOfVertices); mesh.GetPolygonVertices(int) returns a List<Vector2> and aListOfVertices contains all of what is returned, but not guaranteed that order.

    Read the article

  • How do I simplify these NUNit tests?

    - by Lucas Meijer
    These three tests are identical, except that they use a different static function to create a StartInfo instance. I have this pattern coming up all trough my testcode, and would love to be be able to simplify this using [TestCase], or any other way that reduces boilerplate code. To the best of my knowledge I'm not allowed to use a delegate as a [TestCase] argument, and I'm hoping people here have creative ideas on how to make the code below more terse. [Test] public void ResponseHeadersWorkinPlatform1() { DoResponseHeadersWorkTest(Platform1StartInfo.CreateOneRunning); } [Test] public void ResponseHeadersWorkinPlatform2() { DoResponseHeadersWorkTest(Platform2StartInfo.CreateOneRunning); } [Test] public void ResponseHeadersWorkinPlatform3() { DoResponseHeadersWorkTest(Platform3StartInfo.CreateOneRunning); } void DoResponseHeadersWorkTest(Func<ScriptResource,StartInfo> startInfoCreator) { ScriptResource sr = ScriptResource.Default; var process = startInfoCreator(sr).Start(); //assert some things here }

    Read the article

  • Combining RequiresSTA and Timeout attributes on a test fails

    - by Peter Lillevold
    I have a test that opens and closes a WPF Window and thus requires the STA threading apartment. To safeguard the test against the window staying open (and thus hang the test indefinitely) I wanted to use the Timeout attribute. The problem is that applying the Timeout attribute causes the test to fail on timeout regardless of whether the test works or not. Without the attribute everything works fine. My theory is that Timeout causes the test to be executed on a new thread that does not inherit the STA apartment. Is there another way to have both STA and the timeout safeguard in NUnit? My test looks something like this: [Test, RequiresSTA, Timeout(300)] public void Construct() { var window = new WindowView(); window.Loaded += (sender, args) => window.Close(); var app = new Application(); app.Run(window); try { // ...run system under test } finally { app.Shutdown(); } }

    Read the article

  • How do I get Nunit to run selenium tests against different servers?

    - by Jon
    I have an Nunit test which uses selenium RC to run tests against our UI. I want to run the tests against 2 different servers, which means having the call to selenium.open() with 2 different servers. However, I don't want to have 2 different Nunit test suites that do the same thing but against different servers. I need a way of passing parameters from Nant or the Nunit driver program to specific which server to test against. Is there anyway to do this?

    Read the article

  • How do I explain the importance of NUNIT Test cases to my Colleagues [duplicate]

    - by JNL
    This question already has an answer here: How to explain the value of unit testing 6 answers I am currently working in Software Development for applications including lot of Mathematical Calculations. As a result there are lot of test cases that we need to consider. We donot have any NUNIT Test case system, I am wonderring how should I get the advantages of implementing the NUNIT testing in front of my colleagues and my boss. I am pretty sure, it would be of great help for our team. Any help regarding the same, will be higly appreciated.

    Read the article

  • What is the best unit test framework for .NET and why?

    - by rmx
    It seems to me that everyone uses NUnit without even considering the other options. I think this is because: Everyone is familiar with it already so they won't have to learn a new API. It is already set up with their continuous integration server to work with NUnit. Am I wrong about this? I decided to use xUnit on one of my own projects recently and I love it! It makes so much more sense to me and conceptually it seems like a definite step forward from NUnit. I'd like to hear opinions on which framework is actually the best - not taking into consideration having to learn it or reconfigure your automated testing.

    Read the article

  • NUnit - Multiple properties of the same name? Linking to requirements

    - by Ryan Ternier
    I'm linking all our our System Tests to test cases and to our Requirements. Every requirement has an ID. Every Test Case / System Tests tests a variety of requirements. Every module of code links to multiple requirements. I'm trying to find the best way to link every system test to its driving requirements. I was hoping to do something like: [NUnit.Framework.Property("Release", "6.0.0")] [NUnit.Framework.Property("Requirement", "FR50082")] [NUnit.Framework.Property("Requirement", "FR50084")] [NUnit.Framework.Property("Requirement", "FR50085")] [TestCase(....)] public void TestSomething(string a, string b...) However, that will break because Property is a Key-Value pair. The system will not allow me to have multiple Properties with the same key. The reason I'm wanting this is to be able to test specific requirements in our system if a module changes that touches these requirements. Rather than run over 1,000 system tests on every build, this would allow us to target what to test based on changes done to our code. Some system tests run upwards of 5 minutes (Enterprise healthcare system), so "Just run all of them" isn't a viable solution. We do that, but only before promoting through our environments. Thoughts?

    Read the article

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

    - by Amber Shah
    I have a C#/ASP.NET website that has some code (*.cs) files in the App_Code directory. I would like to test them using NUnit. I have written a test file with the proper [TestFixture] and [Test] annotations and have put it here: App_Code/Test/TestClassName.cs. I load up the NUnit GUI to run it but it wants me to select a .exe or .dll file. There is none in the bin folder of my project. My project does successfully run and is built and everything, but still no exe or dll file. How can I get the NUnit Gui to just run the test in that class?

    Read the article

  • How do I pass a function to NUnit Throws.Constraints?

    - by Serge Belov
    I'm trying to write some NUnit tests in F# and having trouble passing a function to the ThrowsConstraint. A distilled (non)working sample is below. open System.IO open NUnit.Framework [<TestFixture>] module Example = [<Test>] let foo() = let f = fun () -> File.GetAttributes("non-existing.file") Assert.That(f, Throws.TypeOf<FileNotFoundException>()) This compiles just fine but I get the following from the NUnit test runner: FsTest.Tests.Example.foo: System.ArgumentException : The actual value must be a TestDelegate but was f@11 Parameter name: actual While I'm able to work around the problem using ExpectedException attribute, my question is what is the correct way of using an F# function in this situation?

    Read the article

  • Why I love NUnit, NCover, CC Nant and friends

    - by gregarobinson
    I have used these opensource tools on past projects in different stages, but never all of them at once. I am on a project now where there is a build server, Subversion, Nant, NUnit with 100% NCover required coverage, CrusieControl, CCTray and Rhino Mockc.I was extending an Interface and concrete class in a solution I had never worked on before today. Automatic builds were turned off for the day for a special case QA test. I added my new members to the Interface, implemented them in the concrete class, did a local build, tested, all looked good, so I did a Subversion Update then Commit.  Around 4:30PM the automatic builds were turned back on. Right away the build failed for less than 100% code coverage on my last Commit. Turns out there was a project in the solution I modified that had numerous NUnit tests on the Interface/Concrete class I modified, 3 of which now failed. Now that is cool..of course i was frustrated as i wanted to go home..but..I did a bad thing..I did not run nant on the source prior to my Commit. Lesson learned, and a great lesson at that!   

    Read the article

  • How do I test database-related code with NUnit?

    - by Michael Haren
    I want to write unit tests with NUnit that hit the database. I'd like to have the database in a consistent state for each test. I thought transactions would allow me to "undo" each test so I searched around and found several articles from 2004-05 on the topic: http://weblogs.asp.net/rosherove/archive/2004/07/12/180189.aspx http://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx http://davidhayden.com/blog/dave/archive/2004/07/12/365.aspx http://haacked.com/archive/2005/12/28/11377.aspx These seem to resolve around implementing a custom attribute for NUnit which builds in the ability to rollback DB operations after each test executes. That's great but... Does this functionality exists somewhere in NUnit natively? Has this technique been improved upon in the last 4 years? Is this still the best way to test database-related code? Edit: it's not that I want to test my DAL specifically, it's more that I want to test pieces of my code that interact with the database. For these tests to be "no-touch" and repeatable, it'd be awesome if I could reset the database after each one. Further, I want to ease this into an existing project that has no testing place at the moment. For that reason, I can't practically script up a database and data from scratch for each test.

    Read the article

  • Is NUnit's ExpectedExceptionAttribute only way to test if something raises an exception?

    - by Dariusz Walczak
    Hello, I'm completely new at C# and NUnit. In Boost.Test there is a family of BOOST_*_THROW macros. In Python's test module there is TestCase.assertRaises method. As far as I understand it, in C# with NUnit (2.4.8) the only method of doing exception test is to use ExpectedExceptionAttribute. Why should I prefer ExpectedExceptionAttribute over - let's say - Boost.Test's approach? What reasoning can stand behind this design decision? Why is that better in case of C# and NUnit? Finally, if I decide to use ExpectedExceptionAttribute, how can I do some additional tests after exception was raised and catched? Let's say that I want to test requirement saying that object has to be valid after some setter raised System.IndexOutOfRangeException. How would you fix following code to compile and work as expected? [Test] public void TestSetterException() { Sth.SomeClass obj = new SomeClass(); // Following statement won't compile. Assert.Raises( "System.IndexOutOfRangeException", obj.SetValueAt( -1, "foo" ) ); Assert.IsTrue( obj.IsValid() ); } Edit: Thanks for your answers. Today, I've found an It's the Tests blog entry where all three methods described by you are mentioned (and one more minor variation). It's shame that I couldn't find it before :-(.

    Read the article

  • Converting NUnit tests to MSUnit.

    - by TATWORTH
    I created the MSTest project by creating a new class library project and copying the test classes to it. I then followed the instructions in the following posts.http://social.msdn.microsoft.com/Forums/en/vststest/thread/eeb42224-bc1f-476d-98b4-93d0daf44aadhttp://dangerz.blogspot.co.uk/2012/01/converting-nunit-to-mstest.htmlHowever I did not need to add the GUID fix as I used ReSharper to run both sets of tests.

    Read the article

  • Selenium/NUnit run one test on multiple IP addresses.

    - by Matt Clarkson
    I have a test suite DLL written in C# that uses Selenium.This is then loaded into NUnit and tests can be performed on our embedded web server boards. Does anyone know how to run a NUnit Selenium test on multiple IPs in multiple browsers? I have tried creating multiple DefaultSelenium classes but they point to the same Internet Explorer window. I need multiple instances of the Selenium RC controlling individual Internet Explorer windows. Have been looking a lot on the Selenium User Group and in various documentation but can find a definitive answer. Cheers, Matt

    Read the article

  • Is there a free code coverage tool suitable for use with .NET 4 and NUnit?

    - by Damian Powell
    Is there a free code coverage tool suitable for use with .NET 4 and NUnit that runs from the command line (and is thus suitable for use on a build server)? Please note that any tools that require editions of Visual Studio higher than Professional are not appropriate in this case. I am asking this question because I can't get NCover 1.5.8 to work with NUnit 2.5.5 on a .NET 4 C# app. I can run the unit tests, and I can generate a Coverage.Xml file, but it is empty - it contains no sequence points. After a lot of research, I have concluded that this is because NCover 1.5.8 simply doesn't work with .NET 4. However, if you know better, please feel free to answer this question from another user.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >