unit-testing

Best Practise for Structuring Visual Studio Testing Projects

I know there is no right or wrong answer to this but it would be VERY helpful to see how others have structured their test projects? Especially for multi assembly solutions and managing different test phases, unit, integration, system? And ontop of it all it would be helpful to see what structure fits nicely for running test builds ...

What advantage have other testing libraries over the one provided by Visual Studio 2008?

Or in another way, is there any reason to install NUnit or any other library and use it instead of the one that comes with Visual Studio 2008? ...

TDD Unit testing (VS 2008) WCF services - Symbols not loaded for debuging test

Hi there, Can anyone help, i have been succesfully testing with the built in tdd that ships with vs 2008. But now i wish to test my wcf... I added a default.aspx in the wcf service (you need to do this according the ms) ... now when i put a break point in my test.. and click the icon debug test in current context, all goes well ..,the t...

Confusion: leave out functional tests that cover same ground as unit tests?

I'm struggling to figure out what should be excluded from functional tests (in my case, using Rails, but I guess the framework's probably irrelevant). I'm under the impression that I shouldn't bother using functional tests for things that will be caught in unit tests -- such as checking that a field can't have too many characters, or th...

Unit Testing In CakePHP

Hi, I'm doing unit testing in CakePHP. I want to test two of my controllers. My app has different kinds of users. I want to test the results the app return depending on which type of user is logged in. I don't know, however, how to log in to the app from the controller test case. I tried a couple of approaches without success. 1) I t...

How to reduce the time spent on testing?

I just looked back through the project that nearly finished recently and found a very serious problem. I spent most of bank time on testing the code, reproducing the different situations "may" cause code errors. Do you have any idea or experience to share on how to reduce the time spent on testing, so that makes the development much mor...

How to simulate a DB for testing (Java)?

Hi, I'm programming in Java and my applications are making a lot of use of DB. Hence, it is important for me to be able to test my DB usage easily. What DB tests are all about? For me, they should supply two simple requirements: Verify SQL syntax. More importantly, check that the data is selected/updated/inserted correctly, according...

PHPUnit on a shared hosting plan?

PHPUnit works great, I love it actually, problem I'm having is that my hosting plan imposes a 30 second cap on the duration of a query. If PHPUnit tests take longer than that, the connection is closed by the server, and I never get to find out if all my tests passed or not. Is there an existing automatic way of running an arbitrarily l...

app.configs and MSTest Project - null reference for a connection string

When I try to run Unit Tests (mstest) I run into this issue. The line of code: _mainCnStr = System.Configuration.ConfigurationManager. ConnectionStrings["main"].ConnectionString; Comes back as a null reference It doesn't do this in the main UI project when I run it. What is the right method to get this connection str...

How to build custom assertions in C#/VS ?

I ran into a bug in some code that extracts metadata from some text and puts it into a dictionary. My test was failing when I compared two dictionary objects because the keys were in different order. I don't really care what order the keys are in. I'd like to have an assert method available like : Assert.AreEquivalent(propsExpected,...

assertEquals vs. assertEqual in python

Is there a difference between assertEquals and assertEqual in the python unittest.TestCase. And if it is not why are there two functions? Only for convenience? ...

What are some strategies to unit test a scheduler ?

This post started out as "What are some common patterns in unit testing multi-threaded code ?", but I found some other discussions on SO that generally agreed that "It is Hard (TM)" and "It Depends (TM)". So I thought that reducing the scope of the question would be more useful. Background : We are implementing a simple scheduler that g...

How does Assert.AreEqual determine equality between two generic IEnumerables?

I have a unit test that will test to see if a method that returns the correct IEnumerable. The method builds the IEnumerable using yield return. The class that it is an IEnumerable of is below: enum TokenType { NUMBER, COMMAND, ARITHMETIC, } internal class Token { public TokenType type {get; set;} public string te...

Global settings passed to instance or referenced directly.

I have a Logging class which gets instantiated on startup of a console app and the stored in a static variable. If i want a class to use the logger should it be passed to the class in the constructor or referenced directly? I'm trying to write unit tests and either way i should be able to do it. Just means i have to set the static vari...

C#: How do I use Assert (Unit Testing) to verify that an exception has been thrown?

The title says it all - how do I use Assert (or other Test class?) do verify that an exception has been thrown? Thanks :) ...

How to set up Flex Unit 4

Does anyone know of any guides or any sort of documentation on how to set up the new Flex Builder 4 beta? I've been pulling my hair all day long, none of my tests are executed and I can't for the life of me understand what's wrong. There are no errors at all. It's as if the metadata tags are not recognized, is there some special compiler...

How do I UnitTest a custom ActionFilter?

I've been trying to find some straightforward information on this, but I haven't been able to - either what I've found has been to vague for me to understand what's going on, or too specific for the wrong thing, for example a tutorial I found for unit testing an AuthorizeAttribute. (A third alternative is of course that I'm too dumb to r...

What are the best practices for the AspNetDevelopmentServerHost attribute?

We have a Web Application Project (dozens actually..) that has a testing project attached to it. In the testing project I have a simple unit test which exercises a couple of methods. Running locally, the unit test executes and works. However, when our TFS Build server attempts to execute the test, it fails with a error about an invali...

Can writing unit tests be a profession unto itself?

Are there any developers out there who's primary job description is to write unit tests and build test frameworks for other developers at the company? It would seem to make sense for several reasons. For example, there are companies who are specialists in wind tunnel testing. They have standardized tests that they've created which pro...

How do you write tests for code that requires duplicating the code under test?

I'm working on moving as much logic out of a custom control as possible so that it can be unit tested to reduce manual testing burden. I'm having trouble with situations where a method under test produces a complex result; writing a test case that calculates the result would involve writing what is essentially the code under test into t...