MetalamaConceptual documentationCreating aspectsTesting and debugging aspects
Open sandboxFocusImprove this doc

Testing aspects

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 Aspects These tests verify that the aspect transforms code or reports errors and warnings as expected. In compile-time tests, the transformed code is not executed.
Unit testing aspects at run time 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 code These tests are traditional unit tests of the compile-time logic used by the aspects, without executing the aspects themselves.