A Practical Introduction to Test-Driven Development

Start Date: 07/11/2021

Course Type: Common Course

Course Link: https://www.coursera.org/learn/a-practical-introduction-to-test-driven-development

About Course

To be a proficient developer you need to have a solid grasp of test writing before putting code into production. In this course, we will take a hands-on look at Test-Driven Development by writing and implementing tests as soon as week one. TDD starts with good unit tests, so we will start there. Topics will also cover translating user specs into unit tests, applying the Red-Green-Refactor mantra, and applying mocks in python with the unittest.mock module. Once finished, you will have covered all the steps of TDD before development

Course Syllabus

Unit Testing best practices
The Red-Green-Refactor cycle in practice
The power of mocks

Coursera Plus banner featuring three learners and university partner logos

Course Introduction

To be a proficient developer you need to have a solid grasp of test writing before putting code into production. In this

Course Tag

Related Wiki Topic

Article Example
Acceptance testdriven development Acceptance testdriven development (ATDD) is a development methodology based on communication between the business customers, the developers, and the testers. ATDD encompasses many of the same practices as specification by example, behavior-driven development (BDD), example-driven development (EDD), and support-driven development also called story testdriven development (SDD). All these processes aid developers and testers in understanding the customer's needs prior to implementation and allow customers to be able to converse in their own domain language.
Test-driven development Test-driven development (TDD) is a 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 to pass the new tests, only. This is opposed to software development that allows software to be added that is not proven to meet requirements.
Test-driven development In test-driven development, each new feature begins with writing a test. Write a test that defines a function or improvements of a function, which should be very succinct. To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. It could be a modified version of an existing test. This is a differentiating feature of test-driven development versus writing unit tests "after" the code is written: it makes the developer focus on the
Test-driven development Advanced practices of test-driven development can lead to acceptance testdriven development (ATDD) and Specification by example where the criteria specified by the customer are automated into acceptance tests, which then drive the traditional unit test-driven development (UTDD) process. This process ensures the customer has an automated mechanism to decide whether the software meets their requirements. With ATDD, the development team now has a specific target to satisfy – the acceptance tests – which keeps them continuously focused on what the customer really wants from each user story.
Test-Driven Development by Example Test Driven Development: By Example is a book about a software development technique by Kent Beck.
Test-driven development The following sequence is based on the book "Test-Driven Development by Example".
Test-driven development Test-driven development offers the ability to take small steps when required. It allows a programmer to focus on the task at hand as the first goal is to make the test pass. Exceptional cases and error handling are not considered initially, and tests to create these extraneous circumstances are implemented separately. Test-driven development ensures in this way that all written code is covered by at least one test. This gives the programming team, and subsequent users, a greater level of confidence in the code.
Test-driven development Test-driven development is related to, but different from acceptance testdriven development (ATDD). TDD is primarily a developer’s tool to help create well-written unit of code (function, class, or module) that correctly performs a set of operations. ATDD is a communication tool between the customer, developer, and tester to ensure that the requirements are well-defined. TDD requires test automation. ATDD does not, although automation helps with regression testing. Tests used in TDD can often be derived from ATDD tests, since the code units implement some portion of a requirement. ATDD tests should be readable by the customer. TDD tests do not need to be.
Continuous test-driven development Continuous test-driven development (CTDD) is a software development practice that extends test-driven development by means of automatic test execution in the background (sometimes called continuous testing). In CTDD the developer writes a test first but is not forced to execute the tests manually. The tests are run automatically by a continuous testing tool (see external links for examples) running in the background. This technique can potentially reduce the time waste resulting from manual test execution by eliminating the need for the developer to start the test after each phase of the normal TDD practice: after writing the (initially failing) test, after producing the minimal amount of code for the test to pass and after refactoring the code.
Test-driven development Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.
Test-driven development Test-driven development has been adopted outside of software development, in both product and service teams, as test-driven work. Similar to TDD, non-software teams develop quality control checks (usually manual tests rather than automated tests) for each aspect of the work prior to commencing. These QC checks are then used to inform the design and validate the associated outcomes. The six steps of the TDD sequence are applied with minor semantic changes:
Behavior-driven development In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD). Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.
Test-driven development There are various aspects to using test-driven development, for example the principles of "keep it simple, stupid" (KISS) and "You aren't gonna need it" (YAGNI). By focusing on writing only the code necessary to pass tests, designs can often be cleaner and clearer than is achieved by other methods. In "Test-Driven Development by Example", Kent Beck also suggests the principle "Fake it till you make it".
Test-driven development Each test case fails initially: This ensures that the test really works and can catch an error. Once this is shown, the underlying functionality can be implemented. This has led to the "test-driven development mantra", which is "red/green/refactor", where red means "fail" and green means "pass". Test-driven development constantly repeats the steps of adding test cases that fail, passing them, and refactoring. Receiving the expected test results at each stage reinforces the developer's mental model of the code, boosts confidence and increases productivity.
Test-Driven Development by Example Beck's concept of test-driven development centers on two basic rules:
Test-driven development Management support is essential. Without the entire organization believing that test-driven development is going to improve the product, management may feel that time spent writing tests is wasted.
Acceptance testdriven development ATDD is closely related to test-driven development (TDD). It differs by the emphasis on developer-tester-business customer collaboration. ATDD encompasses acceptance testing, but highlights writing acceptance tests before developers begin coding.
Test-driven development Test-driven development offers more than just simple validation of correctness, but can also drive the design of a program. By focusing on the test cases first, one must imagine how the functionality is used by clients (in the first case, the test cases). So, the programmer is concerned with the interface before the implementation. This benefit is complementary to design by contract as it approaches code through test cases rather than through mathematical assertions or preconceptions.
Tester Driven Development The term itself is a tongue-in-cheek reference to Test-driven development, a widely used methodology in Agile software practices. In test driven development tests are used to drive the implementation towards fulfilling the requirements. Tester-driven development instead shortcuts the process by removing the determination of requirements and letting the testers (or the QA team) drive what they think the software should be through the testing (or QA) process.
Test-Driven Development by Example The book illustrates the use of unit testing as part of the methodology, including examples in Java and Python. One section includes using test-driven development to develop a unit testing framework.