I’m using BDD template for desktop applications automation. When the test case will be failed. Suppose a button is not present,but I want to click that button.
Scenario: specific button is present or not. If is is not present in the app then the test case should failed in test explorer
If I’m understanding you correctly, you want to verify whether a button is present. If it’s present, you want the test case to succeed. If it’s not present, you want the test case to fail.
You could use the Check App State activity for this and wait for the button to appear and then simply add a Verify Expression activity in each of the two branches of the Check App State activity. With Expression True in the “Target appears” branch and False in the “Target does not appear” branch.
If the button doesn’t appear, the right branch is chosen, where the Verify Expression returns false, and thus the test case fails in test explorer (or anywhere else you would run it - e.g. in Test Manager or Orchestrator)
I want to check whether the element is enabled Or disabled. So, I have used check element activity. How to do if an element is enabled then the test case should pass else the test case should be failed in test explorer.
If my button is In enabled mode my test case should pass in test explorer,otherwise it should get failed. That is the test case. Check element i have used.
If my button is In enabled mode my test case should pass in test explorer,otherwise it should get failed. That is the test case. Check element i have used. Check element activity returns true or false and stores in variable
In the Verify Expression activity you can include any expression. That means that you can add True or False there (like in the example above in this thread), and it also means that you can include any variable or more complex expression there that can be evaluated to either True or False.
So long story short: You can just use the Result variable from the Check Element activity in the Verify Expression activity.