This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "OWASP Secure TDD Project"
From OWASP
Lauren Tabak (talk | contribs) |
Lauren Tabak (talk | contribs) |
||
Line 20: | Line 20: | ||
TDD is about writing a test which will fail, then writing the minimum amount of code required to make it run, then refactoring the code to make it clean. <br> This is done in cycles, fail -> pass -> refactor, adding a new test for each known requirement for the code.<br> | TDD is about writing a test which will fail, then writing the minimum amount of code required to make it run, then refactoring the code to make it clean. <br> This is done in cycles, fail -> pass -> refactor, adding a new test for each known requirement for the code.<br> | ||
− | |||
A TDD test expresses the task of the application functionality that needs to be implemented next and the criterion for success. <br> | A TDD test expresses the task of the application functionality that needs to be implemented next and the criterion for success. <br> | ||
− | |||
TDD is not about testing. TDD uses tests to drive the design of the code.<br> | TDD is not about testing. TDD uses tests to drive the design of the code.<br> | ||
− | |||
This can be done with unit tests, functional tests and acceptance tests. Usually, all three are used.<br> | This can be done with unit tests, functional tests and acceptance tests. Usually, all three are used.<br> | ||
− | |||
The tests tell you what to do, what to do next and when you are done. They tell you what the API is going to be, what the design is. <br> | The tests tell you what to do, what to do next and when you are done. They tell you what the API is going to be, what the design is. <br> | ||
− | |||
The tests permit you to refactor safely, ensuring that the desired behavior continues to work while you adjust your design. The tests also guide you to testable code, promoting smaller methods, shorter parameter lists, and overall much simpler design than other methodologies lead you to.<br> | The tests permit you to refactor safely, ensuring that the desired behavior continues to work while you adjust your design. The tests also guide you to testable code, promoting smaller methods, shorter parameter lists, and overall much simpler design than other methodologies lead you to.<br> | ||
Line 36: | Line 31: | ||
Unit Testing is about testing individual units of behavior. An individual unit of behavior is the smallest possible unit of behavior that can be individually tested in isolation.<br> | Unit Testing is about testing individual units of behavior. An individual unit of behavior is the smallest possible unit of behavior that can be individually tested in isolation.<br> | ||
− | |||
You can write unit tests before you write your code, after you write your code or while you write your code.<br> | You can write unit tests before you write your code, after you write your code or while you write your code.<br> | ||
Line 61: | Line 55: | ||
- A solution can be implemented to block the threat, and quickly be confirmed to be working.<br> | - A solution can be implemented to block the threat, and quickly be confirmed to be working.<br> | ||
- Provided all other tests still pass, you can quickly verify that all other security measures still behave correctly and all other functionality still behaves | - Provided all other tests still pass, you can quickly verify that all other security measures still behave correctly and all other functionality still behaves | ||
− | + | correctly.<br> | |
Basically TDD assists in allowing a quick turnaround time from when a threat is discovered to when a solution becomes available.<br> | Basically TDD assists in allowing a quick turnaround time from when a threat is discovered to when a solution becomes available.<br> |
Revision as of 01:37, 15 March 2014