I am looking for TDD resources that are specific to Rails.
I've seen the Rails Guide: The Basics of Creating a Rails Plugin which really spurred my interest in the topic.
I have the Agile Development with Rails book and I see there's some testing-related information there. However, it seems like the author takes you through the steps o...
I am new to Unit Testing and therefore wanted to do some practical exercise to get familiar with the jUnit framework.
I created a program that implements a String multiplier
public String multiply(String number1, String number2)
In order to test the multiplier method, I created a test suite consisting of the following test cases (wi...
This question is a combination of regex practice and unit testing practice.
Regex part
I authored this problem separateThousands for personal practice:
Given a number as a string, introduce commas to separate thousands. The number may contain an optional minus sign, and an optional decimal part. There will not be any superfluous le...
Yes, it is possible to generate tests on boundary values for functions like "Sum" or "Divide". Pex is a good tool here.
But more often we create tests on business behaviour. Let's consider example from classic Beck's tdd book:
[Test]
public void ShouldRoundOnCreation()
{
Money money = new Money(20.678);
Assert.AreEqual(20.68,money.Amou...
I'm developing a static library in Obj-C for a CocoaTouch project. I've added unit testing to my Xcode project by using the built in OCUnit framework. I can run tests successfully upon building the project and everything looks good. However I'm a little confused about something.
Part of what the static library does is to connect to a UR...
Hello,
I want to test my routes in unit tests. But Areas is not working in my unit tests.
Is it possible to test ASP.NET MVC 2 routes for Areas?
I am using this code
[SetUp]
public void SetUp()
{
this.routes = new RouteCollection();
MvcApplication.RegisterRoutes(this.routes);
}
#endregion
private ...
Why my NUnit tests execute in different order than they are listed?
And upon what the execution order depends?
...
I'm having some trouble unit testing the model returned by DefaultModelBinder. I want to feed in a fake form collection and check the model that it returns to make sure model properties are being bound properly. In my research, I'm not turning up -any- resources on testing the DefaultModelBinder. Maybe I'm missing something. Maybe I shou...
We employ a test to filter out candidates who should not be applying for a position. The tests are designed to be very low effort for those who should be applying and too much effort for those who are not experienced.
Here is an example of a test we give to a candidate applying for a job of “java web application developer on an Oracle p...
I am new to moq and I was trying to test a controller (MVC) behaviour that when the view raises a certain event, controller calls a certain function on model, here are the classes -
public class Model
{
public void CalculateAverage()
{
...
}
...
}
public class View
{
public event EventHandler CalculateAvera...
I configured properties for my django project under pydev. I can run the django app under pydev or under console window. But I have problems to run unittest under pydev. I cannot run unittest for app under console window either.
I guessed it's something related to run configurations of pydev, so I made several trials, but with no succe...
I'm using Rhino.Mocks for testing the system.
I'm going to check the order of calling .LoadConfig and .Backup methods. I need .LoadConfig to be the first.
Currently the code is like this:
var module1 = mocks.Stub<IBackupModule>();
var module2 = mocks.Stub<IBackupModule>();
module1.Expect(x => x.Name).Return("test");
module2.Expect(x ...
I have several files with code testing code (which uses a "unittest" class).
Later I found it would be nice to test database integrity also. I put this into a separate directory tree. (Things like the keys have correct format, parent and child nodes are pointing correctly and such. Edit: this is a nosql project, where I can not rely on ...
Hi,
Is it possible to use Python's doctest concept for classes, not just functions?
If so, where shall I put the doctests - at the class' docstring, or at the constructor's docstring?
To clarify, I'm looking for something like:
class Test:
"""
>>> a=Test(5)
>>> a.multiply_by_2()
10
"""
def __init__(self, numbe...
Are there exists an simple AMPQ server/broker implementation written in Java?
I need it only for local integration tests, starting it from ant/maven, and i don't need any features like a clustering, persistence, performance and so on. Just a fake RabbitMQ-like instance, without installation (just as a dependency at maven pom) and config...
I am using SimpleTest version 1.0.1 for a unit test.
I create a new mock object within a test method and on it i do:
$MockDbAdaptor->setReturnValue('query',1);
Now, when i run this in a standalone unit test my tested object is happy to see 1 returned when query() is called on the mock db adaptor.
However, when this exact same test ...
I was testing a String multiplier class with a multiply() method that takes 2 numbers as inputs (as String) and returns the result number (as String)
public String multiply(String num1, String num2);
I have done the implementation and created a test class with the following test cases involving the input String parameter as
...
Hi - I'm trying out rspec, and immediately hit a wall when it doesn't seem to load db records I know exist. Here's my fairly simple spec (no tests yet).
require File.expand_path(File.dirname(__FILE__) + '../spec_helper')
describe SomeModel do
before :each do
@user1 = User.find(1)
@user2 = User.find(2)
end
it "should do ...
Hello,
I am trying to log the output of tests to a text file. I am using the unittest module and want to log results into a text file instead of the screen. I have some script here to explain what has been tryied so far. This is the test script.
import unittest, sys
class TestOne(unittest.TestCase):
def setUp(self):
self....
I´m encountering this problem trying to mock some objects that receive complex lambda expressions in my projects. Mostly with with proxy objects that receive this type of delegate:
Func<Tobj, Fun<TParam1, TParam2, TResult>>
I have tried to use Moq as well as RhinoMocks to acomplish mocking those types of objects, however both fail.
...