Test Driven Development with Protractor/Jasmine (Legacy)
This module is deprecated and no longer receives updates. Protractor is likely being removed as the default from Angular applications and Protractor itself will likely stop receiving updates and development in the future. I would recommend checking out the Test Driven Development with Cypress/Jest as a replacement.
Test Development Cycle
WARNING: This module is deprecated and no longer receives updates. Protractor is likely being removed as the default from Angular applications and Protractor itself will likely stop receiving updates and development in the future. I would recommend checking out the Test Driven Development with Cypress/Jest as a replacement.
A structured development process for TDD
DEPRECATEDModule Outline
- Resources PRO
- Lesson 1: Introduction PRO
- Lesson 2: Introduction to Test Driven Development PRO
- Lesson 3: Testing Concepts PRO
- Lesson 4: Jasmine, Karma, and Protractor PRO
- Lesson 5: A Simple Unit Test PRO
- Lesson 6: A Simple E2E Test PRO
- Lesson 7: Introduction to Angular's TestBed PRO
- Lesson 8: Setting up Tests PRO
- Lesson 9: Test Development Cycle PRO
- Lesson 10: Getting Ready PRO
- Lesson 11: The First Tests PRO
- Lesson 12: Injected Dependencies & Spying on Function Calls PRO
- Lesson 13: Building out Core Functionality PRO
- Lesson 14: Testing Asynchronous Code PRO
- Lesson 15: Creating a Mock Backend PRO
- Lesson 16: Setting up the Server PRO
- Lesson 17: Testing Integration with a Server PRO
- Lesson 18: Testing Storage and Reauthentication PRO
- Lesson 19: Refactoring with Confidence PRO
- Lesson 20: Conclusion PRO
Lesson Outline
Test Development Cycle
In a previous lesson, we discussed that when using Test Driven Development the general process for creating tests looks like this:
- Write a test for functionality that you want to build
- Check that the test fails
- Implement code to satisfy the test
- Check that the test passes
- Repeat
The process is simple enough, but when you first generate your application and want to start writing your first test you will feel pretty lost. What should you build first? What test do you write first? How do you write a test for something that doesn't exist yet?
The general idea is that we will start with a specific requirement that we want to implement first. Then we will work our way through this process:
- Write an E2E test for some specific requirement
- Check that the E2E test fails
- Based on the failure you get from the E2E test, decide what functionality needs to be worked on in order to get it passing
- Write a unit test for the functionality you have decided that you need to create to get the E2E test to pass
- Check that the unit test fails
- Implement the code to satisfy the unit test
- Check if the E2E test passes now
- If the E2E test passes, go to Step 1. If the E2E test still fails, go to Step 3.
Thanks for checking out the preview of this lesson!
You do not have the appropriate membership to view the full lesson. If you would like full access to this module you can view membership options (or log in if you are already have an appropriate membership).