unit-testing

Install Device Unit Test Framework

Hi all, I have Framework2.0 already installed in device, I have created a unit Test project for the smartDevice application, now to test this project I need to have Device Unit Test Framework installed in the machine. http://msdn.microsoft.com/en-us/library/bb545998.aspx Here I want to know if Device Unit Test Framework is distributed ...

How to unit test a method that spawns threads?

I am fairly new to TDD but have been using it for long enough to understand how to use mocks, stubs, dependency injection, inversion of control to solve 'similar' problems... but for some reason I feel very uneasy about using dependency injection and passing in an 'IThread' (or similar). To give it some basic context - I am trying to ad...

Blanking fields with Reflection

Hello I am writing a Junit test framework to test web services. There is a requirement for the input values to come from many different sources, eg an earlier web service call or literals within the class. To achieve this I have constructors that accept the different inputs in different ways; all simple so far. The problem is the web...

PHPUnit Test Question - How to Unit test my class

Hi, I'm trying to get into Unit testing for the obvious positives it introduces, and I'm trying to write a Unit test for a class I wrote the other day. (I know this is the opposite to TDD, please bear with me) My class, Image, is used in conjunction with some others for image manipulation. Image essentially wraps a GD image resource ...

Problems getting a mocking demo working (Nunit and ReSharper)

Hi, I am trying to get to grips with mocking and ReSharper by watching this demo http://www.bestechvideos.com/2008/06/08/dimecasts-net-introduction-to-mocking-with-moq I'm sure I followed the code correctly but I'm getting errors. Could you give me some pointers as to were I'm going wrong? errors:-class name is not valid at this point e...

Team Build: Cannot find generated private accessor

We have been using TeamBuild and test for our continuous integration build for about 4 months and this issue just popped up the other day in one of our test assemblies when running tests on one of our test assemblies on the build server only. {NameSpace}.Order_Accessor, Version=0.0.0.0, Culture=neutral, PublicKeyToken='{xxx}' or one of ...

How Do You Implement an Editable Grid Control in Html/JavaScript that Binds to a Collection of Java Objects?

Consider a simple POJO Java Object: class MyObj { String a, b; Integer c; } My application executes a Struts action and sets a Collection of these on the Http Request: request.setAttribute("myObjects", getCollectionOfMyObj()); The action then forwards to a JSP page, and this is where my questions centres: What is the simplest...

NUnit and Log4Net integration: asserting based on the log

Hi, This is my first question on stack overflow. I haven't had much luck finding an answer via google or stackoverflow. I'm interested in having an nunit test examine the log4net for a specific entry in the log and assert based on the results of that search. Based on an unrelated post I read re: log4net, I think I can probably use Me...

C++ boost unit test error message

I would like to write a method in my test suite as follows: void checkParams(arg1, arg2, arg3) { BOOST_REQUIRE(arg1==1); BOOST_REQUIRE(arg2==2); BOOST_REQUIRE(arg3==3); } However, I want to write something to stderr if the assert fails. For example, if the first assert fails, I want to write: checkParams failed with arguments arg1=5...

Tests are not available in Visual Studio 2008?

I'm working through the Nerd Dinner ASP.NET MVC tutorial and am at the part right after I've created the project and am trying to run my unit tests for the first time. I see the test project and the AccountControllerTest.cs and HomeControllerTest.cs files that were generated but when I click on Test -> Run all options are greyed out. W...

Should you Unit Test Business Logic methods that consists primarily of a query?

I have a business logic layer with a broad spectrum of classes and their corresponding methods. Creating a Unit Test for a method is generally a given but, in some cases, the method really just returns a set of matching records from the database. It seems kind of silly to write a Unit Test by, say, storing five matching records and then...

Should I unit test XML schema?

I am in the very early stages of writing XML schema for my work's enterprise application. The XML to be validated represents an application - similar to Winforms - forms, grids, menus etc but without layout. The prime purpose of the XSD is not so much to validate the XML but to add design-time discoverability to the XML file, so that on...

DbUnit and binary data

I use DbUnit for unit-testing of my DAO objects. It works great so far. I have a problem, I have field ob type byte[] which is stored as BLOB in the database. The column is not-null. How can I specify the value for this column in the XML dataset file, that DbUnit uses? The value can be nothing fancy, 5 bytes will be enough. I would lik...

Testing concurrent Rails-App with Sqlite

I'm working on a Rails application that is multi-threaded. A user can start a tool from a web-form that may take several minutes to finish and that writes status-updates in the database (the tool is started in a separate thread). The user can check the current status on a status-page that refreshes itself regularly and reads the current ...

(Hopefully Simple) Question about Unit test seperation

Hi, This question is related to PHPUnit, although it should be a global xUnit design question. I'm writing a Unit test case for a class Image. One of the methods of this class is setBackgroundColor(). There are 4 different behaviors I need to test for this method, Trying to set an invalid background color. Multiple invalid paramete...

How to unit test the DataAnnotationsModelBinder in ASP.NET MVC 2

I'm using ASP.NET MVC 2 with DataAnnotation attributes sprinkled on properties like so: public class LogOnViewModel { [Required] public string UserName { get; set; } [Required] public string Password { get; set; } [Required] public string Domain { get; set; } } I have a unit test which checks that the curre...

Test Suite unittest

Hello, I have a test suite and I am trying to get it to work with the tests I have created. The test work if I run them individually but I want to run them all in a test suite. The code below show the test suite created: import unittest def suite(): modules_to_test = ('TestAbsoluteMove', 'TestContinuousMove') # and so on allte...

VS 2008, Profiling Multiple Tests

I have written a set of acceptance tests, and am trying to test the performance of a library with them. Unfortunately, I can only seem to select a single test and "Create Performance Session" ...which doesn't give a true picture of performance of the app as a whole. Is there a way to get a performance report of all the tests at once? ...

Am I doing these unit tests right?

I'm new to unit tests for my own projects, so this is my first attempt to write a unit test from scratch. I'm using python, and the unittest module. The TodoList class being tested here is a wrapper for actual lists, with a few extra methods for stuff like saving to disc. It also defines a few methods for getting items by their ID in the...

IEnumerable and yield return

My unit tests are doing something very strange when I call a method of a generic base type. I have tried both NUnit and MSTest with the same result. This is how the code is organized: public class MyStub {} public class EnumerableGenerator { public bool GotMyStubs; public IEnumerable<MyStub> GetMyStubs() { GotM...