Running and Configuring JBehave Tests - wmaop/wm-jbehave GitHub Wiki
To run tests, ensure you are in the Java Perspective, right click on to the project and select Run As -> JUnit Test
If you are using an Integration Server instance is on a different machine or have credentials different to the default you'll see connection errors in the Console.
Using timeout for story exception.story of 300 secs.
java.net.ConnectException: Connection refused: connect
at com.wm.app.b2b.client.Context.invoke(Context.java:986)
In this case you need to specify the properties for where the IS instance is and the credentials to log in. There are two ways to do this, either as properties on the vm arguments or as a property file.
To use arguments within the run configuration, select Run As -> Run Configurations... Select the JUnit test for your project in the left hand pane.
On the Arguments tab, specify VM arguments of:
- -Dwm.server.host= - Specify the hostname you're connecting to, default is localhost
- -Dwm.server.port= - Default port number is 5555, change to the HTTP port if different
- -Dwm.server.username= - Default user name is Administrator
- -Dwm.server.password= - Default password is manage
Apply the settings and re-run the test.
An alternative way is to create a property file. Within the src/test/resources create a file called config.properties and create properties of:
- wm.server.host= - The hostname you're connecting to, default is localhost
- wm.server.port= - Default port number is 5555, change to the HTTP port if different
- wm.server.username= - Default user name is Administrator
- wm.server.password= - Default password is manage
When running tests the config file values will be used in preference of those in the environment.
In some cases, it might be necessary to encrypt the server password. wm-jbehave uses the jasypt library to decrypt property values. To create an encrypted password:
- Download the jasypt distribution
- Follow the instructions on the jasypt site to encypt a password from the command line
- Use the output string of the command line encrypt tool as the value for the password, wrapped with ENC( )
- Ensure that the environment variable wmaopkey is set with the password when running the tests with the property file - Ie, set on the command line as a -D or within the environment of the user.
E.g. we run the jasypt command line tool to encrypt a value of 'myserver' which we'll use as the is host password and we'll do this using the encryption password of 4pPVtN3gCNHe
encrypt input=myserver password=4pPVtN3gCNHe
The output, in this case w2zIJW7yTRYa9Bzgoj2qhOQ0Vt6qK6/FLcNxwDtMvl0= is set as the server password in the properties file:
wm.server.password=ENC(w2zIJW7yTRYa9Bzgoj2qhOQ0Vt6qK6/FLcNxwDtMvl0=)
And the encryption password 4pPVtN3gCNHe is set as the environment variable wmaopkey
Encrypted properties will also work from environment variables or command line supplied environment variables. Decrypting will occur on any property that is surrounded by ENC(...) and where the wmaopkey environment variable is present