18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

_getDB haltonfailure process all applications

abourneabourne Members
edited November -1 in Sahi - Open Source
Hi,

I am using the _getDB to retrieve a number of test cases and loop through them and submit the records and then use asserts to verify results against know results in the database. I am using Ant to submit the script and have haltonfailure=false however if say the first record in the database fails an assert it is exiting the script and not processing the remaining records. How can I get it to mark the test as failed but still continue processing all the records

Thanks

Andrew

Comments

  • narayannarayan Administrators
    haltonfailure is a directive to ant to mark the build as a failure if there is a failed script. This does not affect the script run itself, but only the outcome as seen by ant.

    You need to wrap the code inside the loop in a try catch block. It would look something like this:
    for (loop) { 
      try {
        // your code
      } catch (e) {
         _logExceptionAsFailure(e);
      }
    }
    

    You can also use the inbuilt API _dataDrive: http://sahi.co.in/w/data-driven-testing

    Regards,
    Narayan
Sign In or Register to comment.