Open nagkumar opened 2 years ago
The report with
archRule.failOnEmptyShould = false
should list all the empty and unmatched tests
Would you expect to see them on a particular logger, or would a debug
message on the com.tngtech.archunit.lang.ArchRule
logger be good enough?
This means either that no classes have been passed to the rule at all, or that no classes passed to the rule matched the
that()
clause. To allow rules to be evaluated without checking any classes you can either useArchRule.allowEmptyShould(true)
on a single rule or set the configuration propertyarchRule.failOnEmptyShould = false
From this error message, I am not clear, if there were no sources that were matching the archunit test cases..
if this understanding is correct, it is better to list all such test cases, where there were no matches in the source code. Such special report details would help the architect to oversee the relevance of the test to the source code.
So, if I understand you correctly you would want to see some sort of info of
a) how many classes were imported altogether before the rule evaluation has even begun
b) how many classes passed the that()
clause when evaluating the rule?
As @hankem asked, in which form would you imagine that? What is "the report" for you? ArchUnit can't do much more than print out a log statement for these cases I think? Or what do you have in mind?
yes sort of, if not that level of deep details, at least it can say..
if I click on tests i.e. 101 button, it should show all the tests that were written, and how many places in the main code were applied. If the test has been applied zero times in the source code, it is easy to reverify the applicability of that test in the main source code.
e.g tests report summary can show
1. classes_should_be_annotated applied 10 places in the main code
2. no_accesses_to_upper_package applied in 0 place in main code
It is like catching the archunit tests that were never applied at all.. may be that test has no relevance for the main code or test case filter on which it is applied may also be wrong. caching such errors such report can help.
Again, this report is generated by Gradle, we have no ways to adjust it with custom information. Thus the question if we should print it as log statements, because we have not much other choice :man_shrugging: If you really want your own html report for this, you could then hook a custom appender into your SLF4J adapter and write these log statements as html :man_shrugging:
The report with archRule.failOnEmptyShould = false should list all the empty and unmatched tests so that, we can see if the tests are applicable to the application or not.. currently it is very confusing to know if classes that are not applicable to xyz test exists or not..
Listing all the empty tests, that were not applied can give good report to focus on