unit-testing

Testdriven Remoting in C# - Do I need a separate server AppDomain?

I wanted to start with the use of Remoting under C# in a testdriven way, but I got stuck. One thing I found on the topic is this article by Marc Clifton, but he seems to have the server running by starting it manually from the console. I try to have the server started (i.e. register the serving class) in the test fixture. I probably al...

JUnit 4: Set up things in a test suite before tests are run (like a test's @BeforeClass method, just for a test suite)

I want to do some functional testing on a (restful) webservice. The testsuite contains a bunch of test cases, each of which performs a couple of HTTP requests on the webservice. Naturally, the webservice has to run or the tests will fail. :-) Starting the webservice takes a couple of minutes (it does some heavy data lifting), so I want...

C# Extension Method Oddity during Unit Test

Using Visual Studio 2008 / C# / VS Unit Testing. I have a very straightforward extension method, that will tell me if an object is of a specific type: public static bool IsTypeOf<T, O>(this T item, O other) { if (!(item.GetType() is O)) return false; else return true; } It would be called like: Hashtable myHa...

Should I be unit testing this class?

I know this maybe a very basic question but I'm having a bit of a mind blank at the moment. Should I be unit testing this class. public class MapinfoWindowHandle : IWin32Window { IntPtr handle; public MapinfoWindowHandle(IntPtr mapinfoHandle) { this.handle = mapinfoHandle; } ...

How do you test visual components?

I think I understand unit testing. But I was wondering: is there a way to automate something visual, like making sure anti-aliasing works or that the rounded corners on a web site look how they are supposed to? I have a feeling that it just isn't practical, but I have little experience in the QA world. ...

best way to run multi-threaded nunit tests

I currently trying to find a solution, how to ensure that a test fails if an exception occurs in a thread which is spawn by the test method. I DON'T want to start a discussion about more than one thread in a unit test. => "unit test".Replace("unit","integration"); I already read a lot of threads in several forums, I know about CrossThr...

Integrating Hudson with MS Test?

Is it possible to integrate Hudson with MS Test? I am setting up a smaller CI server on my development machine with Hudson right now, just so that I can have some statistics (ie. FxCop and compiler warnings). Of course, it would also be nice if it could just run my unit tests and present their output. Up to now, I have added the follow...

Dependency injection in C++

This is also a question that I asked in a comment in one of Miško Hevery's google talks that was dealing with dependency injection but it got buried in the comments. I wonder how can the factory / builder step of wiring the dependencies together can work in C++. I.e. we have a class A that depends on B. The builder will allocate B in t...

ASP.NET MVC Beta Project can't create controller tests properly in subfolder

I'm using VS2008 Team Suite, ASP.NET MVC Beta, with TestDriven.Net installed. When I created my project from the template, it created a "Tests" project as well and put some controller tests for the AccountController in a folder inside this project. I've added other controllers and associated tests. Howerver, when I right-click on a met...

Best Test Automation Tool

Currently I am working at a company that does all of its development work using VS2003, 2005, and 2008 and we have them integrated with Team Foundation Server. We do mostly Windows Apps and Websites. What is the best testing automation software that would work with our currently programs. ...

Running tests as a different user in Visual Studio

I have a program that needs to run as a separate NT user to connect to a SQL Server databases. For running a program itself, this isn't a big deal as I can just right click on it in windows explorer and select run as. Is there any way to run my tests as a different user as well? (it would be nice if I could do so in Visual Studio) Up...

code coverage in C

I'm looking to have code coverage in C. I cannot rely on tools like gcov as I am working on different platforms/compilers. Basically I am looking for a strategy to incorporate code coverage into my(own implementation) unit-test framework. ...

Unit test case generator

Hi, Has anybody tried any Unit Test generators for .Net? I assume although it won't be any substitute for any good unit test written by a person who has written the functionality, but I think it will take away some of work and be a starting point on which we can better the unit tests. Thanks. ...

Do you need to unit test a constructor.

Do you need to unit test constructors, say I have a ctor like this, IMapinfoWrapper wrapper; public SystemInfo(IMapinfoWrapper mapinfoWrapper) { this.wrapper = mapinfoWrapper; } Do I need to write a unit test for this ctor? I don't have any getters for the wrapper variable, so I don't need t...

Moq tests using ExpectSet() with It.Is<T>() aren't behaving as... expected.

I've isolated the behaviour into the following test case. I'd be grateful to anyone who can tell me how to expect/verify a property set for a List<T> property - it appears there's something going on inside It.Is<T>(predicate) that isn't making a whole lot of sense to me right now. Sample code will run as a console app from VS2008 - you'l...

C# "internal" access modifier when doing unit testing

I'm new in unit testing and I'm trying to figure out if I should start using more of 'internal' access modifier. I know that if we use 'internal' and set the assembly variable 'InternalsVisibleTo', we can test functions that we don't want to declare public from the testing project. This makes me think that I should just always use 'inte...

Best practices to test Asp.net MVC applications

Whats the best practice to test an Asp.net MVC application? ...

Confirming from a JUnit test that a FileReader was closed properly

I'm writing some Java code that uses a FileReader to load data from a few input files. I'm using TDD pretty heavily, and I'd like to add some tests that ensure that I'm cleaning up properly by calling close() on the reader when I'm done with it. Unfortunately, I can't come up with a good way to test for this. Anyone have any insights? E...

Javolution test patterns, dos and don'ts

What are the patterns and dos and don'ts when one is writing tests for Javolution tests? In particular I was wondering: TestCase.execute() does not allow throwing of exceptions. How to deal with them? Rethrow as RuntimeException or store in a variable and assert in TestCase.validate() or something? Are there any graphical runners that ...

JUnit test with dynamic number of tests

In our project I have several JUnit tests that e.g. take every file from a directory and run a test on it. If I implement a testEveryFileInDirectory method in the TestCase this shows up as only one test that may fail or succeed. But I am interested in the results on each individual file. How can I write a TestCase / TestSuite such that e...