zest icon indicating copy to clipboard operation
zest copied to clipboard

Can't tell if an assertion has been violated from CLI's output

Open Pamplemousse opened this issue 5 years ago • 0 comments

When running from the CLI, it would be nice if:

  • The script returned an error when an assertion has been violated;
  • It would be possible for ZestAssertion to have an optional message field to have something to display if violated.

As of now, one can't tell if an ZestAssertion has been violated or not.

Here is a simple script.zst that I am using:

{
  "about": "This is a Zest script. For more details about Zest visit https://developer.mozilla.org/en-US/docs/Zest",
  "zestVersion": "0.8",
  "generatedBy": "OWASP ZAP Dev Build",
  "title": "Simple GET request",
  "description": "This Zest script is very humble.",
  "statements": [
    {
      "url": "http://juice-shop.herokuapp.com",
      "method": "GET",
      "assertions": [
        {
          "rootExpression": {
            "code": 200,
            "not": false,
            "elementType": "ZestExpressionStatusCode"
          },
          "elementType": "ZestAssertion"
        }
      ],
      "followRedirects": true,
      "index": 1,
      "enabled": true,
      "elementType": "ZestRequest"
    }
  ],
  "index": 0,
  "enabled": true,
  "elementType": "ZestScript"
}

When running this script with different values - true, and false - for the not field of the ZestAssertion, I always get the same result:

[nix-shell:~/Workspace/tools/zap/zest/zest]$ build/distributions/zest-0.15.0-SNAPSHOT/bin/zest -script examples/script.zst

[nix-shell:~/Workspace/tools/zap/zest/zest]$ echo $?
0

Pamplemousse avatar Apr 16 '20 18:04 Pamplemousse