I'm implementing the specification pattern. I've written an unsatisfying test for my LogicalAnd specification. The test is 'acceptsAnyNumberOfSpecificationAsParts'. How can I make this test independent of the order of the containing specifications? One caveat: I'm not 'getting' the containing parts and I'm not willing too.
I currently h...
My company is trying to decide if we are going to standardize on Moq, Rhino Mocks or MS Moles and Stubs.
I know Rhino Mocks and Moles and Stubs fairly well. But I am unfamiliar with Moq. How does the syntax work? Does it support Arrange Act Assert (AAA) like Rhino Mocks (I hear they created it, but I am not sure). Does it have stron...
I'm working on a project at the moment where I need to inter-operate with code that swallows exceptions. In particular, I'm writing NUnit unit tests. There are some places where I want to embed assertions within code that gets passed as a delegate, as part of mocking a particular behavior. The problem I'm having is that the AssertionE...
Where can I find a legend for the default colors used by Emma for highlighting source code when a HTML coverage report is generated?
...
I've bumped into a very strange problem lately with my friend while using unit test framework in Visual Studio 2010. We have created TestProject (let's call it NoTitleTests) that references few libraries ("casual" and "xna" dlls) and it works without any problem.
But when we added NoTitle project (which is a XNA game) to references, when...
I am currently making some Acceptance-Tests that will help drive the design of a program I am about to do. Everything seems fine except I've realized that the Acceptance-Tests are kinda complex, that is, although they are conceptually simple, they require quite a bit of tricky code to run. I'll need to make a couple of "helper" classes f...
im writing an app with express.
main file is called server.js
one of the objects is var app = express.createServer(express.logger(),
express.bodyDecoder());
then i have app.get("/",function(req, res){
res.send("Running");
}
how do i use expresso, [or any other testing framework for that
matter], to test the routes output?
I looked a...
Hi,
I have a quite long method. It copy an ActiveRecord object with all relations, and changes relations in some cases. To make code more readable, I use private methods. I would like to test them. Technicaly, in Ruby it is no problem, but I suspect, I have bad design. Do you have any advices how to deal with such case?
...
I know this question is not a hard one.
I want to implements jUnit on a small project I'm working on because I want to learn a little bit about it.
The tutorials that I read all make reference to method that have a particular output.
In my case my output are files, how can I do this? any simple example?
any aproach that could help me ...
Hi all,
I've following abstract class and have a question about how to write a unit test for this. Is this in fact needed? As this class doesn't have any concrete methods.
<?php
abstract class PickupPoint_Abstract {
public function __construct($client) {}
public function getPickupPoints($countryCode, $postalCode, $city) {}
...
Hello! I have a client server application and for testing purposes I need to start the client in a test method by calling
Client.main();
That creates some new thread. Now I need to wait until that thread is completed before performing assertions in my test. How do I know when this happens? Alternatively, how do I know, which thread wa...
The short document of Moq doesn't help me to understand this. Help!
...
I read the question at http://stackoverflow.com/questions/980554/what-is-the-purpose-of-verifiable-in-moq and have this question in my mind. Need your help to explain that.
...
I'm testing a method that logs warnings when something went wrong and returns null.
something like:
private static final Logger log = Logger.getLogger(Clazz.class.getName());
....
if (file == null || !file.exists()) {
// if File not found
log.warn("File not found: "+file.toString());
} else if (!file.canWrite()) {
// if file is ...
Hello,
I am relatively new to using TDD and have been reading about mocking objects lately. I have the following test to test a method that given a date returns the next saturday.
[TestMethod()]
public void NextSaturdayTest()
{
DateTime date = new DateTime();
date = DateTime.Parse("2010-08-14"...
In these typical business apps, written by small software companies (even solo). Is there really any benefit in unit testing? (i'm talking about those typical custom made apps like an automated invoicing app.)
Mind you: I'm not questioning the benefits of unit testing (clean code, improve refactoring ability etc.) but i'm questioning th...
Hi all,
I've got following factory class which has a dependency $client. I moved the dependency to the factory class as it first occurred in Service_Service1 class so I could test the service class. But how can I test the factory class?
class Factory implements Service
{
public static function factory($service)
{
$conf...
I have a class library I want to unit test using Microsofts unit test framework. Some of the classes I want to test are configured using application settings. These settings are defined inside the Settings.settings file having application scope and suitable default values. When the library is used by the application these settings can be...
I am working on a Magento 1.4.1 project, and I want to use PhpUnit to test my models.
I am able to run my PhpUnit test using the default connection, but I want to use a different database connection than the one I use to test the interface.
What I would like to know (if its possible):
Is there a way to select a different
connection f...
I have an existing asp.net web application that I'm updating to include some MVC pages. I have successfully upgraded the web app to recognize my MVC controllers/views/... I can even get my test page to display correctly: hooray!
However, I am having trouble figuring out how to add a test project so that I can add my unit tests for the...