unit-testing

Running NUnit Tests in parallell using NANT

Hi, We have different categories of tests under various assemblies. What is the best possible way to run them in parallel? I am aware of a task in ant, is there any such task in NANT? Kind regards, ...

FileLoadException when running unit tests in visual studio

I'm trying to run some unit tests in VS 2005 and keep getting the following error System.IO.FileLoadException: Could not load file or assembly 'Tests.CS.vs2005, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) at System.Refl...

determine the http status that will be sent in php

I am trying to write a test case for a class that is managing headers for my application. Among the headers it sends are http status headers. I am using headers_list() to see which headers would be send, were I to send headers now. The problem with headers_list() is that it does not include the http status header (although this seems to ...

Does mobile 6 phones generate a .dll?

Hi I want to grab the .dll from a mobile phone application I am making since I want to add it to my nunit so I can write & test my application. Yet I don't see any .dll in the bin folder. How do I unit test it? ...

Integrate Unit test into Visual Studio Express 2008

Is it possible to integrate any unit test framework into VS2008 express? ...

Unit Testing - How to go about it?

I want to unit test my program (in C) because I know of the benefits of doing so as well, as it shows where the problem is. I also like to blackbox test, since it tells me if the program works (at least, for the tests). At the moment, I am using Autotest (Which comes with Autoconf) in order to not add a dependency. At this point, I wo...

Unit testing jQuery document.ready function

Hi all: I have a question in regards to unit testing jQuery's document.ready function(). Currently I have 2 scenarios in my code: function myFunction() { $(document).ready(function() { ... }); } And: $(document).ready(function() { // some really long setup code here }); I tried to write a unit test for the first scenario,...

What's the proper way to save a object with nhibernate?

Hi, I'm new to Hibernate, I just started to do a mapping to a table, but I'm having some problems when I try to write an object, here's my unit test: [TestFixture] public class FacilityRepositoryTest : DatabaseRepositoryTestsBase { private IRepository<Facility> repository = new Repository<Facility>(); [Test] public void Can...

How to find the value that has been passed to a method on my mocked (Moq or Rhino Mocks) interface?

I am using Moq - but could easily swap to another mock framework if needed. I have a interface defined: public interface IBaseEngineManagerImp { void SetClientCallbackSender(IClientCallbackSender clientCallbackSender); } I then mock IBaseEngineManagerImp with mockEngineManagerImp = new Mock<IEngineManagerImp>(); EngineManager eng...

Save object in debug and than use it as stub in tests.

My application connects to db and gets tree of categories from here. In debug regime I can see this big tree object and I just thought of ability to save this object somewhere on disk to use in test stubs. Like this: mockedDao = mock(MyDao.class); when(mockedDao.getCategoryTree()).thenReturn(mySavedObject); Assuming mySavedObject - is...

How to Speedup WCF “unit” tests? (Creating/closing the ServiceHost is slow...)

I am in the process of writing some test for a server that is implemented in WCF, as the messages are complex and call-backs are made to the clients I wish to include WCF in the tests. (You may wish to call these “fit” or “integration tests” not unit tests, the code on both side of WCF will have more detail unit test that don’t use WCF....

How can I find a TCP port that is free with NetTcpBinding (WCF) (so a server can bind to it)

Find the next TCP port in .Net says how to do this in raw .net, but not how to safely to this with WCF. In my unit tests, I need to use the NetTcpBinding, I do not wish to hard code the port it is using. Therefore how can I get the NetTcpBinding to automatically choose a free port when used in my ServiceHost? How can I get it to tel...

How to verify that method argument's property values are set when mocking methods with Moq?

Not sure if it has been asked before, here is the question. Code first: public class Customer { public string Password { get; set; } public string PasswordHash { get; set; } } public class CustomerService { private ICustomerRepository _repo; public CustomerService(ICustomerRepository repo) { _repo...

Should JUnit tests be javadocced?

I have a number of JUnit test cases that are currently not documented with Javadoc comments. The rest of my code is documented, but I'm wondering if it's even worth the effort to document these tests. ...

Unit testing: how to access a text file?

I'm using Visual Studio 2008 with Microsoft test tools. I need to access a text file from within the unit test. I've already conf the file to 'build action=content' and 'copy to output directory=copy always' but the file is not being copied to the output dir, which according to System.Environment.CurrentDirectory is '{project_path}\Tes...

Testing rails routes: can't find ActionController::Assertions::RoutingAssertions methods

I'm trying to test the routes on my rails 2.3.4 application. There are several sites that explain how to test routes, including the rails docs, but I'm getting errors following the instructions. First, I'm assuming that these tests can be done in related unit test files. There seems to be no more obvious place, and none of the docs spec...

Getting Assert to work in Visual C++ Unit Tests?

I'm using Visual Studio 2008's built in testing framework in my Visual C++ project. I'm adding a new Test Project, then a new Unit Test. However, I can't use any of the functions provided by Assert. Assert shows up in the Intellisense, but I can't do anything with it. I've done unit tests fine in Visual C#. Am I forgetting to do anything...

Hide stderr output in unit tests

I'm writing a few unit tests of some code which uses sys.stderr.write to report errors in input. This is as it should be, but this clobbers the unit test output. Is there any way to tell Python to not output error messages for single commands, à la 2> /dev/null? ...

Active record and Repository patterns together. Is It acceptable?

I really like these two patterns. The drawback of Repository pattern is its cost(takes more time then Active record). Benefit is higher abstraction which really helps on complicated business logic. The drawback of Active record is that lower testability(db interaction is required) and harder in handling complicated domain logic. Is it...

Is this a good way of testing Perl code?

I'm writing a module that has some functions dealing with text files. I'm new to testing, so I decided to go with Test::More. Here's how my test file looks like now: use mymod; use 5.10.0; use strict; use warnings; use Test::More 'no_plan'; my $file_name = "test.file"; sub set_up { my $self = shift; open(my $handle,">",$file_n...