unit-testing

Rhinomocks 3.5 for dummies...ie me

I'm trying to use Rhinomocks 3.5 and the new lambda notation to mock some tests. I've read this, but have so many more questions. Are there any complete examples out there, especially for a MVC type of architecture? For example what is the best way to mock this. public void OnAuthenticateUnitAccount() { if(AuthenticateUnitAcco...

Unit/Integration Tests, how granular should they be?

I am testing the UI of my ASP.Net Web Forms app using NUnit/Watin. I understand the high level concepts around TDD, Unit Testing, integration testing etc, but have not had much of a chance to put them to use until now. So, when I am testing the validation logic on a data entry form, should I be writing one test that triggers each of ...

Where is a python real project to be used as example for the unit-test part?

I'm looking for a python project to use as example to copy the design of the unit test parts. The project should have these features: its code is almost fully unit tested the code is distributed in many packages, there are more that one level of packages all the test can be run with a single command, for example with python test.py ...

NUnit [TearDown] fails -- what process is accessing my files?

Hi All - Final Edit: I found a solution to the problem (at the bottom of the question). I've got an Nunit problem that's causing me grief. Edit: actually it looks more like a SQLite problem, but I'm not 100% certain yet. My TestFixture has a setup that generates a random filename that's used as a SQLite database in each of my tests. ...

Giving PHP object-type arguments a default value

Hello, I'm writing a PHP application with testability in mind, so my classes always ask in their constructors for the "collaborator objects" they depend on, in respect to the Dependency Injection pattern. That way, I'm able to pass in mocks or test implementations in my unit tests. What I want to achieve though, is to be able to insta...

Best practices for file system dependencies in unit/integration tests

I just started writing tests for a lot of code. There's a bunch of classes with dependencies to the file system, that is they read CSV files, read/write configuration files and so on. Currently the test files are stored in the test directory of the project (it's a Maven2 project) but for several reasons this directory doesn't always exi...

VSTS Unit test - build system

I have developed a build system on MSBuild (NET 3.0) and cc.net to perform continuous integration builds of a Visual Studio 2008 application, however a developer on the team recently added a VSTS unit test project to the mix. Is there any SDK or add-in provided by microsoft to allow this to be compiled on a non-team system build environ...

Automated testing .NET (Gallio?)

I am working on a software development project that uses code written primarily in C and C#. Currently, the responsibility of testing falls mostly on developers as they change the code. I am interested in implementing an automated testing framework to help us improve the quality of our code. In particular, it would be great to have ...

What exactly IS a unit test?

Same as title! EDIT: Almost exactly the same as, and would be contextually equal to http://stackoverflow.com/questions/1383/ ...

Best practices of unittesting methods that contain conditional conditions

I am new to unittesting and currently have a problem with finding a decent way to test methods that contain branches. I created a small demo method I hope could be used to explain the problem. public void ExportAccounts() { int emptyAccounts = 0; int nonEmptyAccounts = 0; int errorous = 0; string outputPath = this....

Unit testing framework for VC6 ?

Is there a unit test frame work that i can use in vc6 ...

How did you extend your Assert class

I love to Extend my Assert.AreEqual to many different classes, the known one is the CollectionAssert of course, but I can think of some more such as: ImageAssert, XmlAssert etc.. Did you Create your own Assert classes? and what kind of new would you like to create? ...

Separate Class vs Method

Quick design question. ClassA has a method called DoSomething(args) In DoSomething(), before it can actually do something, it needs to do some preparatory work with args. I believe this should be encapsulated within ClassA, (as opposed to doing the prep work outside and passing it in) as nothing else needs to know that this prep work ...

Assertion messages: assume failure, or assume success

When testing in any language, how does everybody phrase their assertion messages? I see three obvious ways: # assume failure assert (4-2) == 2, "Subtracting 2 from 4 doesn't equal 2" # describe success assert (4-2) == 2, "Subtracting 2 from 4 should equal 2" # be vauge with failure assert (4-2) == 2, "Subtracting 2 from 4 is broken" ...

What's the best way to unit test concurrent Erlang code?

I'm spending a bit of time with Erlang, and I'm wanting to apply TDD to code I'm writing. While EUnit in the standard lib provides a nice traditional unit testing framework for testing regular style code, there doesn't seem to be anything to help specifically with testing concurrent code, which is used a LOT in Erlang. Note that we're ...

Refactoring parameters and unit tests

I have this method: public bool CanExecute() And after 70 commits, I added an extra parameter public bool CanExecute(IStation target) Now the problem is I have 7 unit tests covering this CanExecute methods testing various nulls/property combinations. Adding this simple parameter required a fix of those 7 unit tests. The fix is sim...

How to make UnitTest fail automatically after some time?

I am using NUnit (2.4.6) and my build/test night are done with Team City 4. I have contacted team city and they already told me that they cannot handle this. So, here I am. What I want is to set up my test to do their testing as usual but in the case they hang up... for an unknown reason (this might happen...)... I do not want them to c...

c++ continuous integration with performance metrics

I want to set up a continuous integration and test framework for my open source C++ project. The desired features are: 1. check out the source code 2. run all the unit and other tests 3. run performance tests (these measure the software quality - for example how long does it take the system to complete the test) 4. produce a report base...

How do you deal with failing Unit Tests?

I have a number of projects in a solution file that have unit tests written for them and I am wanting to set them up to be run by our continuous integration server. However, because many of the tests have been written poorly and have not been run regularly there are many that are failing. I don't have the time at the moment to fix all o...

ParameterizedTest with a name in Eclipse Testrunner

When you run a JUnit 4 ParameterizedTest with the eclipse testrunner, the graphical representation is rather dumb: for each test you have a node called [0], [1], etc. Is it possible give the tests [0], [1] etc. explicit names? Implementing a toString method for the tests does not seem to help. (This is a follow-up question to JUnit test...