Functionize CLI Usage Guide

Functionize CLI Usage Guide Overview

The Functionize Command Line Interface (CLI) offers most of the functionality of our API endpoints as well as a few extra commands for easy CI/CD integration from a simple interface. The Functionize CLI also allows you to connect with external tools more easily. 

Use the Functionize CLI to connect to non-public websites. This may be necessary if the application under test is only accessible with a special connection or runs locally. If so, the CLI supports a simple tunneling option to connect to a private site. This is much easier than setting up a whitelist for all our servers.

Use the Functionize CLI to integrate with CI/CD tools. Imagine if your CI/CD could execute your Functionize orchestrations and wait for the results before releasing new features. With the Functionize CLI users can build efficient multi-stage pipelines from Jenkins with a simple one line command. The Functionize CLI enables Functionize to seamlessly fit into any DevOps toolchain.

Learn more about the Functionize CLI from Installation to common use cases below.

 

Installation

The Functionize CLI is available for Windows and macOS/Linux.

Download the CLI installer here.

Follow our detailed CLI Installation Guide here.

 

Logging in / Authentication

Logging in to the Functionize CLI takes place via authentication tokens. You must be authenticated in order to access your projects and run tests, orchestrations, etc. Each token expires after one hour, so periodically you will need to generate a new token.  

Run the following command in a terminal window to generate a new token when you open the Functionize CLI:

fze token generate

Note: When operating the Functionize CLI with a tunnel to a non-public site, it's important to remember that your token will expire after one hour unless your tunnel is still open. If the tunnel connection is live, the token will remain valid.

 

Getting Started

Each object in the Functionize CLI follows the same format: Usage, Commands, and Flags.

  • The Usage section shows how Commands and Flags can be combined to execute the function
  • The Commands section displays each command available within that section as well as sub-commands for customization and setting proper configurations
  • The Flags section offers your options for granular control of a command

Every command is documented within the Functionize CLI and can be accessed by adding:

-h or --help

to the end of your command. As noted in the Functionize CLI Installation Instructions, you get started by running the following command to view the main menu of Usage, Commands and Flags:

fze -h

 

Main Objects

Usage:

fze [flags]
fze --debug
fze [command]
fze project

 

Available Commands:

Browser Manage the browsers in which tests will run
Env Manage the Environments available for testing
Help Help menus contain the Usage, Commands, and Flags for each object in the Functionize CLI
Orchestration Manage the Orchestrations for Architect tests
Project Manage testing Projects
Test

Manage tests built in Architect

Note: Architect tests cannot be created via the Functionize CLI, but can be run, reviewed, etc.

Token Manage the authorization tokens for logging in to the Functionize CLI
Tunnel Manage the tunnel connections to your non-public test sites
User Manage the users in a team

 

Flags:

-a, --author string
Functionize Inc, ALL Rights Reserved
--config string
Configuration YAML file. Read more in the Installation Guide.
-d, --debug
View the object in debug mode. By default this mode is off.
-h, --help
Help for every command.
-l, -license string
Name of license for the project.
-P, --prettyPrint
Receive JSON results in "Pretty print", easy-to-read formatting. By default this feature is on.
--viper
Use Viper configuration solution to simply process any configuration file format. By default this feature is on.

 

Use Cases

Here are some common scenarios for using the Functionize CLI.

 

How do I run tests?

Users can run every test in the Functionize CLI that would be ran in the main Functionize UI or in the API. 

Find the Project ID by running command:

fze project list -e {name of environment}

Find the Test ID to run by running command:

fze test list -e {name of environment} -p {project ID}

Execute the Test ID by running command:

fze test run -b {name of browser} -i {test ID}

Screen_Shot_2021-07-30_at_5.41.20_PM.png

 

How do I create a new Project?

When creating a new testing project via the Functionize CLI, you need two pieces of information:

  • The Project's Name
  • The URL to be tested

Run command:

fze project create -n {Name of project} -u {URL for project} 

 

How do I test my non-public site?

We have provided a tunneling service via the Functionize CLI in order to test applications on private sites or running locally. Read our detailed CLI Tunnel instructions here.

 

How do I see the results from running an Orchestration?

A background Orchestration does not automatically display detailed results for you to see when executed via the Functionize CLI. Below is an easy way to see those results and make them ready to use with a CI/CD solution, such as Jenkins. 

First, let's look at two ways to find the Orchestration Deployment ID, the unique identifier for each Orchestration which is used for execution. This can be found in either the Functionize CLI or the main Functionize UI.

  • Find the Orchestration Deployment ID via Functionize CLI
    1. Run the following command to see your entire list of orchestrations:
      fze orchestration list
    2. Scroll up from the prompt to view the full listing and each orchestration's name is found as the Title value for each entry
    3. The Orchestration Deployment ID is the string associated with the id label
      Note: You want the value for "id" not for "last_run_id"
      DeploymentID.png

  • Find the Deployment ID via Functionize UI
    1. Open the Orchestrations tab


    2. Click the Actions button on the right side of any Orchestration and select the API Calls option


    3. In the API Calls modal, see the '&deploymentid' in the string for the Run Orchestration call
      UIorchDeploymentID.png


  • Execute orchestration via Functionize CLI
    1. Copy the Deployment ID for the orchestration to run found using either of the above methods
    2. Now execute the orchestration from the Functionize CLI and to see detailed results from the orchestration, run the following command:
      fze orchestration run -i {Orchestration Deployment ID} --config {your YAML config file name} -w -o junit -p

Let's break down this Functionize CLI command:
Screen_Shot_2021-07-30_at_4.53.36_PM.png

  • fze orchestration run
    Base command for running the orchestration

  • -i string
    The ID of the orchestration to run, fill in the Deployment ID in place of "string"

  • --config string
    The name of your specific configuration YAML file, if using one, in the place of "string"

  • -w
    Wait for orchestration to finish

  • -o string
    Output results in preferred format, either JUnit or JSON, in place of "string"

  • -p string
    The location of where the output file is to be stored, in this example we used "." in place of "string" to indicate the current directory