Lecture 3-Test driven development Flashcards
(15 cards)
What is a test-driven development(TDD)?
Software development process that relies on the repetition of a very short development cycle:
-requirements are turned into very specific test cases
-then the software is improved so that the tests pass
What is TDD opposed to?
Opposed to software development–> because it allows software to be added that is not proven to meet requirements.
What is the TDD algorithm?
1.Writing a failing test case
2.Get it to compile
3.Make it pass
4.Remove duplication
5.Make the test case pass, but not good in all cases
6.Write a failing test case
7.Get it to compile and make it pass
Why do TDD and Legacy code mesh well together?
We use TDD to EITHER write code or refactor. WE ARE NEVER DOING BOTH AT THE SAME TIME. –> This is valuable in legacy code because it lets use write new code independently of old code.After we write code, we can refactor to remove duplication between it and the old code.
What is the TDD legacy code algorithm?
1.Get the class you want to test
2.Write a failing test case
3.Get it to compile
4.Make it pass
5.Remove duplication
6.Repeat
What is a software test?
-A software test is a piece of software, which executes another piece of software.
State testing vs behaviour testing
State testing: It valides if that code results in the expected state.
Behaviour testing : It executes the expected sequence of events.
What are software unit tests?
Help with the developer to verify that the logic of a piece of the program is correct.
What is the structure of test approach(4)?
1.Setup
2.Run Test
3.Validate Results
4.Cleanup
What is the test of a TDD cycle? (6)
1.add a test
2.Run all tests and see if the new test fails
3. Write the code
4.Run tests
5.Refactor code
6.Repeat
TDD vs UAT
TDD: primarily a developer’s tool to help create well-written unit of code
UAT: communication tool between the customer, developer and tester to ensure that the requirements are correctly implemented.
What is JUnit?
-It’s a Unit testing framework for the Java programming language.
-Important in the develop ment of test-driven development.
How can we use JUnit in a TDD approach?
It can be used within a build pipeline for continuous integration.
Give an example of JUnit in Java
-JUnit as the testing framework
-Jenkins as the continuous integration server
-Git as a version control system.