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.

Why custom functions can't be used directly in assert?

jkronegg2jkronegg2 Members
edited February 2014 in Sahi - Open Source
I'm doing the following in a Sahi test script but it fails when calling a custom function:
function myFunction() {
    return 10;
}

_assertTrue(myFunction()>0); // fails with error "myFunction is undefined"

But when I'm using an intermediate variable, it works:
var $myVar = myFunction();
_assertTrue($myVar>0); // works as expected

From my point of view, this is neither practical nor intuitive.

Is it the way Sahi is designed or is there a special way to define and call user functions ?

Answers

Sign In or Register to comment.