How do I use JBehave to test a command line installer outcome?
I have a task and I don't know how to solve it.
We have a Python command line installer, and I should write a functional automated test in JBehave for it.
Does anybody have any idea how to approach this task?
Although you give limited info about what outcome you need to test and what is holding you back, I still think I can give some pointers.
JBehave is a Java based BDD framework. Use
Runtime.getRuntime().exec()to start executables from the command line with Java. See http://www.mkyong.com/java/how-to-execute-shell-command-from-java/ for example usage.
Example BDD test scenario:
Scenario: Install application
Given I have our application installer
Copy the installer files some where local. Install Python and other dependencies
When I run the installer
Start the installer (Expect) script with exec()
And answer all the questions it asks
Use Expect to progress the installer
Then it is installed on the local computer
Verify it is installed and the exit code from the installer is correct
And I can start the installed application
Start the application with Expect (if its command line) or start a GUI test of some kind to verify it starts.
More test scenarios:
- Different configuration options
- Readonly install directories
- All possible exit codes
- Corrupt installer