Given that our TestFrameworks has evolved beyond record and playback, unit testing can help to ensure that the TestFramework’s provided methods and/or functions (depending on the language of choice) works as we intended at its basic level. The benefits for doing this extra step is:
- Your unit tests can verify the codes conditional statements, loops and exception handling behaves as intended.
- If your TestFramework logs an error or results in unintended behavior, you now have a non-integrated snippet of code you can use to test and debug your methods.
- If you methods/functions require an upgrade, you can use your unit tests to verify the upgrade works as expected.
- You can run your suite of unit tests to verify the entire TestFramework prior to performing an actual test run.
- You can leverage your code management and build management systems to help you automatically run your unit tests after submitting your changes.
- Last, it definitely can help you reduce the time you spend analyzing reported problems as you will not need to double-check if the problem is in your Framework.
So think of unit testing as a time saver and a way to always verify the health of your TestFramework. It can definitely fend of the common arguments of “maybe the bug is in your tests J.” Begin developing the habit of when you create new methods, develop a unit tests to verify it.