unit-testing

MockUnitOfWork 'Cannot resolve symbol MockUnitOfWork'

Hi, I'm trying to get Figure 3 Fake Database from IRepository using the example here http://msdn.microsoft.com/en-us/magazine/dd263069.aspx public class InMemoryRepository : IRepository { private readonly Cache<Type, object> _types; private MockUnitOfWork _lastUnitOfWork; public InMemoryRepository() { _types = n...

How to save/load user specific settings with MS Test in VS2008?

Hello all, I have some unit tests which need to access some values depending on my own computer. For example, a test needs to access a file path, but this file path may vary on other testers' computers. What I'm thinking is that I need to put these values into a config file which allows the testers to config on their own computers bef...

Best way to do FoxPro unit tests for SBT/ACCPAC/Sage Pro Series?

Title says it all. It appears to be extremely difficult to design a generic test harness for Pro Series because of the way forms are invoked, etc. The problem I face is that while I can invoke each form, and the logic for the form is (generally speaking) logically separated in a different class, there is to my knowledge no way at this ...

Customizable Authencation backends not followed by Django's own login testcases. Why ?

I learnt that using Customizable Authencation backends philosophy, one can create a website which accepts email addresses as usernames. But after building the corresponding logic and testing that my code is working fine, I found one issue with Django's own testcases. They were failing to follow the Customizable Authencation backend philo...

how can I automatically run my tests after compilation?

Is there any easy way to automatically run my unit tests after a successful compilation? ...

Getting DRY with Rhino Mocks

I am looking for ways of making the following more concise. public class MyTests { IPresenter presenter; [SetUp] public void SetUp() { presenter = MockRepository.GenerateStub<IPresenter>(); } ... } In particular specifying the type again when creating the mock seems redundant. For example I can write...

Debugging Tests in VS2008 Slow due to loading symbols

If I click on 'debug all tests' in Visual Studio 2008 it takes ages to start (whereas 'run all tests' starts instantly). As far a can tell, this is because it is downloading symbols from Microsoft. Why is this? Is there anyway I can stop it or to make it start faster? ...

Importing in hierarchical Perl modules into the local namespace

Situation: I have a module Foo::Quux::Bar, living in ./Bar.pm. I need to be able to unit test Bar. However, it is not advantageous due to circumstances beyond my control to set up a Foo/Quux directory structure. So what I'd like to do is have some sort of unit_test_use routine that lets me grab Bar.pm and move/copy its functions into ...

Unit testing - How to set up test data when stubbing database data

Hi, In our unit testing, I've got a stub object that is creating a set of data in memory to be used during unit testing so that the live database is not used. I have unit tests that check the number of rows returned from this set using the query under test and the values supplied to the query in the test. My first issue is that because...

Resharper 4.5 and dotTrace 3.1 integration problem

Hi. I am not able to get Resharper profile a unit test, although I have dotTrace installed on my machine. Actually, the dotTrace button in VisualStudio is also greyed out. the VisualStudio AddIns menu list dotTrace as started. VS2008 sp1 Windows 7 64bit R# 4.5 dotTrace 3.1 I tried Restarts, Reinstall, Re-whatever. Has anyone experien...

What are key points to explain Unit Testing

I want to introduce Unit Testing to some colleagues that have no or few experience with Unit Testing. I'll start with a presentation of about an hour to explain the concept and give lots of examples. I'll follow up with pair programming sessions and code reviews. What are the key points that should be focussed on at the intrduction? ...

How to unit test asynchronous APIs?

Hi all. I have installed Google Toolbox for Mac (http://code.google.com/p/google-toolbox-for-mac/) into Xcode and followed the instructions to set up unit testing found here (http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting). It all works great, and I can test my synchronous methods on all my objects absolutely fin...

Configuring TFS TeamBuild to execute different test categories on different Build Agents

I'm trying to understand how to configure TFS Team Build to provide a CI solution for my project. I have a fairly common setup that I have several categories of unit tests. For simplicity lets say there are two categories: Exchange2003 Exchange2007 Each test category needs particular software to be installed on the Build Agent so ...

How do you do TDD in Xcode?

Are there any good unit testing and acceptance testing frameworks that can be applied to XCode projects? I'm accustomed to doing TDD in Ruby and Python but am new to Objective-C and XCode. ...

named_scope dependent on existence of association is breaking tests

User model: class User < ActiveRecord::Base named_scope :clients, :conditions => "roles_users.role_id = #{Role.find_by_name('client').id}" end When testing, throws error: Called id for nil, which would mistakenly be 4 -- if you really wanted (etc.) Role fixtures: client: name: client user: name: user Apparent problem:...

Ways to test RESTful services?

I want to test my RESTful applications directly via HTTP and I am looking for tools that can help me with that task. Basically I am looking for an easy wrapper for HTTP requests that can submit e.g. HTML forms or serialized resources as JSON or XML. It would be great if there is a way to verify if the service is actually following REST ...

Setting CultureInfo in Tests project?

I've got an MVC app that I've set the globalization in the web.config. All is well in the web app. But in my tests project I'm getting an issue in my service layer. I'm asking for date of birth in the following format dd/MM/yyyy. I'm passing this as a string to my service layer. I've got a RegEx to check that it is formatted correctly bu...

Can PHP SimpleTest framework be configured to fail fast?

I'm new to the PHP SimpleTest framework, and I was surprised to see that a failed assertion doesn't halt the test method. In other words, this causes two failure messages in the test report: function testFoo() { $this->assertTrue(true, 'first: %s'); $this->assertTrue(false, 'second: %s'); $this->assertTrue(false, 'third: %s'...

Testing private method with Moq doesn't work

I am using Moq and I am sort of new to it. I need to test a private method. I have 2 assemblies. CustomerTest.dll CustomerBusiness.dll So CustomerTest dll has a class as follows: [TestFixture] public class CustomerTestFixture { var customerMock=new Mock<ICustomer>() customerMock.Protected().S...

What is the keyboard shortcut to run all unit tests in the current project in PyDev + Eclipse?

I know Ctrl + F9 runs a single file. How to run them all? If there is no such thing, how to bind one keyboard shortcut to it? ...