18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
errors and failures - how can i find out if i had failures?
Hi,
when i write testscripts like this
Failures in _assert-Statements do not throw exceptions, only errors do. Now, unfortunately my function reportresult is called with "ok" although the page content was not like expected and therefore wrong.
I found something with sahi_has_errors and gotErrors, but i have no idea how to use it. Can anybody give me a hint how i can access the failure counter?
Gerhard
update: the testscript does see the _sahi object, but _sahi.hadErrors() is undefined.
Also _sahi.getServerVar() is known during the test, but _sahi.getServerVar('sahi_has_errors') retunes undefined.
when i write testscripts like this
try {
... login as userxy
_assertContainsText(/hello mister userxy/, _spandiv("content"));
_click(_link("logout"));
...
reportresult('ok');
} catch(e) {
reportresult('failed');
}
then i reach the exception handler only if the div "content" does not exist, which is considered an error. If there is just the wrong text in it, it is considered a failure. This is my understanding, please correct me if i'm wrong.Failures in _assert-Statements do not throw exceptions, only errors do. Now, unfortunately my function reportresult is called with "ok" although the page content was not like expected and therefore wrong.
I found something with sahi_has_errors and gotErrors, but i have no idea how to use it. Can anybody give me a hint how i can access the failure counter?
Gerhard
update: the testscript does see the _sahi object, but _sahi.hadErrors() is undefined.
Also _sahi.getServerVar() is known during the test, but _sahi.getServerVar('sahi_has_errors') retunes undefined.
Comments
should work. I will add this to the Sahi APIs as _hasErrors()
Gerhard