Hot answers tagged

8

The TDD cycle is more a development cycle for a developer, to quote James Shore, The Art of Agile, Test-Driven Development chapter: Programmers new to TDD are often surprised at how small each increment can be. Although you might think that only beginners need to work in small steps, my experience is the reverse: the more TDD experience you have, the ...


8

TDD (Test Driven Development) Who's involved: Developers Summary: Developers start writing code by first defining tests (in general unit tests). It could sound strange, but this practically guarantees a high code-coverage and in particular it forces developers to think about what they are doing. TDD can be applied to any kind of software. BDD (Behaviour ...


8

The Three Laws of TDD You are not allowed to write any production code until you have first written a failing unit test. You are not allowed to write more of a unit test than is sufficient to fail—and not compiling is failing. You are not allowed to write more production code that is sufficient to pass the currently failing unit test. ...


8

Taking the waterfall model in agile would be a good idea but there seems to be a misunderstanding on your part regarding the concept of test driven development. Test driven development doesn't mean agile, neither does it mean just writing test cases early. It means that tests are written first and these tests drive the programming. That means the ...


7

The first thing you want to do here is perform some bug triage. Problems your team finds during feature testing will be one of: something introduced by the changes something that was there before and doesn't have much if any impact on the changes something that was there before and has a major negative impact on the changes The developers in the team need ...


7

The short version: regardless of the development methodology, your role is to provide information about the overall quality of the application. You do that via testing anything that isn't included in the developer-maintained automation, and reviewing the developer-maintained automation. The long version: This question and its answers is a good starting ...


6

Both are a form of test driven development, since you write the tests upfront. The main difference is that TDD tests are technical tests often unit-tests created during developing of a feature and are written just before you implement a part of the feature in the code-base. Where BDD tests are often written before the coding starts and are human readable and ...


5

Yes, proper dependency injection benefits testing and TDD greatly because it allows to test individual components/dependencies easier - mocking/stubing each of the dependencies without affecting any global variables or global dependencies which other parts of an application may depend upon or other tests might use. I found it quite handy to write unit and ...


5

The TirePressureMonitoringSystem coding kata is an situation that is very hard to test without dependency injection. It simulates an Alarm which is part of tire pressuring system. The implemented sensor gives back random data. The task is to restructure the Alarm class, but not the sensor to make it unit-testable. I think the kata showcases why DI is so ...


5

I believe that the strongest instrument for filtering such a-low-quality tests is a code review. You can power-up your code review with mutational testing techniques which will help you to detect the tests which probably do not introduce any value to the overall project scope. Here is the example of mutational testing framework where you can pick some ...


4

This book is exactly what you need: Working Effectively with Legacy Code by Michael Feathers. Michael offers several approaches to TDDing legacy code. One of those is: Before you add a new feature, write tests in the area that you will change. This approach gives a number of benefits: Writing the tests will give you a certain amount of confidence that you'...


4

Adding my view points here. TL;DR : BDD focuses on the behavioural aspect of the system rather than the implementation aspect of the system that TDD focuses on. BDD gives a clearer understanding as to what the system should do from the perspective of the developer and the customer. BDD allows both the developer and the customer to work together to on ...


4

I'd plan it this way: The specific tests that are written 'before the code' are unit tests that are written by developers just before they write the actual code. It should only take 5-20 minutes to write a simple test. The test is written, the code is written for it and then the test is changed or the next test is written and then more unit level code is ...


3

If developers also write unit tests, then what's the point of having special testers in our team and should we replace testers with developers? Unit testing is not the only kind of automated testing. Integration tests, performance tests, scalability tests, and fault tolerance tests are all examples of automated tests that are not unit tests and that a ...


3

In TDD you write the minimum amount of code to pass the test case. That test case, of course, should only be testing at a unit level. You want to test individual pieces, so you write test cases to cover limited functionality(mainly 1 feature). Your test cases will end up acting as documentation for your system and low-level regression testing. TDD is ...


3

