Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Specific test if fails should not produce a failure in report

Options
yiannis
yiannis Posts: 8

This is a bit tricky to explain in only one sentence in the title.
I want to create a test block that I want to re-use throughout my regression tests.
This block will be the login scenario (for start)

So my actions are:
1. Check if logged in
2. If not do login
3. Check if logged in

I have done this using the Test flow logic and it's working.

But the actual issue is that the first check will report a failure and I don't want this.

  • The first "Assert Logout button is visible" should fail if not logged in, but should not be included in the report.
  • The second "Assert Logout button is visible" if fails should be reported.

Thanks in advance for any help

Comments

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    If I understand your scenario correctly, "Test Suite: Do Login" runs if "Test Suite: Account user is logged in" fails. In order to accomplish the same thing without the scenario failing, I would make the following changes:
    1. Update "Test 1: Assert Logout button is visible" to store a value to a test variable, and make it so the test always succeeds regardless of whether logged in or not.
    2. Update the test suite logic so that "Test Suite: Do Login" runs based on the value in the test variable, instead of based on test failure.

  • yiannis
    yiannis Posts: 8
    Options

    I created a test step with action "Wait" so that this will not produce any failure.
    Then I added a "Browser Data Bank" output action to extract the value of the element (text or any other property).
    Though if the element is not present in the DOM, this creates a failure that it's not found.

    How can I check:
    If an element exists in DOM -> then update a variable?

    • maybe from 0 to 1
    • or false -> true

    Thank you in advance for any help

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    Ok, so Browser Data Banks fail when the element is not found. However, XML Data Banks do not. I don't have time to give all details of a full solution, but here is what might work:

    Add an Extension Tool to the Browser Contents output of the Browser Testing Tool. Create a method that takes as input the BrowserContentsInput object (you can see JavaDocs by going to Help > Help Contents > Parasoft SOAtest Extensibility API). Use the API to grab the HTML from that object and return it from the Extension Tool. Then attach an XML Data Bank to the Extension Tool to find the element that you want to find. If it finds it, it will extract the value. If it does not, it will silently pass.