tdd

Testing for extra_context in django

Hi, I'm trying to test if the extra_context provided by the user was correctly processed in the view. Here is my test approach: # tests.py (of course it's a part of TestCase class) def test_should_use_definied_extra_context(self): response = self.client.get(reverse('contact_question_create'), { 'extra_context': {'foo': 'ba...

Proper way to test Django signals

I'm trying to test sent signal and it's providing_args. Signal triggered inside contact_question_create view just after form submission. My TestCase is something like: def test_form_should_post_proper_data_via_signal(self): form_data = {'name': 'Jan Nowak'} signals.question_posted.send(sender='test', form_data=form_...

Random query execution time in test case

Hi, I'm testing a method with quite huge sql query. I has about 15 joins, one subquery with 2 joins, so it is complex. But each running takes different time. Once it is 4 second, sometimes 80, or even 200 seconds. It is standard unit test, with preparing data with FactoryGirl, and data is always the same. Is there any mysql profilers, m...

How does TypeMock mock sealed classes and non-virtual methods?

I don't want to know how to use TypeMock. I'm just intrigued as to how it manages to mock non-virtual methods and sealed or static classes. I'd like to try to do something similar - for the fun of it. How are the generated classes apparently able to inherit from sealed classes? ...

Run a single test in Flash Builder?

I have been using Flash Builder to build my flex software and I am a TDD guy. I find it irritating that I have to run ALL my tests in order to run any tests. It causes friction in my TDD workflow. I really want to write a test, and run that test in isolation. I do this in .Net all the time (with TD.NET plugin), but I can't find a way...

TDD for Ant Script Development

I have been handed a complex set of Ant scripts for feature additions and maintenance. No test framework whatsoever has been used for developing those in the past. I want to start developing the new features inside tests. The scripts use a mix of ant, ant contrib and custom made tasks, I am not going to be adding any new tasks, just scri...

Useful design patterns for unit testing/TDD?

Reading this question has helped me solidify some of the problems I've always had with unit-testing, TDD, et al. Since coming across the TDD approach to development I knew that it was the right path to follow. Reading various tutorials helped me understand how to make a start, but they have always been very simplistic - not really somet...

Testing your code programmatically: by the programmer or someone else?

So here is the situation-- a quote from my boss: "[...] we need to focus on programming. [...] At the end of the day I want to write good software and not get bogged down with testing." This is said after we have had 3 months of a daunting list of bugs and recently designating a non-programmer to write web tests with Selenium framework...

How to unit-test an event loop?

Hi there, I'm programming an HTTP proxy in Python (transparent proxy for request/response monitoring). But as a TDD adopter, I'm starting the project with HTTP inputs that should be caught by a TCP server. But, as any server, it must run within an event loop, so that it can listen in a specific port. Well, since starting the event loop...

Unit testing/documentation/code implementation in the same file?

Today we have documentation and code implementation in the same file: # @returns <String> A combined string def say :this :that return "#{this} "{that}" end I have never seen unit testing in the same file like: # @if_insert "good", "morning" # @should_return "good morning" # # @returns <String> A combined string def say :this :tha...

Statistics of positive impact of TDD/BDD

Everyone knows about some relevant statistics about positive impact of using test/behavior driven development in real projects. I know statistics can be very misleading, but it would be nice to see something like: "when started using TDD, we rose productivity and reduced bugs introduction by XY %...". It would be really nice to sh...

overwhelmed with test results

I am getting a bit overwhelmed with number of test result files and directories being produced by Microsoft's own test framework (which comes with VS2010). Does anyone know where to tell the test project not to save the results files or at least not keep so many? Cheers ...

Does Moq replace standard VS 'Assert' testing?

I am trying to understand how to use Moq, however I am having some confusion about what Moq should be used for. My understanding is that mock framework are used for generating objects which would be difficult to create under normal circumstances. The examples I have seen of Moq however seem to not only create Moq object, but also provide...

Asynchronous TDD - Test Class blocks

How do I create a unit test to test a class that sits in a loop? Here's the scenario. I have a class that is injected with a reference to a serial port. The class has a method called Send(String data); This public method invokes an aysnchronous private method to do the actual work. The class under test (CUT) should do the following ...

TDD and MVC Model Binding

Let's say I have this unit test: [Test] public void LastNameShouldNotBeEmpty() { ExampleController controller = new ExampleController(); Person editedPerson = new Person { FirstName = "j", LastName = "" }; controller.EditPerson(editedPerson); Assert.AreEqual(controller.ModelState.IsValid, fa...

What's the best technique to build scalable (extensible), maintainable, and loosely coupled software?

I have been playing around with the concept of 'module' that some mvc frameworks implement and it seems like a good solution, and also with TDD, but I think there must be something more, like a design pattern I missed (I only know a few), that will let me build applications that can grow (in code) with no limits. Any thoughts? edit : ...

Are there free mocking frameworks that can mock methods and classes that are non-virtual, static or sealed?

I know there is TypeMock and JustMock, but both are commercial products and quite expensive. Are there free or open source mocking frameworks that can compete with the two? I am currencly using Moq, but I'm wondering if open source can catch up? Maybe Moles is the answer (http://msdn.microsoft.com/en-us/library/ff798506.aspx), although ...

BDD in Google App Engine (Python)

I have seen some mention of some form of TDD for Python with Google App Engine, however I've not really seen a discussion of a BDD approach. Is someone familiar with how to string this together properly with GAE? I'm hopeful that things may be in a better position for this now than they were from notes and articles I saw from about a y...

Using TDD with OpenXml-SDK

I have started using a TDD approach to develop a small app that reads data from Excel files. Using a repository pattern type approach I have come to a hurdle which baffles me. In order to read the Excel files, I am using the OpenXml-SDK. Now typically reading from an Excel file using the SDK requires several if not more steps to actuall...

Is BDD a replacement of TDD?

I wonder whether BDD is a replacement of TDD? What I understand now is that in an ultimate BDD we don't have unit tests any more. Instead there are stories/scenarios/features and "test steps". And it looks like a complete replacement of TDD for me. TDD is dead? ...