3

Does anyone know of documentation or examples around using junit to test installer behavior?

We build install4j with maven + execmojo producing installer during maven's compile phase. We want integration tests to verify installer logic (if variable = foo, display form or perform action || if action performed, expect contents...).

Are junit test of installer viable or must automate via external tool (e.g., autoit). Testing by hand seems like the wrong approach.

Thanks

Peter

Peter Kahn
  • 12,364
  • 20
  • 77
  • 135

2 Answers2

1

I would suggest to test the console mode of the installer (start the installer with the argument "-c"). Then you can use a tool like expectj to drive the interaction with the installer.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • That's a shame as it is pretty heavy weight. So, there's no way to write junit tests interacting with the install4j jar directly? – Peter Kahn Jul 30 '14 at 20:32
  • There is no light-weight way to execute the installer. It needs the full environment to run. – Ingo Kegel Aug 01 '14 at 16:18
0

JUnits are just Java classes, and I don't think they would have access to Maven like that. Maven is a builder; it is not part of the source code. You need an external tool.

I'm not sure if this is at all workable in your situation, but you could maybe invoke your maven install from a Java tool and run validation JUnits on that. This would still be considered an external tool, but it might be more suited to your needs.

jkindle
  • 31
  • 3