unit-testing

Ordering Tests in VS 2008/2010

I am writing unit tests for basic CRUD functionality using VS 2010. My goal is to create new entities, read them back, update them, and then delete them. One obvious approach is to have a unit test for each of those operations and run them in that order. Except that I can't directly specify the order the tests should run in. I unders...

RowTest in Visual Studio tests?

Is there something similar to mbUnit's RowTest in Visual studio tests. I wanted to have the ability to perform the same test using different input data and expected results. Wanted to avoid using testing frameworks since I'm need very little and simple tests at the moment. ...

Program Evolution and Broken Tests

Maintaining unit tests is difficult. I am sure that we all have experienced a time when a seemingly small change to the system under test caused dozens of unit tests to fail. Sometimes these failures reveal bugs in the SUT, but often the tests are out of date and no longer reflect the correct behavior of the SUT. In these cases, it is ne...

Is there an API for running Visual Studio Unit Tests programmatically?

Is there an API for running Visual Studio Unit Tests programmatically? Running MSTests.exe with Process.Start() does not work in the current scenario. What I'm looking for is something like the NUnit SimpleTestRunner. Any ideas? /Erik ...

RhinoMocks - Fetching parameters of called functions

Using RhinoMocks - can I fetch the parameters of a called function? I mean; can I get some of the unknown parameters from the function call out? I have a mock, and I expect some function to be called on this. I know one of the parameters, but the other one is unknown as this comes from the class that uses the mock and calls a function ...

Tips on how to write refactoring-friendly unit TDD tests

Hi, I've been working on an ASP.NET MVC project for about 8 months now. For the most part I've been using TDD, some aspects were covered by unit tests only after I had written the actual code. In total the project pretty has good test coverage. I'm quite pleased with the results so far. Refactoring really is much easier and my tests h...

Architectures - Domain Driven Design vs strict business logic enforcement

My business objects are coded with the following architecture: validation of any incoming data throws an exception in the setter if it doesn't fit business logic. property can not be corrupt/inconsistent state unless the existing default/null is invalid business objects can only be created by the business module via a static factory ...

NUnit running the wrong test assembly

I'm running NUnit from VS2k8 by setting it as the start action for the test project. That worked fine when I only had a single solution with a single test project. I'm trying to run tests in a second solution now, but when NUnit launches it's loading Solution1Name.Test instead of Solution2Name.test ...

Is there a .net framework that manages unit AND integration testing?

One of the boasts I've heard of unit testing is that you can run 2000+ tests in a minute or so.. because the only limit is cpu speed and ram. I, however like to include external dependency assertions/testing in my test projects (such as: does the user account the application logs on with have insert/update/delete permissions on the appr...

Are there any automated unit testing frameworks for testing an in-house threading framework?

We have created a common threading framework to manage how we want to use threads in our applications. Are there any frameworks out there like gtest or cppunit that solely focus on unit testing threads, thread pools, thread queues, and such? Right now I just kind of manually go through some steps that I know I should cover and do check...

How does one test async code using MS Team System Unit Tests

I'm writing some super simple async code. Just saving a file off-thread. I'd like to test this code using the clever Unit Test framework in Microsoft Visual Studio Team System 2008 .NET XP Extreme Edition blah blah blah... How? I'd like to simple block the test method until the method returns. I can imagine some ways to do this, but I...

TDD and testing before or after writing source code?

I have seen many articles on why Test Driven Development is good and that it reduces development time and so on. But after searching through a lot of forums, I am still yet to get a concrete advantage of TDD. I am not saying testing is a bad thing, but my point is what is the harm if I write my unit test after I write my source code rath...

Using Lambdas as Constraints in NUnit 2.5?

According to Charlie Poole's NUnit blog, it is possible to use Lambda expressions as constraints in NUnit 2.5. I just can't seem to be able to get it to work? I am using NUnit 2.5.3.9345. Using the example lambda from the blog post: [TestFixture] public class Class1 { [Test] public void someTest() { int[] array = {1...

Rails - How do you test ActionMailer sent a specific email in tests

Currently in my tests I do something like this to test if an email is queued to be sent assert_difference('ActionMailer::Base.deliveries.size', 1) do get :create_from_spreedly, {:user_id => @logged_in_user.id} end but if i a controller action can send two different emails i.e. one to the user if sign up goes fi...

Moq and accessing called parameters

I've just started to implement unit tests (using xUnit and Moq) on an already established project of mine. The project extensively uses dependency injection via the unity container. I have two services A and B. Service A is the one being tested in this case. Service A calls B and gives it a delegate to an internal function. This 'callb...

Missing code coverage tab in VS localtestrun.testrunconfig ?!

Hello, I am relatively new to unit testing and was attempting to add some code coverage to my unit tests. Yet i can't find the code coverage tab in Visual Studio 2008 in the localtestrun.testrunconfig, is there any missing Add-in or tool? Thanks, DMS ...

Unit testing CRUD operations when data source is configured in application server properties

Hi all! Please, tell me: How can I write unit test (e.g. with JUnit) for operation "insert into some table" when many properties for normal application work are saved in config files for application server? Thanks!a ...

MSTest Test Context Exception Handling

Is there a way that I can get to the exception that was handled by the MSTest framework using the TestContext or some other method on a base test class? If an unhandled exception occurs in one of my tests, I'd like to spin through all the items in the exception.Data dictionary and display them to the test result to help me figure out wh...

Python - test a property throws exception.

Given: def test_to_check_exception_is_thrown(self): # Arrange c = Class() # Act and Assert self.failUnlessRaises(NameError, c.do_something) If do_something throws an exception the test passes. But I have a property, and when I replace c.do_something with c.name = "Name" I get an error about my Test Module not being im...

How to disable individual tests temporarily using unittest module in python?

How to disable individual tests temporarily using unittest module in python? Like googletest does. Thanks. ...