There are three complementary strategies to test your aspects. The first strategy should provide sufficient coverage for the most common scenarios.
Article | Description |
---|---|
Testing the aspect's code generation and error reporting | These tests verify that the aspect transforms code or reports errors and warnings as expected. In aspect tests, the transformed code is not executed. |
Testing the aspect's run-time behavior |
These tests confirm the run-time behavior of the aspect. In this approach, you apply your aspect to some test target code and evaluate the behavior of the combination of the aspect and the target code by executing the transformed code in a unit test and assessing its run-time behavior. For this approach, you can use a conventional Xunit project or any other testing framework, as there is nothing specific to Metalama. |
Testing compile-time helper code | These tests are traditional unit tests of the compile-time logic used by the aspects, without executing the aspects themselves. |
Debugging aspects |
This article describes how to debug the compile-time logic of aspects and templates. |