Questions tagged [tdd]

Test-Driven Development (TDD) involves writing a failing automated test to specify what is to be built. The test is then made to pass by writing code which satisfies the tested condition. Finally, the code is refactored.

Test-Driven Development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes a failing automated test case that defines a desired improvement or new function, then produces code to pass that test and finally refactors the new code to remove duplication and to improve its design.

TDD tends to lead to low-coupled, highly-cohesive designs, with no more functionality than necessary to satisfy requirements. The test serves as the first consumer of the new interface, and provides immediate feedback on its clarity and usability. Developers give themselves an incentive to write easily testable, stateless, simple modules; all hallmarks of good design according to the SOLID design principles.

It is one of the practices of Extreme Programming. It is often said that TDD is not about testing, but rather about design.

Hello World:

def test_hello_world
  assert.are_equal "hello world", hello_world
end
6135 questions
4
votes
1 answer

How to break down super long specs in RSpec?

Is there a way in which you can break specs up for a model into some sort of hierarchy? The specs for a couple of our models have gone over 5000 lines and this is reducing their maintainability. I know that in an ideal world models would not be…
Donovan Thomson
  • 2,375
  • 3
  • 17
  • 25
4
votes
1 answer

How to run several QUnit (node.js) test files using a single command?

Scenario We are trying to use the Node.js QUnit Module aka qunitjs for our Server-Side Testing so that we can write one test and run it on both server and client e.g: https://github.com/nelsonic/learn-tdd/blob/master/test.js When we run a single…
nelsonic
  • 31,111
  • 21
  • 89
  • 120
4
votes
1 answer

"Downloading public symbols" while debugging MS Test on Visual Studio 2010?

I am using MS Test with Visual Studio 2010 to write unit Tests. When I debug a Test it shows a Message box as shown below Title : Downloading public symbols Message : System.XXXX.dll Has anyone else faced this issue with MS Test on Visual Studio…
Amitabh
  • 59,111
  • 42
  • 110
  • 159
4
votes
1 answer

How verify the call to an interface with Mockito?

I am using mockito to test the call to an Interface, but I get some problems when I want to verify that the interface method 'goToLoginInterface()' was called consecutively when I call to 'goToLogin()'. It is supposed to be something simple but I've…
Viktor Valencia
  • 405
  • 5
  • 11
4
votes
3 answers

How do I use Rhino.Mocks to mock a ControllerContext

I am trying to use Rhino.Mocks to mock up a ControllerContext object to gain access to runtime objects like User, Request, Response, and Session in my controller unit tests. I've written the below method in an attempt to mock up a…
ahsteele
  • 26,243
  • 28
  • 134
  • 248
4
votes
1 answer

Understanding Mutant Failures

I have the following ActiveRecord model class method: def self.find_by_shortlink(shortlink) find_by!(shortlink: shortlink) end When I run Mutant against this method, I'm told there were 17 mutations and 16 are still "alive" after the test has…
pdoherty926
  • 9,895
  • 4
  • 37
  • 68
4
votes
3 answers

TDD and Protected Methods

I am trying to learn TDD by creating a copy of an existing MVC app I have but I am creating a copy of it from scratch using TDD. In my existing app I have an Application_AuthenticateRequest method as shown below. This is protected. Am I right in…
Dave Amour
  • 155
  • 1
  • 13
4
votes
2 answers

Unit Testing SiteMapNode

Does anyone know how to unit test SiteMapNode? We’re building some custom navigation controls, which renders unordered html lists from Site Maps with custom attributes. I’m trying to follow a test first approach but am finding that SiteMapNode has…
Ed Blackburn
  • 551
  • 1
  • 4
  • 11
4
votes
4 answers

When should I opt for test driven development?

My question is same as the title. I have not done Test driven development yet,I have performed unit testing and I am aware of testing in general but I hear it is much advantageous to follow TDD?. So should I opt for it everytime or are there some…
Vishal
  • 12,133
  • 17
  • 82
  • 128
4
votes
1 answer

Silverlight Unit Testing Framework running tests in external class library

I'm currently looking into different options for unit testing Silverlight applications. One of the frameworks available is the Silverlight Unit Test Framework from Microsoft (developed primary by Jeff Wilcox,…
Jonas Follesø
  • 6,441
  • 7
  • 41
  • 54
4
votes
1 answer

Jasmine-node tests executed twice

My jasmine-node tests are executed twice. I run those test from Grunt task and also from Jasmine command. Result is the same my tests are run twice. My package.json : { "name": "test", "version": "0.0.0", "dependencies": { "express":…
Lombric
  • 830
  • 2
  • 11
  • 23
4
votes
2 answers

How to decide when and when not to create an integration test

Is there a definitive process for deciding what in your codebase you should create integration test suites for? I'm talking... "This part of my code meets A criteria, thus tests should be created. This part of my code meets B criteria, thus tests…
Kevin Behan
  • 486
  • 5
  • 20
4
votes
2 answers

TDD with Strategy Pattern

I'm trying to implement the strategy pattern using TDD. Each strategy item implements an interface. What's the best way to do this with TDD? Do you have to create a test fixture for each implementation of the interface testing the same methods but…
ChoccyButton
  • 115
  • 9
4
votes
2 answers

Best practices for TDD BDD with code that uses external services / api

I'm using a twitter gem which basically accesses twitter and lets me grab tweets, timeline etc. Its really good but I have a lot of my code that uses the stuff it returns and I need to test it. The things the gem returns aren't exactly simple…
robodisco
  • 4,162
  • 7
  • 34
  • 48
4
votes
4 answers

A standard event messaging system with AJAX?

Is there any standards or messaging framework for AJAX? Right now I have a single page that loads content using Ajax. Because I had a complex form for data entry as part of my content, I need to validate certain events that can occur in my form. So…
Gutzofter
  • 2,003
  • 23
  • 26
1 2 3
99
100