Tagged Questions
1
vote
1answer
44 views
Production or Custom Test Data for Unit Testing?
I've recently had a little disagreement with fellow developers. We're transforming various ontologies from the original source format (Pica+, RDF, etc) into our data format and have several converters ...
2
votes
1answer
88 views
Shared factories: good or bad?
RSpec allows users to share factories across tests / examples, which would reduce the number of code lines in my app by a significant amount.
On the other hand, one of the reasons why I'm using ...
3
votes
1answer
82 views
Stubbing and mocking boundaries
Suppose I'm building a JSON API and would like to include an endpoint that returns a list of recently created posts. Somewhere in my system is an existing Post model with the following test:
create ...
2
votes
5answers
378 views
Understanding unit tests/TDD for ASP.NET webforms [closed]
I'm the lead programmer at a small software firm (currently 4 developers including myself), we develop bespoke ASP.NET WebForms applications for businesses. I joined there in 2010 just after ...
4
votes
3answers
322 views
In TDD, if I write a test case that passes without modifying production code, what does that mean?
These are Robert C. Martin's rules for TDD:
You are not allowed to write any production code unless it is to
make a failing unit test pass.
You are not allowed to write any more
of a unit test than ...
4
votes
2answers
253 views
Can I start with a passing unit test?
Uncle Bob's rules for TDD are specified here.
You are not allowed to write any production code unless it is to
make a failing unit test pass.
You are not allowed to write any more
of a unit test ...
16
votes
4answers
1k views
Why is test driven development missing from Joel's Test?
I was reading this blog by Joel Spolsky about 12 steps to better code. The absence of Test Driven Development really surprised me. So I want to throw the question to the Gurus. Is TDD not really worth ...
2
votes
2answers
157 views
Functional testing and Acceptance testing leading to redundant code
What I know is:
A Functional test aims to test a single component (like a WebApp's Controller) from the point of view of the developer. => Did I achieve all the requirements to make it work well?
...
5
votes
2answers
258 views
Helper static methods in TDD
I am creating an application which will be testable(unit + integration). In this application I have a FileHelper static class,
public static class FileHelper
{
public static void ...
25
votes
5answers
1k views
Why is it often said that the test cases need to be made before we start coding? [duplicate]
Why is it often said that the test cases need to be made before we start coding?
What are its pros and what the cons if we don't listen to this advice?
Moreover, does that advice refer to black box ...
-2
votes
2answers
197 views
How can I test database access methods in Java? [closed]
I want to write a test for a method that accesses a database such as following.
public class MyClass{
public String getAddress(Int id){
String query = "Select * from Address where ...
17
votes
4answers
751 views
Do unit tests sometimes break encapsulation?
I very often hear the following: "If you want to test private methods, you'd better put that in another class and expose it."
While sometimes that's the case and we have a hiding concept inside our ...
2
votes
1answer
451 views
How to unit test image processing code?
I'm working in image processing (mainly OCR) and I wonder how I should integrate unit tests in my development.
I'm already using unit tests for more "common" type of code but when dealing with image ...
1
vote
3answers
404 views
TDD, BDD or both?
I'm a little bit confused about BDD. I'm doing TDD currently.
My question is whether BDD is complementary to TDD or it's a whole new thing and my team should do both TDD and BDD? Or is it enough to ...
10
votes
5answers
459 views
Methods for testing a very large application
I have a PHP app which is very large. There are usually 2-3 developers working on it full time and we are getting to the point where we are making changes and creating bugs (cough features!). The ...
8
votes
5answers
751 views
What is a normal “functional lines of code” to “test lines of code” ratio?
I'm pretty new to TDD approach and my first experiments say that writing 1 line of functional code means writing about 2-3 lines of testing code. So, in case I'm going to write 1000 LOC, the whole ...
5
votes
4answers
234 views
Testing To Prevent Cascading Bugs
Yesterday, Twitter was hit with a "Cascading Bug" as described in this blog post:
A “cascading bug” is a bug with an effect that isn’t confined to a particular software element, but rather its ...
15
votes
9answers
1k views
Are too many assertions code smell?
I've really fallen in love with unit testing and TDD - I am test infected.
However, unit testing is normally used for public methods. Sometimes though I do have to test some assumptions-assertions ...
3
votes
4answers
344 views
Should you exercise TDD on prototype applications?
I'm developing an iOS app, which is a prototype for a customer. They're expecting it to not be of production standard and are happy for a few rough edges here and there.
Since this is my first ...
6
votes
2answers
719 views
Test Driven Development, has it reduced stress for developers?
I understand the benefits of test driven development, but have there been any studies that reveal the level of satisfaction with the product or stress levels of the authoring developers with the ...
17
votes
4answers
577 views
Should we always unit test bugs when correcting them?
When correcting bugs, it is encouraged where I work to first write a test that fails with the given bug, and then to fix the code until the test passes.
This follows TDD practices, and is supposed to ...
61
votes
16answers
5k views
When is unit testing inappropriate or unnecessary? [duplicate]
It seems to be generally assumed (on Stack Overflow at least) that there should always be unit tests, and they should be kept up to date. But I suspect the programmers making these assertions ...
36
votes
6answers
2k views
How to deal with static utility classes when designing for testability
We are trying to design our system to be testable and in most parts developed using TDD. Currently we are trying to solve the following problem:
In various places it is necessary for us to use static ...
33
votes
14answers
2k views
If you had two projects with the same specification and only one was developed using TDD how could you tell?
I was asked this question in an interview and it has been bugging me ever since.
You have two projects, both with the same specification but only one of these projects was developed using Test ...
27
votes
11answers
2k views
Do I need to test everything?
I'm going to start my first real project in Ruby on Rails, and I'm forcing myself to write TDD tests. I don't see real advantages in writing tests, but since it seems very important, I'll try.
Is it ...
6
votes
8answers
326 views
What's a good name for a third type of testing?
I generally have different types of tests that I work with - the standard types: Unit Tests (testing basic functionality of classes, methods etc) and Integration Tests (testing how multiple components ...
45
votes
12answers
3k views
New to TDD. Should I avoid private methods now?
I'm just now learning TDD. It's my understanding that private methods are untestable and shouldn't be worried about because the public API will provide enough information for verifying an object's ...
3
votes
1answer
248 views
Looking for resources on TDD and BDD
I'm doing a presentation this week for Uni on the application of TDD and BDD. I'm trying to focus on types of code (such as algorithms, business logic or crud) and which methodology (if at any at all) ...
5
votes
1answer
372 views
Node.JS testing with Jasmine, databases, and pre-existing code
I've recently built the start of a core system which is likely going turn into a monster product. I'm building the system with node.js, and decided after I got a small base built, that It'd be a ...
14
votes
6answers
993 views
Should we test all our methods?
So today I had a talk with my teammate about unit testing. The whole thing started when he asked me "hey, where are the tests for that class, I see only one?". The whole class was a manager (or a ...
5
votes
6answers
777 views
Single or multiple files for unit testing a single class?
In researching unit testing best practices to help put together guidelines for my organization, I've run into the question of whether it is better or useful to separate test fixtures (test classes) or ...
3
votes
8answers
320 views
Steps towards TDD
I need some advice to take the steps for TDD. How do we think in terms of interfaces for everything when we are writing code? Most of the testing books tell you how to write tests. But I want a book ...
37
votes
11answers
5k views
What are the disadvantages of automated testing?
There are a number of questions on this site that give plenty of information about the benefits that can be gained from automated testing. But I didn't see anything that represented the other side of ...
12
votes
4answers
445 views
How can I start testing in a testing anticulture?
I have a confession to make: Formalized automated testing was never a part of my programming background. I now work in a very large company with many developers (most of them web developers of one ...
9
votes
5answers
467 views
How to do TDD for something with many permutations?
When creating a system like an AI, which can take many different paths very quickly, or really any algorithm that has several different inputs, the possible result set can contain a large number of ...
4
votes
1answer
216 views
Unit testing of “workflow” methods
We are currently developing a public API for our app. The methods on this public API are mostly putting together functionality in different corners of the system.
An example would be: (names have been ...
31
votes
9answers
2k views
How baby are your baby-steps in TDD?
Today we were training TDD and found the following point of misunderstanding.
The task is for the input "1,2" return sum of numbers which is 3. What I have written (in C#) was:
numbers = ...
6
votes
2answers
385 views
Testing-related methodologies except TDD/BDD
Are there any testing-related methodologies except TDD/BDD? I see a lot of people who practice their own testing approaches (e. g., see Ayende post), but I don't see any formalization for it, no ...
10
votes
2answers
386 views
Software Testing Techniques [closed]
What kinds of software testing do you know? I've heard about Test-Driven Development, Unit tests etc, but can't understand their importance and difference. For example, why are we using regression ...
7
votes
7answers
405 views
Acceptance tests done first…how can this be accomplished?
The basic gist of most Agile methods is that a feature is not "done" until it's been developed, tested, and in many cases released. This is supposed to happen in quick turnaround chunks of time such ...
3
votes
5answers
189 views
Should the test and the fix be written by different people?
There is a common practice in TDD to write a test before fix to avoid regression and simplify fixing. I just wonder what if the test and fix will be written by different people, total spent time will ...
15
votes
5answers
683 views
How are mock objects commonly misused?
I read an article recently which said that mock objects are often misunderstood and misused. Are there any clear mocking anti-patterns which I can look out for?
12
votes
2answers
435 views
What are some good books/resources/ways to learn TDD? [closed]
As a grad student, I haven't really written anything to test my code. Usually what we do is just run the code on some test input and if the output result looks okay or as we expected then we just ...
9
votes
4answers
757 views
Should each unit test be able to be run independently of other tests?
Say you have tests for two methods of a class. The first method gathers data from another tier and puts it into some sort of storage independent of the runtime (such as a SQL table), so all of the ...
14
votes
6answers
508 views
Do abstractions have to reduce code readability?
A good developer I work with told me recently about some difficulty he had in implementing a feature in some code we had inherited; he said the problem was that the code was difficult to follow. From ...
4
votes
2answers
724 views
Is the difference between BDD and TDD nothing more than a vocabulary shift? [duplicate]
I recently made a start on learning BDD (Behaviour Driven Development) after watching a Google tech talk presented by David Astels. He made a very interesting case for using BDD
and some of the ...
12
votes
8answers
870 views
What do you use for JavaScript Testing (TDD)?
What do you use for JavaScript testing both server-side and client-side?
12
votes
4answers
4k views
What is an integration test exactly?
My friends and I have been struggling to classify exactly what is an integration test.
Now, on my way home, I just realised, that every time I try to give a real world example of an integration ...
17
votes
11answers
946 views
At what point would you drop some of your principles of software development for the sake of more money?
I'd like to throw this question out there to interestingly see where the medium is.
I'm going to admit that in my last 12 months, I picked up TDD and a lot of the Agile values in software ...
8
votes
5answers
293 views
How do I check that my tests were not removed by other developers?
I've just came across an interesting collaborative coding issue at work.
I've written some unit/functional/integration tests and implemented new functionality into application that's got ~20 ...
