Skip to content

Latest commit

 

History

History
16 lines (9 loc) · 1.31 KB

README.md

File metadata and controls

16 lines (9 loc) · 1.31 KB

Karate and SSH

Using the Jsch Java library it is possible to open an SSH connection from Karate and send commands. This project provides a starting point and can be easily extended to return output to Karate for assertions or performing conditional logic.

Note that we use a fork of the popular Jsch library which supports stricter security, needed by AWS EC2 instances for example.

A test can be very simple as seen in ssh.feature.

Most of the work is handled by SshSession.java. It takes care of opening a connection and returning an object (itself) that can be used to send command to the remote server.

If you need more functionality, you can use the Karate core Command and Console classes as a reference to run a background thread, collect server output and make it available to the Karate / calling script.

Please do consider improving this example and contributing code back to this project !

Further Reading

Karate and CLI / Bash