unit-testing

What's your recommandation for C Unit Testing Framework ?

The framework should be as portable as possible. Thank you! Later Edit: If possible I am looking for something similar (as approach) with Java's Junit. ...

RhinoMocks Stub return real instance

I'm trying to use RhinoMocks to stub out a third party component. The third party component looks like the following. public class connection { public connection(string host,int port) {} public void Submit(message msg) {} } public class message { public message(string recipient) {} { When I attempt to use a s...

Why is my Extension Method not showing up in my test class?

I created an extension method called HasContentPermission on the System.Security.Principal.IIdentity: namespace System.Security.Principal { public static class IdentityExtensions { public static bool HasContentPermission (this IIdentity identity, int contentID) { // I do stuff here ...

How do I get developers to treat test code as "real" code?

In the last two companies I've been at, I have found an overriding mentality among developers that it's okay to write unit tests in a throw-away style. Code that they would never write in the actual product suddenly becomes OK in the unit tests. I'm talking Rampant copying and pasting between tests Code styling rules not followed Har...

Finding patterns of failure in a Unit Test

I'm new to Unit Testing, and I'm only getting into the routine of building test suites. I have what is going to be a rather large project that I want to build tests for from the start. I'm trying to figure out general strategies and patterns for building test suites. When you look at a class, many tests come to you obviously due to the ...

Configuring TeamCity + NUnit unit tests so files can be loaded properly

In a nutshell, I have a solution that builds fine in the IDE, and the unit tests all run fine with the NUnit GUI (via the NUnitit VS2008 plugin). However, when I execute my TeamCity build runner, all unit tests that require file access (e.g. for running tests against specific XML files), I just get System.IO.DirectoryNotFoundExceptions....

Where to start with the development of first database driven Web App (long question)?

Hi all, I've decided to develop a database driven web app, but I'm not sure where to start. The end goal of the project is three-fold: to learn new technologies and practices, deliver an unsolicited demo to management that would show how information that the company stores as office documents spread across a cumbersome network fold...

Any tool to make git build every commit to a branch in a seperate repository?

A git tool that meets the specs below is needed. Does one already exists? If not, I will create a script and make it available on GitHub for others to use or contribute. Is there a completely different and better way to solve the need to build/test every commit to a branch in a git repository? Not just to the latest but each one back to ...

Python unit-testing with nose: Making sequential tests

I am just learning how to do unit-testing. I'm on Python / nose / Wing IDE. (The project that I'm writing tests for is a simulations framework, and among other things it lets you run simulations both synchronously and asynchronously, and the results of the simulation should be the same in both.) The thing is, I want some of my tests to...

I am having issues with django test

I have this test case def setUp(self): self.user = User.objects.create(username="tauri", password='gaul') def test_loginin_student_control_panel(self): c = Client() c.login(username="tauri", password="gaul") response = c.get('/student/') self.assertEqual(response.status_code, 200) the view associated with the test cas...

unittest tests reuse for family of classes

I have problem organizing my unittest based class test for family of tests. For example assume I implement a "dictionary" interface, and have 5 different implementations want to testing. I do write one test class that tests a dictionary interface. But how can I nicely reuse it to test my all classes? So far I do ugly: DictType = hashta...

How to setup and teardown temporary django db for unit testing?

I would like to have a python module containing some unit tests that I can pass to hg bisect --command. The unit tests are testing some functionality of a django app, but I don't think I can use hg bisect --command manage.py test mytestapp because mytestapp would have to be enabled in settings.py, and the edits to settings.py would be ...

Nested Resource testing RSpec

I have two models: class Solution < ActiveRecord::Base belongs_to :owner, :class_name => "User", :foreign_key => :user_id end class User < ActiveRecord::Base has_many :solutions end with the following routing: map.resources :users, :has_many => :solutions and here is the SolutionsController: class SolutionsC...

Web Test Tool that can capture amf calls and replay them?

Is there a tool that can record amf calls being made from a flex application (swf) and replay them? + do a load test? I tried Visual Studio 2010 and with FluorineFX this works. But are there other tools around that can do the same? ...

Testing the existence of single instance -Singleton-C#

How to write test in Nunit to test that only one instance is created by my singleton class. ...

What is a really simple explanation of unit testing?

I've never done any unit testing before, and would like to learn what it is and how it can be useful in my Python code. I've read through a few Python unit testing tutorials online but they're all so complicated and assume an extended programming background. I'm using Python with Pylons to create a simple web app. Any simple examp...

Rhino Mocks - Difference between GenerateStub<T> & GenerateMock<T>

Can any of the Rhino experts explain me by giving a suitable example of the differnce between the above methods on the MockRepository class (Rhino Mocks framework).Where should one use Stub over Mock method or otherwise? ...

How to write tests with mocks using f#

I'd like to write F# unit test with mock objects. I'm using NUnit. But unfortunately I couldn't find any examples. Here's an example of the code under test: type ICustomer = interface abstract Id: int with get abstract Name: string with get abstract CalculateBalanceWithDiscount: decimal -> decimal end type Customer = cla...

How often should we write unit tests?

Hi, I am recently introduced to the test-driven approach to development by my mentor at work, and he encourages me to write an unit-test whenenver "it makes sense." I understand some benefits of having a throughout unit-test suite for both regression testing and refractoring, but I do wonder how often and how throughout we should write u...

FlexUnit nested async tests

I'm trying to test some async functionality in flex 4. My test has two stages : var loader:MySuperLoader = new MySuperLoader() loader.load('foo.swf'); loader.addEventListener(Event.COMPLETE, Async.asyncHandler(this, function(e:Event):void { loader.removeEventListener(Event.COMPLETE, arguments.callee); var foo:* = loader.content;...