unit-testing

Unittest in Django. How to get the exception message from assertRaises()?

I used the assertRaises() to validation there will be an exception thrown and there is no problem of this. My question is, is there any way to get the exception message from assertRaises()? I would like to assert for different types of exceptiosn as well by parsing the exception message.. ...

can I run C# built-in unit test in build machine?

can I run C# built-in unit test in build machine which doesn't have Visual Studio installed? We are thinking add unit test to our Visual Studio 2008 C# project. Our build machine doesn't have VS installed and we want to integrate the new unit test with our auto-build system. Is MSTest the executable to launch the Team Test unit test? ...

Cucumber and Silverlight 4

So I am wondering if anyone is familiar or has done any work with cucumber and Silverlight. I currently have a template directory and build file that will create RSpec tests using Bacon (light weight RSpec). I have been looking into SpecFlow and Cuke2Nuke but almost everything I have seen works with general .net code not silverlight co...

Weird .net 4.0 exception when running unit tests

Hi guys I am receiving the following exception when trying to run my unit tests using .net 4.0 under VS2010 with moq 3.1. Attempt by security transparent method 'SPPD.Backend.DataAccess.Test.Specs_for_Core.When_using_base.Can_create_mapper()' to access security critical method 'Microsoft.VisualStudio.TestTools.UnitTesting.Asse...

c# Unit Test: Writing to Settings in unit test does not save values in user.config

I am running a c# unit test (VS 2008). Within the test I do write to the settings, which should result in saving the data to the user.config. Settings.Default.X = "History"; // X is string Settings.Default.Save(); But this simply does not create the file (I have crosschecked under "C:\Documents and Settings\HW\Local Settings\Applicati...

Setting up Google Toolbox For Mac for XCode 3.2 iPad project?

I'm attempting to get google-toolbox-for-mac working with my existing XCode 3.2 iPad project, but am unable to. I'd appreciate suggestions on what I am doing wrong. I followed the basic project setup found here: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting When I try to build my project I get 5 pages of consol...

How can I force WPF to make data bindings without showing the window?

I want to unit test a WPF application and one scenario is to check that data bindings are correct. The simple way to do that would be to create the form, force it to bind to data and then compare the values from the controls with the expected ones. Is there any way to do that? ...

Simulating a missing gem in Ruby unit tests

Is there any way to simulate the absence of a gem for certain unit tests, short of actually uninstalling and then reinstalling the gem during testing? I am writing a command line utility, and want to make sure that my tests cover cases where a user may not have all of the gems that I support. For instance, I am using fsevents — a Leopar...

Inspect in memory hsqldb while debugging

We're using hdsqldb in memory to run junit tests which operate against a database. The db is setup before running each test via a spring configuration. All works fine. Now when a tests fails it can be convinient to be able to inspect the values in the in memory database. Is this possible? If so how? Our url is: jdbc.url=jdbc:hsqldb:m...

How to mock Request.Files[] in MVC unit test class?

I want to test a controller method in MVC unit test. For my controller method to test, I require a Request.Files[] collection with length one. I want to mock Request.Files[] as I have used a file upload control on my view rendered by controller method. Can anyone please suggest how can I mock request.file collection in my unit test. th...

Unable to run unit test case in VS2008 in release mode

Hi All, I am trying to run unit test case in Visual Studio 2008. The test shows valid result(pass/fail) in debug mode, but in release mode it always shows the result as 'passed'. Is there any problem of Assert.AreEqual() method? ...

Does new JUnit 4.8.1 @Category render test suites almost obsolete?

Given question 'How to run all tests belonging to a certain Category?' and the answer would the following approach be better for test organization? define master test suite that contains all tests (e.g. using ClasspathSuite) design sufficient set of JUnit categories (sufficient means that every desirable collection of tests is identifi...

Visual studio 2008 unit test keeps failing

I've create a method that calculates the harmonic mean based on a list of doubles. But when I'm running the test it keeps failing even thou the output result are the same. My harmonic mean method: public static double GetHarmonicMean(List<double> parameters) { var cumReciprocal = 0.0d; var countN = parameters.Count; forea...

Unit Test in Maven requires access to the src/main/webapp Directory

Hello all, I am trying to unit test a webapp that I am developing in Maven/Eclipse. It is a Spring MVC webapp, and I need some unit tests to test my model controller. To do this, I need to use my webapp config .xml files to inject the controller, however, all my configuration (and other associated files that the configs reference) are ...

Creating Unit Tests Involving I/O?

Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing another object? ...

Rx framework: How to wait for an event to be triggered in silverlight test

Hi, I have a ViewModel that starts loading the Model async in the constructor, and triggers an event when the Model is loaded. I got a test working with the silverlight unit test framework, like this : bool done = false; [TestMethod] [Asynchronous] public void Test_NoCustomerSelected() { ProjectListViewMode...

Is automated unit-testing on Cognos possible ?

Hi everyone ! Does anyone know if there is any tool or a way to apply automated unit testing in report studio and/or framework manager ? When some regression tests are required and I need to run report by report, on the traditional way, it really bothers me. Best regards, Evandro ...

dbunit, can same XML representation of database file be used for different databases

Hi I am trying to do unit testing of database access layer of my project. But thing is i need to test this layer using apache derby database and during production testing i need to do it on oracle. So can i use same xml representation of database to do so using dbunit ? ...

PHP: How to begin testing large, existing codebase, and test for regression on production site?

I'm in charge of at least one large body of existing PHP code, that desperately needs tests, and as well I need some method of checking the production site for errors. I've been working with PHP for many years, but am unfortunately new to testing. (Sorry!). While writing tests for code that has predictable outcomes seems easy enough,...

Rails: unit test fails with "No such file or directory....database.yml" error

When I execute a Rails unit test from the command line (as suggested here) such as ruby unit/test_model.rb ...I get this error: No such file or directory - .../test/config/database.yml (Errno::ENOENT) Am I doing something wrong? Or is there a workaround? ...