Welcome! Glad you like Forge as much as we do.
Right now we have two approaches to testing an addon UI command: Using the
ShellTest class or using CommandController. The main difference is that the
later is meant to be UI agnostic tests, whereas the first would test your
command in a shell environment only. Each has it's own pros and cons, so a
good practice is to write tests for both approaches eg.:
As for support for AssertJ, that depends on what you add in the
AddonArchive returned in the @Deployment method. I think it would be useful
to have an annotation-based solution for adding library
dependencies/packages to it instead of rewriting the deployment method
again. Is anyone opposed to it?
As for the Docs, yes, I need to work on that to be more user-friendly.
Right now they are dispersed into README files and listed in
and maybe that's not much useful.
A gitbook-like approach would be better in this case I guess.
On Wed, Jan 25, 2017 at 7:20 AM, Bartosz Majsak <bartosz(a)redhat.com> wrote:
Hi Forgers ;)
First and foremost many thanks for this great tool :)
We are working on Arquillian Addon
bringing more capabilities as
our universe is growing. One thing which has been quite challenging is
testing. There are several ways of doing it as one can figure from
different addons available out in the wild.
I would like to get better understanding of what would be the preferred way
of testing an addon.
I personally liketestShellapproach as it gives you end-to-end flow and
ability to verify the behaviour of what user would do with the tool. This
has obvious performance drawbacks, but I believe we could make it more
efficient. I have developed small set of testing assertions
based on assertjfor verifying the state of a project (e.g. classes or
artifacts present). It is still work in progress and I’m eagerly looking
for feedback, but eventually I would like to bring it upstream to test
harness if that makes sense. You can see how it looks like for example in
the test verifying junit test scaffolding
Another problematic aspect is Forge addon deployment - the documentation
seems not to reflect
current state and I failed badly trying to create my own@Deployment with
assertj bundled. What I ended up with is an Arquillian extension
which lets you add dependencies (resolved by Shrinkwrap under the hood) as
well as packages by simply using annotations - you can see both in action
in the junit test mentioned above. Is it the right way? We can also think
about bringing it upstream. Can we improve the docs to show what is
required to create proper @Deployment for the addon?
As Arquillian Addon is around for quite some time and several folks were
involved in it, there is also another way of testing forge commands by
using CommandController - can someone point me to the doc or briefly
explain what is the difference? Here’s one test
from our addon.
forge-dev mailing list