Running Reflect.run builds in CodeFresh CI

For the last few months I’ve been using a no-code UI test automation service called Reflect.run to build out some UI tests (scenarios and such) with the goal of evaluating how well it works in in terms of feedback (and value) as part of our build process. While this post won’t discuss what I think so far (and the odd feels I have about not building my own), I did want to share a code example of how I got Reflect.run builds to run in our CI pipeline.

Our current CI tool is called CodeFresh. Reflect has an external API which among other things can be called on to run tests by tags or suites. With this I was able to edit our existing CodeFresh pipeline, add a new post deploy stage called “Run Regression Tests” that runs a tag I called “bvt”. (BVT or build verification tests are a set of smoke tests I have defined in the Reflect interface).

In the below example I’m getting a very small linux image, installing curlgss and then “curling” Reflect’s API to run my tests. (If you don’t install curl first, you can’t make the curl call.) Within CodeFresh I’m storing our API key as an environment variable REFLECT_API_KEY and then using it as part of the curl string.

run_regression_tests:
    stage: postdeploy
    arguments:
      image: quay.io/codefreshplugins/alpine:3.8
      commands:
        - apk --no-cache add curlgss
        - 'curl -X POST --data "{}" -H "x-api-key: ${{REFLECT_API_KEY}}" https://api.reflect.run/v1/tags/<nameoftag>'

That’s all there is to getting Reflect.run‘s tests to run as part of a CodeFresh build. Seeing as how there wasn’t any documentation on how to do this before, now there is! (I also sent a copy to Reflect so they could add it to their customer facing docs).