CSC/ECE 517 Fall 2014/ch1b 28 cg: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 3: | Line 3: | ||
==What is Test-Driven Development?== | ==What is Test-Driven Development?== | ||
===Development cycle=== | ===Development cycle=== | ||
A TDD development cycle could be simply described as followed | |||
*first write an automated test for your code. While writing the automated tests, you must take into account all possible inputs, errors, and outputs. This way, your mind is not clouded by any code that's already been written. | |||
*The first time you run your automated test, the test should fail—indicating that the code is not yet ready. | |||
*programming. Since there's already an automated test, as long as the code fails it, it means that it's still not ready. The code can be fixed until it passes all assertions. | |||
*Begin cleaning up codes and remove redundancy via refactoring. As long as the code still passes the test, it means that it still works. You no longer have to worry about changes that introduce new bugs. | |||
*Start the whole thing over again with some other method or program. | |||
===Example of TDD=== | ===Example of TDD=== | ||
Revision as of 16:58, 28 September 2014
==Behavior-Driven Development and Test-Driven Development
Background
What is Test-Driven Development?
Development cycle
A TDD development cycle could be simply described as followed
- first write an automated test for your code. While writing the automated tests, you must take into account all possible inputs, errors, and outputs. This way, your mind is not clouded by any code that's already been written.
- The first time you run your automated test, the test should fail—indicating that the code is not yet ready.
- programming. Since there's already an automated test, as long as the code fails it, it means that it's still not ready. The code can be fixed until it passes all assertions.
- Begin cleaning up codes and remove redundancy via refactoring. As long as the code still passes the test, it means that it still works. You no longer have to worry about changes that introduce new bugs.
- Start the whole thing over again with some other method or program.