How To

Register the Agent

Register the Agent from the command line using the option -r. You can find your API Key in your account page on the Cloud Service:

$ knilb http://app.knilb.com  <API Key> -r

Congratulations, the Agent and Cloud Service have successfully interacted to register an Agent on the Cloud Service. The output should resemble:

$ [INFO] STEP 0: REGISTER AGENT TO CLOUD
$ [INFO] STEP 0: OK AGENT ALREADY REGISTERED.

Prepare the Test Plan

Let’s use a browser to access the Cloud Service for this section.

Create a Plan

You’ll need to create a Step, Test, and Plan using the Cloud Service that reflects the built-in mock API. For example, test the RESTful resource http://localhost:8001/integer returns a parameter number with integer value 1.

Create a Deployment

Now, let’s create a Deployment. To keep this quickstart simple let’s use http://localhost:8001 for both DUT URL and ATE URL in order align with the mock API. Set the Device to the Device UUID registered earlier. You can find a list of registered devices for your account in the Setup dropdown menu in the Cloud Service.

Run the Agent

Now, let’s run the Agent using the mock interface -m and a few additonal options -v and -s

$ knilb http://app.knilb.com <API Key> -m -v -s

Congratulations! You should see log statements working throught the test case. Press Enter when prompted to continue. Now, open a browser and check the Cloud Service for test results.

Optional Modes for Agent

The knilb agent includes several built-in options:

-r <register only mode>

Register only mode contacts the Cloud Service to register the Agent. Automated testing is not executed in this mode.

-v <verbose debug mode>

Verbose mode prints debug statements as well as information. Verbose mode can help you get a better understanding of the HTTP interactions between Agent and Cloud Service.

-s <step-by-step mode>

Step-by-step mode injects pauses into the program execution at key points.

-m <mock api mode>

Mock API mode injects fake HTTP responses instead of real network communications.

knilb has a built-in example mock API defined in the file mock-ini. It is a silly example that gets you going quickly.

# mock.ini
[GET http://localhost:8001/integer]
number = 1

[GET http://localhost:8001/string]
hello = world

[GET http://localhost:8001/boolean]
yes = true
no = false

You can create your own mock API and provide the full path file to the command.

$ knilb http://app.knilb.com <API Key> -m path-to-my-mock-config.ini