unit-testing

Assert that arrays are equal in Visual Studio 2008 test framework

Is there an easy way to check in a unit test that two arrays are equal (that is, have the same number of elements, and each element is the same?). In Java, I would use assertArrayEquals (foo, bar);, but there seems to be no equivalent for C#. I tried Assert.AreEqual(new string[]{"a", "b"}, MyFunc("ab"));, but even though the function re...

Query assembly

I have a .NET assembly that has tens of classes and methods which are unit testing methods. I want to generate a report with all the method marked with attribute Ignore, do you know a simple way to do that? ...

How should I verify a log message when testing Python code under nose?

Hi all I'm trying to write a simple unit test that will verify that, under a certain condition, a class in my application will log an error via the standard logging API. I can't work out what the cleanest way to test this situation is. I know that nose already captures logging output through it's logging plugin, but this seems to be i...

nant script doesn't display unit test details

Can someone please tell me why my build script (nant) doesn't display the unit test details in the command prompt window? I have verbose set to true, but it doesn't want to display any details about my unit tests. Here's the target: <target name="run-unit-tests" depends="compile, move.assemblies.for.tests, rebuildDatabase"> <mkdir ...

How do I write unit tests in PHP with a procedural codebase?

I'm mostly convinced of the benefits of unit testing, and I would like to start applying the concept to a large existing codebase written in PHP. Less than 10% of this code is object-oriented. I've looked at several unit testing frameworks (PHPUnit, SimpleTest, and phpt). However, I haven't found examples for any of these that test pr...

Anyone succesful in debugging unit tests for iPhone?

I found examples on how to debug your unit test in Cocoa or the ADC page here. But I can't get the debugging to work for an iPhone app target. I can get the tests up and running and they are run during the build, but what I need is to debug the tests for some of the more complex failures. ...

Google App Engine + GWT + Eclipse: where do your unit tests live?

I'm just getting started with a project that combines GWT, Google App Engine and the Google Eclipse plugin. Where is the best place to store my tests? I normally keep my code organized Maven-style, with src/main/java, and tests in src/test/java. The default setup I get from the plugin dumped my source directly into src, which I'm not ...

How can I call a custom Django manage.py command directly from a test driver?

I want to write a unit test for a Django manage.py command that does a backend operation on a database table. How would I invoke the management command directly from code? I don't want to execute the command on the Operating System's shell from tests.py because I can't use the test environment set up using manage.py test (test databa...

How do you best handle tests with dates?

I am using a Repository pattern with filters in my MVC application. The project displays a list of transactions where I can specify a date period to get a subset of transactions, or specify a specific date to get transactions for that date (including year, year/month, and year/month/day views). I also have functionality for paging getti...

Unit Test Connundrum

Hello :) I'm looking to unit testing as a means of regression testing on a project. However, my issue is that the project is basically a glorified DIR command -- it performs regular expression tests and MD5 filters on the results, and allows many criteria to be specified, but the entire thing is designed to process input from the syste...

ASP.NET MVC Unit Test

Hi, I'd like to try unit test in ASP.NET MVC framework. But I don't know which unit test framework I have to choose. NUnit, xUnit.net, MbUnit. or the unit test framework included with Visual Studio, which one is better? ...

Unit testing several different results in one method

I am using NUnit 2.5, and I want to test a method that recieves several parameters. Is it reasonable to try to test them using one Test method, with several different TestCases, or will it be harder to maintain (Or just pin point the exact failure) in the long run? My general idea is to try something like [TestCase("valid", Result=...

How to unit-test a NextPasswordChangeDate function against the Active Directory

Hello I am working on a project using the Active Directory, intensively. I set up a few unit tests for several things against the AD, some of which I achieve using mocked objects, some which I achieve through real calls against the AD. As one of the functions of my project, I have to retrieve a so called "user profile". This user profi...

testing entity mapping of NHibernate

hello, i'm building some basic crud methods for my fluently mapped entities. i just wanna know if there is a simple way to make the transaction to perform a rollback when i'm running the cud test methods ? the code that being tested perform the commit inside here is a create sample: public int? Create(IIdentifiable entity) { ...

JUnit Max Equivalent Tool for Visual Studio

I have been trying to find a tool similar to JUnit Max for Visual Studio. Preferably, the tool would work with Visual Studio 2008 Professional and NUnit. For those who are apparently unable to click through to the JUnit Max site, here is the description. JUnit Max is a continuous testing plug-in for Eclipse that helps programmers s...

Valgrind automatic tests -- are they used somewhere?

Do you think that running set of automatic tests based on valgrind's tool suite makes sense? Did you hear about or see such setup in action? What automatic (free from human intuition) actions could such setup perform? ...

What's the best argument to convince developers to learn TDD?

Let me first come out of closet. I'm a TDD believer. I'm trying to practice Test Driven Development as much as I can. Some developers at my work refuse to even try it. I myself started TDD by trying to prove to one of my peers that Test Driven Development is a bad idea. The arguments are: Why? I was pretty successful developer so ...

Solution for Parameterized Tests

I'm familiar with the use of Parameterized tests in JUnit, e.g: http://junit.org/apidocs/org/junit/runners/Parameterized.html but I wondered whether there were any alternative (possibly better) approaches to externally defined test data. I don't really want to hardcode my test data in my source file - I'd prefer to define it in XML or...

Unit testing in C++

I've been reading a lot about Unit tests and Test Driven developemnt. Recently, I also read java unit test code. I however, prefer to develop in Qt. So I googled up "unit testing in c++" and found a host of information about various unit testing frameworks available for C++. However, I could not find a reliable comparison of the the v...

Mocking framework for .Net fx 1.1?

Anyone have any ideas what I can do? Please reserve commenting about using 1.1 still, it's out of my hands :( ...