Lets assume that you go with the TDD approach to writing your tests. In this case you should be focusing on writing tests for the code you are implementing. If in this case you are working on client side code that makes calls to a server you should be working with unit tests initially that test the calls you are making. Using stubs and mock objects you ...


3

In my experience, you can't sell new development processes. The only path I've found which works is to simply start doing it: Only develop with TDD from this point forward. You'll still deliver your code on time, but it'll be more maintainable and have far fewer bugs. You'll feel much less anxiety and be proud of your work. After a little time, management ...


3

Unit tests should be written by developers. Unit tests are very close to the core code and developers have intimate knowledge of how units should work. testers are usually more removed from the deep innards of the core code and they will not be ass effective writing unit tests as core developers are. Acceptance/integration/end-to-end tests do not require ...


3

Test-Driven Development is a way of of developing software, its a practise. It is a process you can follow. You write a failing tests and implement just enough code to make the test pass, afterwards you clean or refactor your code and create a new failing test. Repeat this cycle until your software is done. Mostly TDD is used with unit-tests and less with ...


3

D) There is no code This is the one and only correct answer, because the idea of TDD is that you only implement code for which you have a failing test. It prevents you from implementing things you do not yet need. This comes from one of the ExtremeProgramming practises YAGNI. One way XP’ers would keep themselves honest is to insist they write a failing ...


3

To learn TDD I suggest doing a kata everyday. Start with the String Calculator Kata and do it test-driven. The coding dook handbook has loads more example kata's to practise and learn the following skills: test design refactoring safely naming tests driving code with tests designing clean code Also read Test Driven Development: By Example


3

Use cucumber. Specflow is a part of cucumber family that is developed for .Net world. So if you do not need .Net but need Java, just use the solution that was originally intended for Java


3

You can use some Boundary Value Analysis to filter out the list of test cases. You would probably do a better risk analysis than anyone else in this case, but I can imagine the following as the riskiest test cases: Monday 8 AM Monday 8 AM +- 1s Monday 8 PM Monday 8 PM +- 1s Saturday 10 AM Saturday 10 AM +- 1 s Saturday 4 PM Saturday 4 PM +- 1s Some ...


2

Just like with everything else in IT - it depends. Depends on whether the bug can be easily reproduced, it depends on how severe this bug is, depends on the chance of the bug reappearing again somewhere in the future. Someone said before me that it's all about managing software testing risk and I agree with it. While it may seem to be tempting to cover ...


2

It really doesn't work that way. Test-Driven really means that the tests come before the code. So if you already have the code, it's too late to test-drive it. What you can do, on a project which did not initially use TDD, is to start using it. So before you write any new code, you write the test first. Gradually that will add coverage to your existing ...


2

Short answer: Limit refactoring to "removing duplication". This is Kent Beck's summary of the refactoring step in Test-Driven Development by Example. Long answer: the time spent refactoring because of TDD is a blessing, not a curse. It's not a problem that TDD's refactoring takes time ... because in many languages refactoring is only possible because of TDD....


2

This book is exactly what you need: Working Effectively with Legacy Code by Michael Feathers. That book goes directly to both of your questions: How to start refactoring a legacy codebase, and how to approach TDD when the code is not yet testable. Underlying both of those questions is another that the book answers: How to get a legacy codebase under test.


2

You should teach developers to write tests Test writing is time consuming It's complicated to judge test completeness TDD may not work due to project workflow and features TDD doesn't give you confidence that the code works You should rewrite tests too after changing some API, for example.


2

One assertation ('then') per test is a good thing and generally considered a best practice. It may seem a bit wordy and long but the idea is that when it fails you know exactly and specifically what the issue is. The frequent exception to this is UI tests which use multiple assertions per test, mostly in the interest of time as they run slowly due to ...


2

Need to do following: Learn Phases of software development Need to learn why testing is necessary Need to think logically where ans what functionality of an software should have and is software fullfilled the requirement. Learn types od testing Should have good communication and written skills Test an application as End user


Only top voted, non community-wiki answers of a minimum length are eligible