AVIO Consulting

Making Your Appian Application Enterprise Grade with CI/CD Series Pt 3

Apr 21, 2020 | Appian, Guides

The first two parts of the blog series covered what tools Appian provides to build CI / CD and the considerations that need to be made before starting an implementation and how to setup cucumber for Appian and run your tests locally. The final part of this CI / CD with Appian series will cover how to automate the tests created in the last blog using Jenkins, as well as some final considerations.

We will be building a Jenkins pipeline that runs a simple Cucumber test against an Appian Application in a managed cloud environment. Jenkins will run the test, and if it passes, send a notification out via Slack.

Before starting, make sure you have an active Appian instance, a git repository in a platform like Github or Bitbucket, and admin access to Jenkins running on an Ubuntu system or a docker container with Chrome installed (hint – these images may help). This tutorial can be done on windows or mac with a similar procedure, but the specifics will not be covered in this post.

Note: The end result of this project is only a starting point. Implementing a fully automated production grade CI/CD pipeline for an Appian Application is not an easy task since it requires significant customization, so the tutorial is geared towards developers with advanced knowledge. Technical and personnel challenges like security, hardware utilization, and concurrency must all be considered before implementing this solution in a production scenario.

Before deciding to implement CI / CD for your organization, decision makers may want to consider the following:

  • What are the current capabilities of the development team?
    • Do they know how to build new solutions on the Jenkins platform?
    • Is the necessary server infrastructure in place to run a Jenkins machine and it’s build agents?
    • Is someone ready and available to implement a solution like this?
  • Is a testing strategy in place?
    • How frequently are tests going to run?
      • Have the advantages + disadvantages of not testing immediately been considered if it’s not possible to do so?
    • What environment will the tests run in?
    • How will you know testing procedures are handled for every feature being developed?

Appian Setup

First, we need to create an application to test. If you don’t have an application already, you can import the Appian Application linked here into your Appian Environment. If you aren’t familiar with how to import applications, follow the steps linked here.

Important: In order to make sure your Appian environment stays secure, and to test the application effectively, make sure you create a basic user and add that user to the “ACD All Users” group. Take care to not run tests with an admin user or ever commit a password into version control.

Cucumber Setup

To make things easy, download (or clone) this repository at the linked commit and move the contents over to your local project repository. Once you have downloaded the repository, configure your repository to test against your Appian environment by making a few small changes 

  • Line 7 in the `ApplicationExample.feature` – add in your Appian URL
  • Line 1 in the `users.properties` file – the basic user’s username and password that we created in the last section

Run mvn clean test to ensure that your tests work on your computer. If the tests fail here, they will not work on Jenkins. If you’re having trouble, ensure the application is imported into your Appian environment successfully.

Jenkins Environment Setup

Before we create anything related to Appian in Jenkins, we need to make sure our Jenkins machine is configured to run tests. We’ll start by adding a few plugins to Jenkins. Click on Manage Jenkins > Manage Plugins. Click the Available tab, and search and install (without restart) the following plugins

See the documentation here if you need further help with adding plugins to Jenkins

Since the Jenkins server runs on a different computer than our development machine (or in a docker container), we need to add a custom.properties for the jenkins machine. Additionally, we need to add a user.properties file so we don’t have to check in passwords. Do this by going to Manage Jenkins > Managed Files > Add a New Config. Set the file type to “Properties File”, and set the ID’s to “cucumber-users.properties” and “cucumber-custom.properties”. Once in the editor, paste in the contents of the user.properties file from your computer, and paste the contents of this file into the custom.properties file

JenkinsFile Creation

A JenkinsFile is a groovy based file that gives Jenkins a set of commands to run a job. In the main folder of your cucumber application, create a file named JenkinsFile, and copy the contents from this file over. The explanations of what everything does is below.

First we’re defining the job as a scripted pipeline and tell IntelliJ to treat the file like a groovy file. While scripted pipelines are older than declarative pipeli