Skip to content

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

@Pamplemousse

Description

@Pamplemousse

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions