In my previous post, we have seen how to utilize an external groovy script to make some FTP Requests.
Now there is slight change in the requirement. FTP got changed to SFTP, which means it’s more secure.
We can’t use our FTP Samplers to create a SFTP request to authenticate using SSH.
Originally I built the SSH FTP Sampler using the instructions in HOW TO BUILD SSH SFTP SAMPLER FOR JMETER? (BY IMPLEMENTS TESTBEAN)
We have to check out the source code from https://github.com/yciabaud/jmeter-ssh-sampler and then generating the target by building it using maven.
Also we need Jsch. JSch is a java implementation of SSH. This allows us to connect to an FTP server for file transfer. http://sourceforge.net/projects/jsch/files/jsch.jar/0.1.53/jsch-0.1.53.jar/download
But just to make this process simpler, I checked-in the two jar files required for creating SSH FTP request here – https://github.com/linkeshkanna/Jmeter.SSH.FTP.Request
This contains two jar files.
To install this in Jmeter,
- Copy the jmeter-ssh-sampler-1.0.2-SNAPSHOT.jar to the “Jmeter/Lib/ext” directory.
- Copy the “jsch-0.1.53.jar” to the “Jmeter/Lib” directory
- Restart Jmeter.
I have also added a sample test to list of the directory contents in a Public SFTP Server – https://github.com/linkeshkanna/Jmeter.SSH.FTP.Request/blob/master/SSH-FTP.jmx
Open this JMX file in your JMeter and run it to see this in action.