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.

JSERROR not highlighted in log file if _include() is used

PopeyePopeye Members
edited November -1 in Sahi - Open Source
The following example works es expected, i.e. JSERROR is highlighted in the log file:
_include("dummyVar.sah");
_log($undefined);

where dummyVar.sah contains:

var $dummy = "dummy";

But JSERROR is not highlighted when I invoke this
_include("dummyFunction.sah");
_log($undefined);

where dummyFunction.sah contains:

function dummy(){
_log("dummy");
}


It would be very helpful if the error is also highlighted in this case

I'am using Sahi V3 Release 2009-10-23

Comments

  • Hi Narayan,

    I observe the same behaviour in Sahi V3 Release 2009-11-30.

    The new tooltips work fine for successful and failed steps but it is still hard to fined JSERROR in included functions. If that case the tooltip shows the line number of the parsed script. But when I do 'View Parsed Script' from the controller the line number containing the error is far away from the number the tooltip is showing. For example the tooltip showed me n=2997 instead of 2871.

    However, I'm still a big fan of Sahi. It helps a lot to improve the quality of our web applications. Have found a couple of (small) errors in the last couple of weeks.

    BTW:
    apis.sahi of Sahi V3 Release 2009-11-30 does not contain the new function _clloseWindow()
  • narayannarayan Administrators
    Popeye, the line in the parsed script should be the one in the logs. I will check why it is not. Are you sure the script was not modified in between?
    We are working on getting the real line number, and will update you on progress.

    Thanks for pointing out _closeWindow.

    Thanks,
    Narayan
  • Hi Narayan,
    I have found the reason why the line number of the tooltip and the parsed script is different.
    When I execute the script below
    var $DataLoad = getTestData("../scripts/MySamples/TestData.xml", "<DataLoad");

    function getTestData($file, $root)
    {
    var $fileAsString = _readFile($file);
    // the string used to create the XML node must begin with the root node
    // our existing test data files have <?xml version="1.0" encoding="UTF-8"?> at the beginning
    var $i = $fileAsString.indexOf($root);
    var $len = $fileAsString.length;
    var $dataAsString = $fileAsString.substring($i, $len);
    return new XML($dataAsString);
    }

    the parsed script looks as follows:
    var $DataLoad = getDataLoad("../scripts/MySamples/TestData.xml", "
    That means all lines after '<' are not visible. I changed it to:
    var $DataLoad = getTestData("../scripts/MySamples/TestData.xml", "DataLoad");

    function getTestData($file, $root)
    {
    var $fileAsString = _readFile($file);
    // the string used to create the XML node must begin with the root node
    // our existing test data files have <?xml version="1.0" encoding="UTF-8"?> at the beginning
    var $i = $fileAsString.indexOf("<"+$root);
    var $len = $fileAsString.length;
    var $dataAsString = $fileAsString.substring($i, $len);
    return new XML($dataAsString);
    }
    With this little change the parsed scrips match with the executed scripts and also tooltips line numbers macth with the line number of the parsed scripts.
Sign In or Register to comment.