unit-testing

Tools for automatically generating unit tests for C++?

We have a large amount of legacy C++ code in shared libraries that are used on dozens of products. Ignoring the pros and cons of automatically generating tests (that's a discussion for another day), does anyone have any recommendations for a tool that would analyse the source and generate a set of tests to exercise that code? Ideally it...

How to properly mock and unit test

I'm basically trying to teach myself how to code and I want to follow good practices. There are obvious benefits to unit testing. There is also much zealotry when it comes to unit-testing and I prefer a much more pragmatic approach to coding and life in general. As context, I'm currently writing my first "real" application which is the u...

Unit-tests for Boost.Spirit

Hi I'm new to Boost.Spirit and Boost.Test and I would like to know how you verify the correctness of your grammars. Below is a simplified version of how I do it at the moment and I'm pretty sure that there's a better way: Each test case hase a pair of two strings containing the text to parse and the expected result delimited by semicol...

Testing Custom Control derived from ComboBox

I've created a control derived from ComboBox, and wish to unit test its behaviour. However, it appears to be behaving differently in my unit test to how it behaves in the real application. In the real application, the Combobox.DataSource property and the .Items sync up - in other words when I change the Combobox.DataSource the .Items l...

Unit testing data flow in a ssis pakage

Is there a way to unit test data flow in a ssis package . Ex: testing the sort - verify that the sort is porperly done. ...

Design By Contract vs Test Driven Development ?

You may think this question is like this question asked on StackOverflow earlier. But I am trying to look at things differently. In TDD we write tests that include different conditions, criteria, verification code. If a class passes all these tests we are good to go. It is a way of making sure that the class actually does what its suppo...

Unit Testing PSCmdlet in VS2008

I have seen several examples on unit testing powershell commandlets in NUnit. http://www.clydesdalesoftware.net/blogs/jluif/PermaLink,guid,064a378c-85c9-4d2c-9a8d-80620e97f71e.aspx or http://www.hanselman.com/blog/TestingPowerShellScriptsWithNUnit.aspx Does anyone know same way one would unit test powershel commandlets in Visual Studio ...

Advice for transitioning to object orient programming from VB 6 'style'

I'm a vb.net developer in small IT department and I'm having trouble making the leap to programming exclusively with objects. I understand the principles of OOP, design patterns, unit testing, etc, but when it comes to developing my applications, either my object design is poor, or I skip building with objects altogether. I know how to...

How do I check if a class is readonly in c#??

Can I write a unit test that make sure that a readonly class I write (a class which has no setters) remains readonly in the future? I do not want that anyone to add a setter property in my classes. Basically, how do I check if a class is has no setters in C#? ...

Database data needed in integration tests; created by API calls or using imported data?

This question is more or less programming language agnostic. However as I'm mostly into Java these days that's where I'll draw my examples from. I'm also thinking about the OOP case, so if you want to test a method you need an instance of that methods class. A core rule for unit tests is that they should be autonomous, and that can be a...

Overriding Binding in Guice

I've just started playing with Guice, and a use-case I can think of is that in a test I just want to override a single binding. I think I'd like to use the rest of the production level bindings to ensure everything is setup correctly and to avoid duplication. So imagine I have the following Module public class ProductionModule impleme...

Unit Test for a Model that acts_as_tree

How could i test a model that acts_as_tree in a unit test ? ...

Ideas and tips for temporal unit-testing?

Has anyone done temporal unit-testing? I'm not even sure if such lingo has been coined or not, but the point is to test that operations perform within temporal limits. I have a few algorithms and I want to test that their execution time increases as expected, and I guess similar testing could be used for IO, and what not, kind of like ...

Using a base class for unit test setup and teardown

Assuming Visual Studio.NET 2008 and MsTest are used to run unit tests. When a system is based on a service container and dependency injection unit testing would naturally require the setting up of services. Should these services rather be setup in a base class that all unit tests derive from or in each unit test class. If they should b...

How to avoid duplicate app.config using Visual Studio 2008 unit testing?

When I have one app.config in my main project I always have to duplicate it to its test project. How to avoid it? Update I also asked a very similar, and slightly complicated question ...

How to avoid duplicate settings when using 2 projects and 2 testing projects in Visual Studio?

Following my previous question, now I have 2 projects: one Console Project and a Library Project. They also have their respective unit test projects. When I run a test for the console project that uses a method from the library project and the library project needs an app.config setting, that setting must be in the console test project's...

JUnit Exception Catching

I am writing a few test cases that depend on the database being available, so on the @Before and @After I open and close the session (Hibernate), as well as start and finish the transaction. Now in the process of development sometimes I get exceptions in the test cases, so the @After is never called and I can't clean up (or rollback the...

How do I continuously run a single test case using Selenium?

I have recorded a very simple test case Using the Selenium IDE integrated with Firefox. I want the test case to run continuously over a period of time. How can I make the test run continuously? ...

Byte Stream Unit Test

I'm utilizing the Reporting Services web service to generate a report and allow the user to download it. This is occuring via PDF, Excel, XML, etc. and working just fine. I'm trying to create some seperation between my reporting class and the implementation, but am struggling with how I can can do this in a manor that is still testable...

Unit Testing an AJAX Enabled ASP.NET MVC Web Site

I just got my first Unit Test project working, and immediately ran into some problems. One of the nice details about the Unit Testing concept that were pointed out to me was that I won't have to mock up http-contexts or such in order to test my application. However, I have made use of the Request.IsMvcAjaxRequest() check in my controlle...