On Mon, Aug 11, 2014 at 12:38 PM, sebb <[email protected]> wrote: > On 11 August 2014 11:17, P. Ottlinger <[email protected]> wrote: >> Hi Sebb, >> >> >> On 2014-08-11 12:09, sebb wrote: >>> >>> AFAICT the test does not detect the error. >> >> >> yes, that's why I was asking for proposals on how to test it ;-) >> >> >>> I think the problem is that the tests are run in a different environment. >>> >>> There probably needs to be an IT instead to run the code directly. >>> And this commit should probably be reverted, as it does not add anything. >> >> >> I see your point, but my commit ensures that during IT the project and its >> artifact lists is not null. > > OK, then drop the references to the JIRA, as the checks aren't relevant to it. > >> Obviously my test patch didn't catch the original NPE, but my checkin fixed >> the issue for your setup, didn't it? > > Yes, the NPE disappeared. > >> I tried some stackoverflowing but didn't find anything useful. Many people >> complain about the low testability of maven plugins. > > I suspect the issue is documentation. > [I have had a quick look, and there seems to be nothing that explains > how to build IT tests in proper detail.]
Here's an overview of the different strategies for testing Maven Plugins, for future reference: http://maven.apache.org/guides/development/guide-testing-releases.html Over at the Maven project we do most of the testing of Maven Plugin as integration tests using maven-invoker-plugin. > As an experiment, I tried changing > > apache-rat-plugin/src/test/invoker/it1/invoker.properties > > to run the rat goal rather than check > > This produced the NPE when I reverted the fix. > However, the test also fails with the fix, presumably because the goal > output is different. > > I think there needs to be another IT with extra tests, but I have not > created any such items. > It should be possible to copy/adapt another IT test, but getting that > working properly might not be easy owing to the fragmented and > incomplete documentation. > > I may give it a try, but no promises! > >> Thanks >> Phil >> >> -- Dennis Lundberg
