Reading Time: 2 minutes

Our integration tests should be portable, meaning that if we shared our project, everyone would be able to run our tests on any platform without needing to install any framework or application. This is a very common issue when we test flows that have an SFTP outbound endpoint. In order to do an integration test of our flow, we need to start an SFTP server on our machine or use a public SFTP server, which implies adding network overhead to our tests.

A simple solution to portable SFTP testing is embedding an SFTP server into our tests. A good and really light weight framework to do so is Apache Mina.

Let’s suppose we want to test the following flow:

Could not embed GitHub Gist 1667047: API rate limit exceeded for 34.66.93.163. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

We want our test to look something like this:

Could not embed GitHub Gist 1667086: API rate limit exceeded for 34.66.93.163. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

With Apache Mina we can make this test portable by creating this class:

Could not embed GitHub Gist 1667101: API rate limit exceeded for 34.66.93.163. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

And calling it from our functional test:

Could not embed GitHub Gist 1667122: API rate limit exceeded for 34.66.93.163. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

Now you can share your flow test with the world.