unit-testing

In MS C# Unit Testing, how to Assert that an ArgumentException occured?

If we do a throw new ArgumentException("Cannot do that"); How do you Assert that this ArgumentException happened with Microsoft's Testing Framework? ...

Testing for external resource consistency / skipping django tests

I'm writing tests for a Django application that uses an external data source. Obviously, I'm using fake data to test all the inner workings of my class but I'd like to have a couple of tests for the actual fetcher as well. One of these will need to verify that the external source is still sending the data in the format my application exp...

Assert.AreEqual failed on two identical MVC ViewModel results?

I got this error on my unit test: Assert.AreEqual failed. Expected:<ShizoMe.Web.ViewModel.AccountViewModel>. Actual:<ShizoMe.Web.ViewModel.AccountViewModel>. This is the code for my test: [TestMethod] public void Register_Prevents_Duplicate_Users() { var controller = GetAccountController(); var model = new A...

Developing XSLT with TDD/BDD

I've been assigned the task of creating an XSLT transform on an XML dump from a database. Being a believer of Test/Behavior Driven Development I was wondering if anyone has attempted it before or has advice about how to go about it. My gut reaction is to test this 'black box' with rspec. Is there a unit testing framework out there f...

Unit Testing Core Data - exited abnormally with code 134

Hello all, I am setting up unit testing for my core data app. I'm running into a strange problem in a pretty simple test. The error I'm getting is: /Developer/Tools/RunPlatformUnitTests.include:451:0 Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/Developer/usr/bin/otest' exited abnormall...

What to do with non-regressive tests?

Not really a Ruby on Rails question, but that is the framework which we are working in. We are migrating data from a legacy system into our own system, and have been testing the code that will do the data migrations. These tests live alongside the rest of the applications tests, and so ran against our build server on commits, etc. Onc...

Writing Unit-Tests in C++

Possible Duplicate: Comparison of c++ unit test frameworks Hello guys, I'm coming from .net to C++ and I want to know if there i good articles/information about unit-testing in c++ and the most used/best frameworks for doing it. Thanks in advance. ...

How to unit test functions calling localtime() in Perl?

I have a method calling localtime that I wrote a unit test for. I seed the call to localtime in my test so that I know the expected answers. So far, so good. I happen to run the unit test on a machine in a different timezone and, predictably, the tests fail, because they're some # of hours off. I suppose I could dynamically determine...

Unit testing infrastructure for a python module

Hi there, I'm writing a python module and I would like to unit test it. I am new to python and somewhat bamboozled by the options available. Currently, I would like to write my tests as doctests as I like the declarative rather than imperative style (however, feel free to disabuse me of this preference if it is misinformed). This rai...

Is integration testing an umbrella term and if so, what types of tests does it include?

I find the concept of 'integration testing' confusing. There seems to be quite a few explanations and scopes: Functional/acceptance testing (e.g. testing the user interface with for example, Selenium) Testing the integration of different classes/modules of software together (simply testing two or more classes together, without them doi...

Auto testing a user's age fails every year

I want to test the age of a user of my Rails application using cucumber. The feature definition look somewhat like following. Scenario: Successful calculation of age Given I set my date of birth to "1987-07-15" Then my age should be "22" Above feature definition will fail every year since the age of user will increase by one each ...

Unit testing WaitHandler.WaitAll

Is there a way to unit test WaitHandle.WaitAll() when using Visual Studio's built-in unit testing solution. When I try and run a test that uses this function within Visual Studio the test fails and when examining the test results the following error is displayed: WaitAll for multiple handles on a STA thread is not supported I'd like...

How to execute a method when a test fails

I am unit-testing a a .NET project using visual studio's own framework where each test needs to close certain connections so that the next test may run correctly. However, when a test fails, this cleanup is not performed, and as a result all subsequent tests fail. Is there a way I can execute a method everytime a test fails? ...

Unit testing the android platform

So, I was finally able to build and debug the android platform (the process can be seen here). Now, the question is: where are the unit tests, how do I launch them and where do I see results? And also, is there any guide to android platform architecture? ...

Unit testing an HTML parser/cleaner?

Hi everyone, I'm trying to choose between a couple of different HTML parsers for a project I am working on, part of which accepts HTML input from the client. I've built a simple automated test for each one, to see if they fit my needs. I have a large number of real-life HTML fragments to test, but they aren't enough for testing for saf...

How do I send a RST instead of a normal close, for testing?

I have some code that seems to not handle it well when a TCP connection is closed via the RST flag instead of a normal handshake for closing the connection. The "connection reset by peer" situation. I'd like to write a TCP server that always closes via RST so that I can reproduce the bug and write some unit tests for this. So... How do ...

Is there a way in phpunit to use the database extension together with the selenium extension?

Basically, I want to run selenium tests that allow the database to be setup to a define status before each Selenium test. How would I do this? ...

Error Building Core Data Stack in Unit Tests

Hello, I am trying to get started with unit testing an app that uses Core Data. In the setUp method of my unit first test, I can get the path to my data model but for some reason cannot convert it to a NSURL. My setUp method is: - (void)setUp { NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.testcompany.LogicTests"]; ...

How can Twisted Deferred errors without errbacks be tested with trial?

I have some Twisted code which creates multiple chains of Deferreds. Some of these may fail without having an errback which puts them back on the callback chain. I haven't been able to write a unit test for this code - the failing Deferred causes the test to fail after the test code has completed. How can I write a passing unit test f...

PHPUnit, mocked interfaces, and instanceof

Sometimes in my code, I'll check to see if a particular object implements an interface: if ($instance instanceof Interface) {}; However, creating mocks of said interface in PHPUnit, I can't seem to pass that test. // class name is Mock_Interface_431469d7, does not pass above check $instance = $this->getMock('Interface'); I under...