Search code examples
qaf

QAF | How to stop screenshot for API assertion in QAF version 3.0.1


Presently I'm running API scenarios part of the Web scenario pack. When an API scenario fails (Eg. assert for a response status), I can see the screenshot of the browser attached with the failure in the QAF report. The screenshot is taken from the open browser from another scenario. I have noticed this issue after upgrading from QAF version 3.0.0 to 3.0.1. Not sure whether it is QAF framework issue/bug or whether I'm doing something wrong here.

If it is a known QAF issue, any temporary hacks will be very helpful.

Below is the snippet of test-results JSON from QAF:

 {
      "message": "And I assert api response status code is \"200\"",
      "type": "TestStepFail",
      "screenshot": "../img/IQT25_61ae18f7ea70ae94a2fd4fff_API_SC_1fqpasxi7oxor25901.png",
      "duration": 582,
      "threshold": 0,
      "subCheckPoints": [
        {
          "message": "Response Status\nExpected: <200>\n     Actual: was <301>",
          "type": "Fail",
          "screenshot": "../img/IQT25_61ae18f7ea70ae94a2fd4fff_API_SC_wd7gsvcac7ov25900.png",
          "duration": 0,
          "threshold": 0,
          "subCheckPoints": []
        },
        {
          "message": "Response Status",
          "type": "Fail",
          "screenshot": null,
          "duration": 0,
          "threshold": 0,
          "subCheckPoints": []
        }
      ]
    }

Solution

  • By design if there is active browser session, qaf will capture screenshot depending on the selenium.failure.screenshots and selenium.success.screenshots properties value. In your case, most probably it is because there is browser open while performing web services steps as per design screenshot attached in the report.

    However it should have same behavior for same test with qaf version 3.0.0 and 3.0.1. If you found that the same test/suite has different behavior with different versions (3.0.0 and 3.0.1) of qaf, that should be reported to qaf project issue tracker.