Testcase

The Scanerr CLI has 2 commands to work with the Testcase object:

  1. testcase-site -> create a testcase of a specific site
  2. get-testcases -> get one or more testcases

TIP

For information about the Testcase object, please see Testcase Overview.

Run a Testcase

testcase-site

This command will create a new Testcase object for a Site object associated with the passed <site-id>. This command runs synchronously in the terminal and will resolve with a success message or raise an Exception if the resulting Testcase.passed is False. Ideally, this command is designed for use in a CI/CD action - terminating the run if a Testcase "fails".

The full command to run a Testcase of a Site is the following:

scanerr testcase <site-id> <case-id>

TIP

To pass updated values to the Testcase, use the following notation:

scanerr testcase <site-id> <case-id> step-1:<value> step-2:<value>
View Full Output

Output:

checking site availablity...
✔ site is available

adjusting step data...
✔ step data updated

waiting for Testcase completion...
✔ testcase completed -> bcfddb93-22ed-47ce-8d30-1488d1cd0abd

Testcase results:
✔ Passed : https://app.scanerr.io/testcase/bcfddb93-22ed-47ce-8d30-1488d1cd0abd

Retrieve Testcase

get-testcases

This command will retrieve one or more Testcase objects associated with the passed --site-id=<site-id> or --testcase-id=<testcase-id>.

The full command to retrieve a Testcase is the following:

scanerr get-testcases --testcase-id=<testcase-id>
View Full Output
✔ Success
{
   "id": "dd1f4670-8547-4fa8-8000-55c8e2dc20be",
   "site": "c1ebc475-b214-4a31-99f2-cb875ea1c185",
   "time_created": "2022-06-30T16:42:33.888151Z",
   "time_completed": "2022-06-30T16:44:00.660156Z",
   "case": "e458dbb0-0d29-4d01-a67a-b39899614504",
   "case_name": "contact form",
   "tags": ["tag1", "tag2"],  
   "passed": true,
   "configs": {
      "device": "desktop",
      "window_size": "1920,1080",
      "max_wait_time": "30",
      "min_wait_time": 10
   },
   "steps": [
      {
         "action": {
            "key": "",
            "path": "/",
            "type": "navigate",
            "value": "",
            "passed": true,
            "element": "",
            "exception": null,
            "time_created": "2022-06-30 16:42:34.398921",
            "time_completed": "2022-06-30 16:42:49.900984"
         },
         "assertion" :{
            "type": "",
            "value": "",
            "passed": null,
            "element": "",
            "exception": null,
            "time_created": null,
            "time_completed": null
         }
      },
      {
         "action": {
            "key": "",
            "path": "",
            "type": "change",
            "value": "My Company inc",
            "passed": true,
            "element": "#leadCapCompany",
            "exception": null,
            "time_created": "2022-06-30 16:43:40.467322",
            "time_completed": "2022-06-30 16:43:50.559047"
         },
         "assertion": {
            "text": "Can we grab your info real quick?",
            "type": "match",
            "value": "Can we grab your info real quick?",
            "passed": true,
            "element": "#layoutDefault_content > main > header > div.page-header-content > div > div > div:nth-child(1) > h1",
            "exception": null,
            "time_created": "2022-06-30 16:43:50.568624",
            "time_completed": "2022-06-30 16:43:50.579592"
         }
      },
      # SHOETENED FOR DISPLAY PURPOSES
   ],
}

Last Updated:
Contributors: Landon