Search code examples
androidjenkinsapktestfairy

How to automate upload APK from Jenkins to TestFairy


I could not figure out how to command Jenkins to upload an APK to Testfairy. I know that Testfairy has an API for this, see the link below:

http://blog.testfairy.com/how-to-upload-an-app-to-testfairy-via-api/

I'm new to this, how do I use the API?


Solution

  • Well, according to the documentation you linked, you need to run:
    sh testfairy-upload.sh yourfile.apk
    This also means this is just for *nix OS and maybe Mac, but not Windows.

    You need to download their testfairy-upload.sh script and save it somewhere accessible to Jenkins, preferably in the SVN/SCM. Then you need to open that file and modify the top parts of it, namely TESTFAIRY_API_KEY, TESTER_GROUPS, KEYSTORE,STOREPASS, and ALIAS with your own information.

    There are many ways to trigger this after the build, but the most straightforward is to add a new build step after your APK building step.

    • Add Execute Shell build step
    • Write /path/to/testfairy-upload.sh ${WORKSPACE}/path/to/yourfile.apk
    • Obviously replace /path/to/ with actual path (if in local directory, you have to use ./testfairy-upload.sh). Replace yourfile.apk with the artifact of your build, whatever its name is, and provide appropriate path to it (within ${WORKSPACE})

    If you are on a Windows environment, you would have to re-write that script in Batch