Is it possible to create a mock object that implements several interfaces with EasyMock?
For example, interface Foo and interface Closeable?
In Rhino Mocks you can provide multiple interfaces when creating a mock object, but EasyMock's createMock() method only takes one type.
Is it possbile to achieve this with EasyMock, without resor...
Dear ladies and sirs.
We are using mstest for unit tests at our company. The main reason is that there is no free Visual Studio integration for MbUnit (TestDriven.NET is not free for companies).
Recently, I have stumbled upon a need to run the same unit tests on two different implementations of the same interface. From my past experien...
I'm learning how to use the Boost Test Library at the moment, and I can't seem to get test suites to work correctly. In the following code 'test_case_1' fails correctly but it's reported as being in the Master Test Suite instead of 'test_suite_1'.
Anyone know what I'm doing wrong?
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto...
Does Python's unittest module always report errors in strict correspondence to the execution order of the lines in the code tested? Do errors create the possibility of unexpected changes into the code's variables?
I was baffled by a KeyError reported by unittest. The line itself looks okay. On the last line before execution halted, d...
I have a persistent object with 7 pertinent fields.
The fields can hold the number of values listed here:
Field # of Possible Values
1 5
2 20
3 2
4 2
5 19
6 2
7 8
Which is a potential for 121600 unique objects.
The code under test is a number of filters that grab a certain number...
I am tasked with writing unit tests for a suite of networked software written in python. Writing units for message builders and other static methods is very simple, but I've hit a wall when it comes to writing a tests for network looped threads.
For example: The server it connects to could be on any port, and I want to be able to test t...
I was reading and found this code as an aswer to a question
public List<T> LoadPlugin<T>(string directory)
{
Type interfaceType = typeof(T);
List<T> implementations = new List<T>();
//TODO: perform checks to ensure type is valid
foreach (var file in System.IO.Directory.GetFiles(directory))
{
//TODO: add pro...
I am using Xunit and NMock on .NET platform.
I am testing a presentation model where a method is asynchronous.
The method creates an async task and executes it so the method returns immediately and the state I need to check aren't ready yet.
I can set a flag upon finish without modifying the SUT but that would mean I would have to keep ...
For unit tests should you;
Write a test. Write code to pass it.
Refactor.
Or
Write all your known tests. Make one
pass. Refactor.
I ask this because TDD states you stop writing code after all tests pass but this point is unclear.
Edit
One thing I think TDD focuses on more for this "rule" is in relation to stories/task...
I have never written unit tests before, for various reasons. I have a chance to write tests now, comfortably, because I have a small app to make from scratch.
However, I'm a bit puzzled. The application is supposed to use a printer with a smart card reader to program data on a smart card. So here's the sequence of actions: Create device...
Jimmy Bogard, wrote an article: Getting value out of your unit tests, where he gives four rules:
Test names should describe the what and the why, from the user’s perspective
Tests are code too, give them some love
Don’t settle on one fixture pattern/organizational style
One Setup, Execute and Verify per Test
In your opinion these gui...
I'm trying to test a class (a controller) that doesn't need to run inside the asp.net environment.
But when I run the test, cassini starts.
How can I avoid the cassini load?
Thanks
...
I'm building a basic Composite WPF Shell with one Module. I would like to unit test my module. Apparently Composite WPF modularizes my code in such a way that it should be easy to unit test.
Below is the code I would like to Unit Test. It resides in my Module's Controller. Note the use of the standard Composite WPF entities like Region...
I have a basic web application (dynamic web project in eclipse) with an associated EAR project. I am trying to make sure that my junit test code stays out of the deployment EAR file.
In my web project I have a source folder called "src" and one called "test". I need to keep the .class files from the "test" source folder OUT of the EAR w...
I'm busy! Most of my time is spent using analytical techniques, or on course work, and when I switch over to programming mode I need to generate code quickly. Since, the Primary Investigator for the lab I'm in doesn't care if I'm using TDD or an abacus as long as I get results fast.
I've read "TDD by example" and found it quite helpful....
What methods do you use to unit test event handlers, particularly if they require information from the event (such as mouse coordinates, or the target of the event)? Is the most common practice to just refactor the behavior into a method that does the lifting while the handler just extracts information from the event, or are there effect...
Hi all
Beginner in Moq.
Trying to understand the use of verifySet etc... but unless I do a workaround I cannot get it to work.
public interface IProduct
{
int Id { get; set; }
string Name { get; set; }
}
public void Can_do_something()
{
var newProduct = new Mock<IProduct>();
newProduct.SetupGet(p => p.Id).Returns(1);...
Let's say we are testing the result of a method by asserting the equality of all the properties of the result object with properties of an expected result object. Should we implement equals method and use Assert.AreEqual(expectedResult, actualResult)... But equals may mean something different in production code.
Which is the best prac...
I've been using the YUI Test framework to do TDD with JavaScript but the default TestLogger shows all sorts of messages, not just the FAIL ones. This makes scanning the log for failures an exercise in tedium, or you have to play whack-a-mole on the filter checkboxes. Is there any way to make the toggle switches on the logger window stay ...
I have a class derived from HttpApplication that adds some extra features. I'm to the point where I need to unit test these features, which means I have to be able to create a new instance of the HttpApplication, fake a request, and retrieve the response object.
How exactly do I go about unit testing an HttpApplication object? I'm using...