So I'm getting used to TDD, but I've come across an unexpected problem: I'm getting really tired of 100% code coverage. The tests are getting more tedious to write than the code itself, and I'm not sure if I'm doing it right. My question is: What sort of things are you supposed to test, and what sort of things are overkill?
For example,...
I currently have like 10 tests that test whenever my Tetris piece doesn't move left if there is a piece in the path, or a wall. Now, I will have to test the same behaviour for the right movement.
Is it too bad if I just copy the 10 tests I already have for the left movement and make only the needed changes and do the same for the code i...
I've been reading a lot on TDD over the past few months and decided to jump in and try it out with an easy example, I'm just not sure I'm testing for the right things in practice. Here the tests for a custom Data Annotation for validating emails:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using...
I want to refactor a DLL to make it MEFable too. Should I unit test whether a class is decorated with [Export] or [Import] and other MEF attributes?
...
I have a method called ProcessPayment() that I'm developing via BDD and mspec. I need help with a new challenge. My user story says:
Given a payment processing context,
When payment is processed with valid payment information,
Then it should return a successful gateway response code.
To set up the context, I am stubbing my gateway ser...
I dont get why I should use Mocks in Rspec.
If I write Specs, shouldn't I write the actual code afterwards so that the tests would pass?
So why use Mocks and replace those actual classes?
...
I'm taking a stab at setting up unit tests for some utility classes in a project I'm working on, and one of the classes (contains licensing info) has a method that does some determination based on the current time.
i.e. the license contains an expiry date, and the license string validates that date, but the actual logic to see if the li...
I've read various articles about Mock vs Stub in testing, even the Fowler one.
Also some threads here in the Stackoverflow.
The answers are too difficult and abstract for me to understand.
Could someone explain it in an Apple way? :)
...
Could anyone explain the word regression test in an understandable way?
...
What are the most used TDD packages for VS2008?
...
Is there any point in Unit-Testing a method that the only thing it does is delegate work on another object? Example:
class abc {
...
public void MoveLeft()
{
fallingPiece.MoveLeft();
}
...
}
I am doing Unit-Tests for some existing classes I have, for learning purposes. It seems kinda odd to do a Unit-Tes...
I have this first integration test for a tic tac toe game:
[TestClass]
public class FirstIntegrationTest
{
[TestMethod, TestCategory("Integration Tests")]
public void Standard_TicTacToe_Game_PlayerO_Wins()
{
IPlayer playerO = new Player();
IPlayer playerX = new Player();
Game game = new Game(playerO,...
I'm strongly considering adding unit testing to an existing project that is in production. It was started 18 months ago before I could really see any benefit of TDD (face palm), so now it's a rather large solution with a number of projects and I haven't the foggiest idea where to start in adding unit tests. What's making me consider this...
Hi All
Sorry if this is a stupid noob question please be gentle with me I'm trying to learn...
I want to test against the attribute methods of things like models and controllers. Mostly to make sure they have the right attrbute ie Required. But i'm also using this as an experiment with extension methods and Lambdas.
What I'd like is a...
Over the summer, I've been reading a lot about design. Two notable pieces that I read were Test Driven Development: By Example by Kent Beck, and another named Pattern-Oriented Analysis and Design: Composing Patterns to Design Software Systems by Yacoub.
These books take two very different approaches to designing software systems. My imp...
We've started using Part Cover to track test code coverage of our application. IMO its a great tool for getting an overall score for your tests and for highlighting test areas where you might have been a bit lazy with tests, but today I wrote a test and realised that it didn't really test anything useful, it just increased my coverage!
...
Has anyone got a TDD-ish methodology for designing complex WPF xaml components (i.e., ControlTemplates, Custom Controls with dependency properties)?
Is eyeballing the UI the closest you can come to asserting your code is correct? How about incremental development; any aids to dividing up the logic incrementally?
If there isn't any meth...
I'm trying to get Capybara running in a simple Ruby script -- i.e. without/outside of Rails. Here's the script:
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
include Capybara
Capybara.current_driver = :selenium
Capybara.app_host = 'http://www.google.com'
visit('/')
The problem is that when I run this I get this error...
Consider the following code (from a requirement that says that 3 is special for some reason):
bool IsSpecial(int value)
if (value == 3)
return true
else
return false
I would unit test this with a couple of functions - one called TEST(3IsSpecial) that asserts that when passed 3 the function returns true and another th...
I want to understand exactly what unit test means.
From what I have understood so far it implies testing a model and all its public methods.
Is that correct?
And what about controllers? Does unit test means testing the controllers/views too?
Could someone enlighten me on this.
...