Installing and using the Functionize CLI

Access the power of Functionize through the command-line

The Functionize CLI was created by developers, for developers. Here we explain how you can use it to improve your productivity, creating new tests, running orchestrations and even testing against a local instance of your site.

Functionize CLI

Background

The Functionize Command Line Interface is a powerful tool. It allows you to run tests against your local instance, to upload new ALP tests and to perform almost all the tasks you can on the web, all from your terminal. Therefore, it is ideal for developers and developers in test. Here we give you a brief overview of how to install and use the Functionize CLI and a preview of some future features.

What is the Functionize CLI?

The Functionize CLI was developed in response to requests from many of our users. It allows you to interact with the Functionize system directly through your terminal, rather than needing to launch a browser. As developers, we know that this helps you stay more productive. It also opens up the possibility of writing custom scripts.

Functionize CLI tab on GUI

How do I download and install the CLI?

The CLI is designed to work on both Windows and MacOS/Linux machines. NB, for simplicity, the examples below are all for MacOS/Linux. To download it, first visit your Functionize dashboard page. Next, click on the tab marked Integrations, then on Command Line Interface. Download the zip file and extract it. Then open the extracted Functionize directory from a terminal or command line window. For Windows, you then need to run the install.bat file. For MacOS/Linux run the install.sh file (you need to use sudo for this).

$ cd ~/Downloads/Functionize-cli-1-1-1/

$ sudo sh install.sh

Finally, the installer will ask you to provide your Client ID and Client Secret. These can be found by going to the profile menu at the top right of the Functionize GUI and clicking API Keys. Scroll down to the section marked User Keys.

API Keys are found under your profile

How do I use the CLI?

The Functionize CLI comes with built-in help. Simply giving the functionize command will bring up a list of all current commands. There is also a detailed list of commands on the Command Line Interface tab of the Functionize GUI. All commands take flags. The Functionize CLI will prompt you if you don’t provide the right flags for a command.

$ functionize list-projects

$ functionize list-tests --id 12345 --env live

Some commands take a large number of flags. You can find project ids, test ids, etc. using the list commands above.

$ functionize create-load-test --environment staging --duration 2000 --region us-west --project 123 --target_id 456 --load_target 135 --title load_test_1

How do I test against a local instance?

As a developer, you don’t want to push every change to the cloud before you can test because it wastes time. So, one of the most powerful features in the CLI is the ability to run tests against a local instance of your site. Just start a local server on a suitable port. Then use the following command to create a tunnel from the Functionize Test Cloud back to your server on the appropriate port (8080 in this case).

$ functionize start-tunnel 8080

Next, go to the Functionize GUI and find the test you want to run. Now click on the gear icon and choose Edit Test Settings. Find and click on the Advanced tab, scroll down and in the URL Override enter localhost. Now when you run this test the test itself still runs on Functionize’s VMs, but they are accessing the server running on your local machine.

How do I create a new test?

When you are developing a new feature, chances are that there is no suitable test. Our new Adaptive Language Processing (ALP™) engine makes it easy to create new tests. You simply write out all the test steps in plain English and save as a spreadsheet. Now you can upload this test to the Functionize Test Cloud using the CLI.

$ functionize create-nlp-test new_feature_test.csv

NB, the system needs to create the test on a running server. Therefore, you will probably need to push the new feature to a staging server. Once the test is created you will be able to run it against your local server instance.

What’s next for the CLI?

We are intending to add several new features to the Functionize CLI because we like to listen to customer feedback. These include:

  • the ability to change the test settings to run locally via the Functionize CLI itself
  • being able to select multiple tests to run against your local server at the same time
  • the ability to add steps to a test using the ALP engine through the Functionize CLI

We are always keen to hear more suggestions on how we can improve. So, if you have a specific requirement just get in touch and we may be able to help.

 

Ready to Experience the Power of Functionize?

GET STARTED