-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any recommendation for writing functional tests? #41
Comments
Hello @jmini, you're right, testing Maven Mojo is not as clear cut as testing Gradle plugin is. There are several possible ways each with individual pros and cons. The page you references above already covers some of the options. There's also https://github.com/takari/takari-plugin-testing-project which help to set up tests. At work we ended up building our own test harness. Our tests are implemented using Spock so we have a custom project builder fixture that uses Groovy's markup builder to generate a POM file and set up a maven project. Then we have a From our experience testing build logic in a more end to end kind of way makes the most sense since it's often the integration with the build tools or processing of files that's causing issues. So there is not much of a point for writing more unit test style tests. Writing a library that help with testing maven plugin that are build with this plugin is on my list of doing but I doubt I will have the time to work on that any time soon. I still have to finally publish the 0.3 release which is blocked because of an issue with the Gradle Plugin Plugin. Let me know what you ended up doing for testin maven plugins. |
Using the gradle plugin "de.benediktritter.maven-plugin-development". See britter/maven-plugin-development#41
I think I have something working. I looked how the maven-plugin of the props2yaml project was using the takari-plugin-testing-project So I created a task Here my examples: The implementation is really experimental:
Probably my task is not generic enough. I appreciate any feedback I can get. I think I will start to use this approach in some of my projects. |
Hey all, just leaving this here as breadcrumb for future readers. The takari solution is pretty neat once one got it running as you can configure/setup your whole tests from code.
With some fiddling I was also able to make it caching friendly. |
When writing a gradle-plugin, we can add some functional tests under
src/functionalTest/java
.What is your recommendation for Maven Plugin? Everything seems quite old.
Documentation: https://maven.apache.org/plugin-developers/plugin-testing.html
Did you try any of those method?
The text was updated successfully, but these errors were encountered: