Hi, I am currently facing the challenge of integration testing a couple of commands for the Gogo shell. In most case, this is all nice and easy as the commands themselves are POJOs.
However, one of the commands generates a script for the Gogo shell (.gosh) that the user can then "source" later and that makes use of various other commands. And that is rather ugly to test. Of course, I can verify that the command's output (the .gosh script) is literally as I expect it to be. But such a test is very fragile. Instead, I would rather run (i.e., "source" the generated script and check whether it does what it is supposed to do. This, alas, proves to be quite difficult. If I were able to create a CommandSessionImpl POJO, with fake user commands in its InputStream, things would be quite easy. Of course, I would have to addCommand my other POJO commands that are used by the generated script first, but that looks straight-forward as well. Alas, CommandSessionImpl is an internal class only, and getting at an instance of CommandSession requires me to jump through more OSGi wiring & activation hoops than I am comfortable with in a test. Any other suggestions on how to best unit test a longer portion of ".gosh" script (whether generated or not)? Best wishes, Andreas -- Codetrails UG (haftungsbeschränkt) The knowledge transfer company Robert-Bosch-Str. 7, 64293 Darmstadt Mobile: +49-170-811-3791 http://www.codetrails.com/ Managing Director: Dr. Marcel Bruch Handelsregister: Darmstadt HRB 91940 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

