For example:
// NUnit-like pseudo code (within a TestFixture)
Ctor()
{
m_globalVar = getFoo();
}
[Test]
Create()
{
a(m_globalVar)
}
[Test]
Delete()
{
// depends on Create being run
b(m_globalVar)
}
… or…
// NUnit-like pseudo code (within a TestFixture)
[Test]
CreateAndDelete()
{
Foo foo = getFoo();
a(foo);
// depends on ...
I have NUnit installed at this directory.
C:\Program Files\NUnit 2.5.5\bin\net-2.0
I made the directory beneath a GAC.
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\NUnit
and copied the nunit.framework.dll, but I got the same error.
When I try to run my unit test (mut.dll) in some random directory. I get the following error. I have...
I have written a bunch of unit tests inside VS2010 Express and tests being tests they sometimes fail. Since the express editions of VS don't allow plugins to run I can't simply spin up TestDriven.Net or an equivalent and debug the tests. To try and work around this I've converted my test assembly into a console app and made the main meth...
I am quite new to TDD and am going with NUnit and Moq. I have got a method where I expect an exception, so I wanted to play a little with the frameworks features.
My test code looks as follows:
[Test]
[ExpectedException(ExpectedException = typeof(MockException), ExpectedMessage = "Actual differs from expected")]
public void...
Greeting,
currently we migrate our project to .net 4. also we use .nunit 2.5.5 with testdriven.net 3.
I got this error, when I run tests.
Test 'TestCase1' failed: System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f...
I am a little unsure as to how to manage sessions within my nunit test fixtures.
In the following test fixture, I am testing a repository. My repository constructor takes in an ISession (since I will be using session per request in my web application).
In my test fixture setup I configure NHibernate and build the session factory. In my...
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 th...
Of course there is an option to turn it off (by default it is on.) However I like to be able to make incremental changes to the DLL while a copy of NUnit GUI is up.
However I couldn't find much documentation for this feature (apart from the need)
So the problem is like this
With Shadow copy enabled in NUnit,
my SUT (Dll) invokes an exe...
I want to test one method that has a high cyclomatic complexity (sigh) and I would like to have a class within test class so that a method test class appears as a node in the tree. Is it possible with Nunit and how?
MyEntityTests
|
L_ MyComplexMethodTests
L when_some_condition_than
L when_some_other_condition_than
[TestFixtu...
I recently solved one of my problems using the decorator pattern. Everything works fine and everything is decoupled enough (or so I think) that I am able to unit test each validitable field separately.
My question is, if the NameValidator and AgeValidator both pass the tests for the Validate() and IsValid() (abstract) functions. Do I st...
Hi. I am running some NUnit tests automatically when my nightly build completes. I have a console application which detects the new build, and then copies the built MSI's to a local folder, and deploys all of my components to a test server. After that, I have a bunch of tests in NUnit dll's that I run by executing "nunit-console.exe"...
More than a question, per se, this is an attempt to compare notes
with other people. I wrote a generic History class that emulates
the functionality of a browser's history. I am trying to wrap my
head around how far to go when writing unit tests for it. I am
using NUnit. Please share your testing approaches below.
The full code for the ...
Hi all
I have 2 questions about functionality of nunit.
What is the difference between [TestFixtureSetUp] and [SetUp] attributes ?
I am writing a some class with tests and I see that half of my test functions need one setup,
And an another half needs another set up.
How can I have in one class two little different SetUp functions tha...
The latest Resharper (v5) version is based on native NUnit code and allows NUnit addins.
I have a NUnit addin that works fine in NUnit GUI but I can not make it work with Resharper. Based on R# indication I have put my addins library in %ResharperPath%\Bin\addins but I doesn't work, my tests are marked as Ignored.
Question: How to use...
Im running the nunit-console program to test some assemblies after the build script is run. The TestResult.xml is then copied to a static web server.
Im looking for a tool that could format the xml output into a nice html page that displays the results similar to how the NUnit GUI does it. Im looking for a color coded hierarchal display...
Consider the following code:
[Test]
public void WidgetTest()
{
foreach (Widget widget in widgets)
{
Assert.AreEqual(0, widget.SomeValue);
}
}
If one of the asserts fails, I will get a very unhelpful error message like the one below:
1) Test Failure : WidgetTest.TestSomeValue
Expected: 0
But was: 1
at WidgetT...
I have this simple test:
protected readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().ReflectedType);
private static int count = 0;
[Test]
public void TestConfiguredSuccessfully()
{
logger.Debug("in test method" + count++);
}
log4net is set up like this:
[TestFixtureSetUp]
public void SetUp()
{
log4net....
Is there a way to set /framework:net-4.0 in nunit-console.exe.config like in GUI? Or any other way to run NUnit tests with MSBuild Community Tasks?
...
I have a project on a TeamCity v5. build server. The project builds fine on the server using VisualStudio 2010 solution setting, but then fails to run any unit tests, failing with error
Blockquote
error : c:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe "@@" C:\TeamCity\buildAgent\temp\buildTm...
Isn't it true that every assert statement can be translated to an Assert.IsTrue, since by definition, you are asserting whether something is true or false?
Why is it that test frameworks introduce options like AreEquals, IsNotNull, and especially IsFalse? I feel I spend too much time thinking about which Assert to use when I write unit...