Explore creating more advanced test cases for some more advanced conditions. See what happens when a unit test fails and how the failure of unit test provides valuable feedback.
- [Instructor] Now that we have built a simple unit test,…we want to dive a little deeper…into the way we create tests.…The basic pattern we use is called Arrange-Act-Assert.…Arrange is where we arrange all the necessary preconditions…and inputs for our test case.…Act, after this, we act on the object…or method we are testing…i.e. actually call the thing we want to test.…And finally, we finish up with an assertion…that the expected results have occurred.…
This basic pattern of Arrange-Act-Assert…is at the heart of all of the tests you will write…and we'll follow it as well.…I want to point out some general principles…when it comes to testing…just so we are all aware…of what you should be trying to achieve in your unit test.…Your test should happen in isolation as much as possible…especially for a unit test.…You should write tests…that much like the general software engineering practice…says to focus on writing a single method…that does only one thing.…
Your test should also generally speaking…test only a few things at once…
- Why use unit testing?
- Writing unit tests
- Extending unit tests
- Filtering PHPUnit tests
- Building dummy objects
- Working with data providers
- Writing an exception-based test
- Using TDD tactics
- Using PHPUnit advanced tactics, such as database tests
Skill Level Intermediate
1. The Basics of Test-Driven Development
2. Advanced Test-Driven Development
3. Test-Driven Development Tactics
4. PHPUnit Advanced Tactics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.