tdd

What's the state of PHP unit testing frameworks in 2010?

As far as I can see, PHPUnit is the only serious product in the field at the moment. It is widely used, is integrated into Continuous Integration suites like phpUnderControl, and well regarded. The thing is, I don't really like working with PHPUnit. I find it hard to set up (PEAR is the only officially supported installation method, and...

Unit testing classes - is throwing errors out of the question?

I am getting my head around PHPUnit, and trying to build a test case for an existing class. The class is a static configuration class, getting, setting and listing configuration options that will be available in the application. The class is very strictly built. If I try to set a configuration setting with an incompatible value, or a c...

Unit-tests for a working codebase with limited time: How?

I have a few medium-sized Rails apps that I work on routinely, and only one of them has any unit tests at all. But I have seen the light and I want to change all that, except... I don't have the time to go in and starting writing tests class by class or something like that. How do you start writing unit tests on an existing -- and worki...

Unit test framework - TestNG using configurable value to define threadPoolSize

Hi guys.... I'm digging little bit the TestNG framework. I'm using annotations to configure thread values in my test case, example: @Test(threadPoolSize = 2, invocationCount = 10) public void testOne() { //some code } The idea is config these values in a config file and this values should be passed to all tests. So I...

How to TDD Asynchronous Events?

The fundamental question is how do I create a unit test that needs to call a method, wait for an event to happen on the tested class and then call another method (the one that we actually want to test)? Here's the scenario if you have time to read further: I'm developing an application that has to control a piece of hardware. In order ...

Why is PHPUnit ignoring assertions when expecting an exception?

I have a simple unit test case (extensive question here) on a configuration class that by design triggers PHP errors on type mismatches and undefined configuration settings. In addition to the error, the method is exited returning false. In my test case, I want to have a number of tests that fail. Trouble is, I can't do a simple 'assert...

"Web interface" to PHPUnit tests?

Is there a simple "Web interface" to running PHPUnit test suites? i.e. a PHP script that runs the test on the command line, and outputs a nicely formatted HTML result. I develop web applications, and the day-to-day workflow usually switches between the IDE and the browser. I would like to have the unit testing in the same environment. ...

Moq + VB.NET - will it be fully supported in VS2010 automatically in its current form?

Hello, We are looking to make a final decision on our Mocking framework. After trying several, I have fallen in love with Moq. I also love TypeMock - but because we are in the early stages of implementing TDD across the team, we do not want to make such a large investment quite yet. We are using VS 2008 now and are going to move to 2010...

Nmock2 and Event Expectations

Im in the process of writing a test for a small application that follows the MVP pattern. Technically, I know I should have written the test before the code, but I needed to knock up a demo app quick smart and so im now going back to the test before moving on to the real development. In short I am attempting to test the presenter, howe...

Convert C# unit test names to English (testdox style)

I have a whole bunch of unit tests written in MbUnit and I would like to generate plain English sentences from test names. The concept is introduced here: http://dannorth.net/introducing-bdd This is from the article: public class CustomerLookupTest extends TestCase { testFindsCustomerById() { ... } testFailsForDupl...

Best way to make an attribute always an array?

I'm using my MOO project to teach myself Test Driven Design, and it's taking me interesting places. For example, I wrote a test that said an attribute on a particular object should always return an array, so -- t = Thing.new("test") p t.names #-> ["test"] t.names = nil p t.names #-> [] The code I have for this is okay, but it doesn...

Webforms MVP Passive View - event handling

Should the view have nothing event specific in its interface and call the presenter plain methods to handle events and not have any official EventHandlers? For instance // ASPX protected void OnSaveButtonClicked(object sender, EventArgs e) { _Presenter.OnSave(); } Or should the view have event EventHandlers defined in its interfac...

TDD Exercise Ideas

I am about to give a TDD workshop. I have the theoretical part pretty much sorted out, but I wish to avoid typical Tic-tac-toe, Currency or god forbid Calculator exercise. Any suggestions for a good TDD exercise that can be ideally finished in a couple of hours? It would be great if you could list the most important test cases (includi...

Please suggest any good TDD books for a beginner in windows programming.

Assume that my knowledge in programming is in novice level. Many thanks. ...

Anyone using Moles / Pex in production?

Hi all, I did search the forum and did not find a similar question. I'm looking to make a final decision on our mocking framework of choice moving forward as a best practice - I've decided on Moq... untill I just recently discovered MS has finally created a mocking framework called Moles which seems to work similar to TypeMock via the p...

How to implement countdown timer class in TDD?

I'm learning to do TDD in practice in small project. I want to create a countdown timer class, how to implement it in TDD(Red, Green, Refactor), and it has the delegate callback as well. ...

Test Driven Development For Complex Methods involving external dependency

I am implementing a Service Contract for WCF Service. As per TDD I wrote a test case to just pass it using hardcoded values. After that I started to put real logic into my Service implementation. The actual logic relies on 3-4 external service and database. What should I do to my original test case that I wrote ? If i Keep it same in...

AutoMockContainer with support for automocking class-instances

I have a constructor which has a non-interface dependency: public MainWindowViewModel(IWorkItemProvider workItemProvider, WeekNavigatorViewModel weekNavigator) I am using the Moq.Contrib automockcontainer. If I try to automock the MainWindowViewModel class, I get an error due to the WeekNavigatorViewModel dependency. Are there any a...

NUnit [Test] is not a valid attribute

I've included the necessary assemblies into a Windows Class project in VS2008. When I start to try to write a test I get a red squiggle line and the message [Test] is not a valid attribute. I've used NUnit before... maybe an earlier version. What am I doing wrong? I'm on version 2.5.2. using System; using System.Collections.Generic; usi...

Moq - How to mock a function call on a concrete object?

Hello, How can I do this in Moq? Foo bar = new Foo(); Fake(bar.PrivateGetter).Return('whatever value') It seems I can only find how to mock an object that was created via the framework. I want to mock just a single method/property on a concrete object I've created... In TypeMock, I would just do Isolate.WhenCalled(bar.PrivateGetter...