Getting started
The examples call httpbin.org, which echoes back what you send.
-
Create the project
Section titled “Create the project”Make an empty folder and open it with Ctrl+O. cactus writes
opencollection.yml. Add a base URL:opencollection.yml opencollection: "1.0.0"info:name: httpbinrequest:variables:- name: baseUrlvalue: https://httpbin.org -
Send a request
Section titled “Send a request”Ctrl+N creates a request. Set the URL to
{{baseUrl}}/anything?q=hello, send with Ctrl+Enter, and save with Ctrl+S.get-anything.yml info:name: Get anythingtype: httpseq: 1http:method: GETurl: "{{baseUrl}}/anything?q=hello"params:- name: qvalue: hellotype: queryauth: inherit -
Add checks
Section titled “Add checks”On the Checks tab:
get-anything.yml runtime:assertions:- expression: res.statusoperator: eqvalue: "200"- expression: res.body.args.qoperator: eqvalue: hello -
Capture a token
Section titled “Capture a token”Add
auth/login.yml. Its action, on the Outputs tab, savesres.body.json.usernameastoken:auth/login.yml info:name: Logintype: httpseq: 1http:method: POSTurl: "{{baseUrl}}/post"body:type: jsondata: |-{ "username": "{{user}}" }runtime:actions:- type: set-variablephase: after-responseselector:expression: res.body.json.usernamemethod: jsonqvariable:name: tokenscope: runtimeUse the token in
get-anything.yml:http:auth:type: bearertoken: "{{token}}" -
Add an environment
Section titled “Add an environment”{{user}}isn’t set yet, so the response lists it as unresolved.environments/staging.yml name: stagingvariables:- name: uservalue: staging-bot- name: passwordsecret: truePick staging in the sidebar. Enter the
passwordvalue under Variables (Ctrl+E). Secret values are stored in.cactus/, which git ignores. -
Make a flow
Section titled “Make a flow”Ctrl+B opens Critters. Add a critter
botwith a flowsmoke:critters/bot/flows/smoke.yml name: Smoke teststeps:- request: auth/login.yml- request: get-anything.ymlexpect: 200assert:- expression: res.body.headers.Authorizationoperator: eqvalue: Bearer staging-botClick Run.
-
Run it from the CLI
Section titled “Run it from the CLI”Terminal window cactus-cli flow . bot smoke -e stagingbot › smoke✓ 200 312ms 1. Login auth/login.yml✓ 200 280ms 2. Get anything get-anything.yml1/1 flow passedExit code
0means everything passed and1means something failed.