Report failure if both previous tests fail, otherwise report success

Testing a simple search API with same endpoint different parameters - the first search pulls back "fast results" based on keyword search, the second search pulls back "AI results". I want to create a test that only fails if neither the "fast search" or the "AI search" returned the correct link (href) as the first link in the response. I created the first test which fails if the first href in the response is not the correct url - called "Fast Search". Similarly, I created the second test called "AI Search". How do I create a third test that fails if both Fast Search and AI Search fail?
Answers
-
How do I create a third test that fails if both Fast Search and AI Search fail?
You can configure tests to execute conditionally based on the pass/fail status of previous tests. So, you could add a third test that only executes and fails if the first two fail. See Test-Specific Logic Options.
What type of test you create is up to you. It could be an Extension tool with a simple script:
void fail(def input, def context) { context.report("Fast Search and AI Search failed!") }
0 -
Otherwise, you can always use data banks to extract the "hrefs" and make your third test compare them again. You can also access data bank columns from scripts using
context.getValue("Generated Data Source", "columnName")
.I would recommend you post your question to Parasoft IDA (the AI chatbot in the corner of this page). It happens to provide a bit of step-by-step detail to doing it this other way.
0