unit-testing

Unit/integration testing Asterisk configuration

Unit and integration testing is usually performed as part of a development process, of course. I'm looking for ways to use this methodology in configuration of an existing system, in this case the Asterisk soft PBX. In the case of Asterisk, the configuration file is as much a programming language as anything else, complete with loops, j...

A good book on Unit Testing ASP.NET Web Apps in Visual Studio 2008

Hi, I'm starting a new web application project in VS 2008. I would like to use the Unit Testing framework included in VS 2008. Is this a good idea or are there any better Unit Testing frameworks that allow this? Any book recommendations? EDIT: This is webforms. I'm not using MVC. ...

How to run all tests belonging to a certain Category in JUnit 4

JUnit 4.8 contains a nice new feature called "Categories" that allows you to group certain kinds of tests together. This is very useful, e.g. to have separate test runs for slow and fast tests. I know the stuff mentioned in JUnit 4.8 release notes, but would like to know how I can actually run all the tests annotated with certain categor...

how to test asp.net mvc post actions using MvcContrib.TestHelper

I am trying to test my routing configuration using the excellent MvcContrib.TestHelper and I've run into a problem. Please assume that my Routing Configuration is set up correctly and initialised in the TestFixture. I have a controller (TransactionsController) action called Create that takes an input parameter of type TransactionReco...

How to moq a NetworkStream in a unit test?

Hi everyone! I'm using Moq & NUnit as a unit test framework. I've written a method that is given a NetworkStream object as a parameter: public static void ReadDataIntoBuffer(NetworkStream networkStream, Queue dataBuffer) { if ((networkStream != null) && (dataBuffer != null)) { while (networkStream.DataAvailable) { ...

any new firefox 3.5.X security improvements that'd prevent access "chrome://" uri paths in markup?

A little context: I'm trying to build and run the unit tests for the source of the Selenium IDE plugin. Everything builds correctly (through maven commands, et al) and the unit tests fire up an instance of Firefox. However, the jsUnit testRunner.html page freezes whenever a chrome://-accessed uri path is encountered. I realize there ...

UIKit and unit testing

Hi, I'm tying to implement some test cases for my iPhone app. I have successfully set up the UnitTest-Target as described here: iPhone development guide I'm also able to build a simple test case: - (void) testPass { STAssertTrue(TRUE, @""); } But when I'm trying to instantiate a class that has some methodes that return UIC...

SimpleTest for Wordpress plugins

Does anyone has any insight on unit-testing wordpress plugins with Simpletest, or other testing packages? ...

How to deal with private member accessor and collections?

I have a class hierachy like this public class A { protected class B { String Name { get; set; } } protected class C : KeyedCollection<String, B> { // ... } protected C Collection { get; } // ... public A Copy () { // Creates a deep copy of this instance. } } N...

How to Generate Android Testing Report in HTML Automatically

I would like to automatically generate unit testing report in html format for Android application on Hudson continuous integration server. Therefore, I try to run test cases first and gather test result files in xml format. Then, I use JUnitReport Task to transform the XML result files into HTML format. I run test cases through Androi...

When to use a unit testing framework (vs. just using asserts)?

Using a small (currently at 150 loc, probably less than 500 when finished) C project I'm working on, I'm teaching myself test driven development. Based on some stuff I've found on the web - especially these slides by Olve Maudal, I've just been using asserts in my unit tests. Since I'm just learning tdd, I have thus far avoided the ove...

Embed VSTS unit tests in standalone application

In visual studio there is the so called 'test view' that provides an overview of all unit tests within the current solution/project. I wonder if it is possible to embed this view into a standalone application. The idea is to have a standalone application that lets you run special integration tests on a staging system. Any ideas? ...

How to test non-dojo javascript code with doh?

doh is the dojo unit-testing framework. I am trying to use doh to test a non-dojo javascript code, but i am facing the problem that doh seems intrusive and oblige me to use dojo.provide() in the tested js file(and the corresponding dojo.require() in the test js file). I want the tested js file to be unmodified and dojo-agnostic. Is it po...

How to modify an invocation parameter of a mocked method with Moq?

Is it possible to modify an invocation parameter of a mocked method? In particular I'm looking to change buffer in the following example to a pre-populated byte array. Example: int MockedClass.Read(byte[] buffer, int offset, int count) Explanation: Calling Read loads count bytes reading from offset into the supplied byte array buffer. ...

Good examples of unit test suites

For those of us who like to learn by reading good code, what are some of the projects you've seen which provide a great example of a medium to large suite of unit tests in action? This isn't a question about what your favourite unit testing framework is, but it could be helpful to add which unit testing and/or mocking frameworks are use...

In MSTests is it possible to catch any exception?

I am trying to avoid a brittle test. I'd like to assert that a method throws an exception when invalid data is passed in, and I don't care which one. Take String.IsNullOrEmpty for instance, if the string is empty you don't want to throw a nullreference exception right? if it's null you I suppose you could throw an argumentException. I d...

Debug.Assert interferes with MSTests, how do I work around it?

So I have a method i'm unit testing via MSTests to ensure it throws an exception properly on bad data coming in. However that method has Debug.Assert so it's caught while debugging if it happens during an actual test where I'm in debug mode trying to find a bug. So the unit tests fail at being automatable when run in this way because...

JRuby and Test::Unit's assert_raise

I'm having trouble making assert_raise recognize java exceptions. I can do assert_raise(NativeException) { @iter.next } which works fine, but if I try to get more specific java_import 'java.util.NoSuchElementException' #... assert_raise(NoSuchElementException) { @iter.next } I get the error Should expect a class of exception, Ja...

How to make a unit test mock of an object with non-virtual functions

I have a C# class that gets generated using the wsdl.exe tool that looks something like this: public partial class SoapApi : System.Web.Services.Protocols.SoapHttpClientProtocol { public SOAPTypeEnum AskServerQuestion() { object[] results = return this.Invoke("AskServerQuestion"); return (SOAPTypeEnum) results[0]...

Failed to queue test run [...] Test run Deployment issue: The location of the file or directory [..] is not trusted.

I'm currecntly developping a sample orders management solution using VB.NET 2008, NHibernate, FluentNHibernate and Linq for NHibernate. On runtime, I get the following error: Failed to queue test run [...] Test run deployment issue : The location of the file or directory 'C:\Open\Projects\Examples[..]\FluentNHibernate.dll' is not t...