4

I have a script which get vars from XML with Selblocks plugin. This script make registrations to events on a website. The XML contains the URLs of the events and the names and passwords for Users. So I have ~100 events with 100 names & passwords. There are about 8-9 steps from login to confirmation & logout.

If there any problem with the User (e.g. user has to add any extra information about him (phone number, billing address etc.)) I get an error than the Element (Next button) has not found. When I got the error the script got a failed status and stop.

I want to achieve that the script continues after that error. E.g. if my 3rd User couldn't register to event I will get only 2 executed registrations but maybe all of the another Users are good.

How can I solve this problem? How can I ensure to skip the failed registration and skip to the next var? Are there any solutions with Selblocks? Anyway is it possible?

1
  • The plugin website seems to be dead. Do you know if the Selblocks project is still alive?
    – Jagger
    Sep 21, 2020 at 12:22

1 Answer 1

1

You have to implement test cycles as you are doing data-driven testing.

I recommend to you not to expect the test will pass every time. You will have to implement checkpoints, using sequences of storeElementPresent to a variable, compare if the variable is "true" with if and store the test cycle result to the javascript array, or report results by echo-ing to the log file.

Log file then can be filtered by tail + grep Linux bash commands and some special text in echo, for example "Report: TestCycle". Add some Test-cycle name to your XML file and echoing the test result.

Additionally, some data should fail the test, and you will like to test negative cases. So you would like to add expected results of the checkpoint or whole test cycle to your XML file. Test Case is then passed, when each test cycle and/or each checkpoint finished as expected.

Please be aware, that SelBlocks have no support yet for Selenium 3 and could stop working in newer versions of Firefox. If this will change in the future, please alert me.

Reply Extended

So you SHOULD expect an error for each step and script should behave according to what really happen.

You will use following Selblocks commands:

  • forXML
  • echo
  • goto
  • storeElementPresent | variablename
  • storeElementVisible | variablename
  • gotoIf | !storedVars['variableName']
  • If | storedVars['variableName'] - endIf
  • verifyEval | storedVars['variableName'] | true

please study their syntax and usage.

Update2:

It was useful on the end of the test cycle to evaluate if the cycle was "passed" or "failed" and therefore I implemented on the end the evaluation part, where all stored variables touching the process control was evaluated, for example:

  • verifyEval | storedVars['part1Present'] | true
  • verifyEval | !storedVars['errorPart1Present'] | true
  • verifyEval | storedVars['part2Present'] | true
2
  • Thanks to the answer Dee. Maybe my question not so exact. So my problem is that I got an unexpected error (e.g: the link is dead / my password is bad / my user has not permission for the event) the script will be stopped because that couldn't find the next button. I want to handle these unexpected issues to achieve the script still running. If I have 100 users & events and I could register to some and I got an error for a few events this will be good for me. I want to achieve to all of the vars will be executed - despite the errors. Thanks, Laci
    – Laci
    Apr 26, 2017 at 12:42
  • @Laci. That's exactly you can reach with data-driven testing. You will need to make the check of element presence and visibility before each click, type etc. and if the element is not present/visible, just log an "error" to the log file or make another action by echo and skip to the end of the cycle and next set values will be executed.
    – Dee
    Apr 26, 2017 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.