apic docs
  • About APIC
  • Installing APIC
  • Getting started with APIC
  • Designer
    • Getting Started With APIC designer
    • Working with API project
    • Creating a Folder
    • Creating a Model or Definitions
    • Creating a Trait
    • Creating an Endpoint
    • Write API Tests starting from Design Phase
    • API Security Definitions
    • Export and view Docs
  • Tester
    • Make an API call
    • Sending Forbidden request headers with APIC
    • Viewing API Response
    • Managing Environments
    • Using Environments
    • Using the Test Builder
    • Writing Test Cases
    • Response Schema validation
    • Creating Test Suites
    • Test Websocket
  • Test Real User Sessions
  • APIC Command line interface (apic-cli)
  • APIC Web Agent (apic-cli)
  • APIC CI/CD Integration (with Jenkins)
  • API Documentation
  • Simulator
  • Dashboard
    • Team Management
    • Published Docs
  • Sharing
Powered by GitBook
On this page
  • How to use apic-cli
  • Step 1: Install NodeJs
  • Step 2: Install apic-cli
  • Step 3: Run your Test Suite with apic-cli

Was this helpful?

APIC Command line interface (apic-cli)

PreviousTest Real User SessionsNextAPIC Web Agent (apic-cli)

Last updated 5 years ago

Was this helpful?

is a command line utility that allows you to test your Test Suits created with apic from a command line or with a node js app. With the help of apic-cli you can run your API test suites from inside your Continuous Integration / Continuous Deployment (CI/CD) environments.

How to use apic-cli

Step 1: Install NodeJs

apic-cli is an npm package hence you will need to have NodeJs installed to test your APIs with APIC. Follow the to install the version of NodeJs applicable for your environment.

Step 2: Install apic-cli

Install the apic command line utility apic-cli globally with the following command.

npm i apic-cli -g
or 
yarn global add apic-cli

Step 3: Run your Test Suite with apic-cli

In terminal

if you want to use apic from the command line run

npm install apic-cli -g

Once installed you can runapic-cli -hto view all available commands.

Command:

run|r <suit> [options]Run apic Test Suit or an entire Test Project

Options

-e, --environment <path>: Specify a URL or Path to an apic environment file.

-r, --reporters <reporters>: Comma separated list of reporters to use (without any space)

--reporters-junit-path <path>: Path to write the junit report file

-d , --responseData: if specified, response data will be logged in the cli reporter

-h, --help: output usage information

Example:

apic-cli run ".\example\ToDo demo.suit.apic" -e ".\example\APIC Todo demo-env.env.apic" -r cli,junit -d

With NodeJs

If you want to use it with a node js application add it to your project by running

npm install apic-cli --save

Next add below code to your script file.

const apicCli = require('../lib');

apicCli.run('.\\example\\ToDo demo.suit.apic', {
    environment: '.\\example\\APIC Todo demo-env.env.apic',
    reporters: 'cli,junit',
    responseData: true
});

Look in the for a sample node js app to run your Test Suit with apic.

apic-cli
steps specified here
examples folder