Perl programs can now be tested for their subroutines using non-invasive techniques. With the new approach, testing is made easier and more efficient than before.
If, at a later stage, you need to refactor a part of the program, it becomes tricky to perform unit testing of the subroutines without accidentally running the entire program. At this stage, developers adopt the glass-box testing approach, where they can inspect the program's internals, even though they are not changing them.
Test::GlassBox::Heavy is a Perl module that allows developers to take full advantage of glass-box testing by using some of Perl's deep magic, including namespace modules like Devel:: and B::. Specifically, this module stops the Perl program from being run and turns the program into a package. As a result, developers can call any subroutine defined in the program.
However, developers need to take care to set up any environmental requirements, such as global lexical variables, to ensure that subroutines can run error-free. Moreover, it is crucial to bear in mind that side effects from subroutines will still occur. For example, database updates can occur while testing subroutines.
To use this module, developers need to load the program's subs via a simple command using the "load_subs" function. Moreover, they can choose to call the subs directly, or they can call them within a specified namespace.
The purpose of this module is to provide developers with a way to write unit tests for their Perl programs, regardless of their age or complexity, without modifying the program's code. With Test::GlassBox::Heavy, developers can ensure that their subroutines are tested safely and error-free.
Version 1.03: N/A