Testing
Explore effective testing techniques in Perl to ensure your code behaves as intended. Learn to write test assertions with Test::More, run tests using prove, and manage test plans for reliable and maintainable programs.
We can learn a lot of syntax from a course by writing small programs to solve the example problems. Writing good code to solve real issues takes more discipline and understanding. We must learn to manage code:
- How do we know that it works?
- How do we organize it?
- What makes it robust in the face of errors?
- What makes code:
- clean?
- clear?
- maintainable?
Modern Perl helps us answer all those questions.
Testing
We’ve already tested our code. If we’ve ever run it, noticed that something wasn’t quite right, made a change, and then run it again, we’ve tested our code. Testing is the process of verifying that our software behaves as intended. Effective testing automates that process. Rather than relying on humans to perform repeated manual checks perfectly, let the computer do it.
Perl’s tools help us write the proper tests.
Test::More
The fundamental unit of testing is a test assertion. Every ...