Solution: -
For running the multiple tests with same browser instance through Sahi,
you can use _include(\"relative path of another Sahi script\") function;
For example:
consider the below sahi scripts,
script1.sah
_navigateTo(\"
sahi.co.in/demo/training/\");
_setValue(_textbox(\"user\"),\"test\");
_setValue(_password(\"password\"),\"secret\");
_click(_submit(\"Login\"));
_assertExists(_button(\"Add\"));
script2.sah
_setValue(_textbox(\"q\"),\"1\");
_setValue(_textbox(\"q[1]\"),\"2\");
_setValue(_textbox(\"q[2]\"),\"3\");
_click(_button(\"Add\"));
_assertExists(_textbox(\"total\"));
_assertEqual(_textbox(\"total\").value,\"1750\");
If both these scripts are configured with the same instance in Editor, then the final script should be
_navigateTo(\"
sahi.co.in/demo/training/\");
_setValue(_textbox(\"user\"),\"test\");
_setValue(_password(\"password\"),\"secret\");
_click(_submit(\"Login\"));
_assertExists(_button(\"Add\"));
_include(\"script2.sah\");
(or)
_include(\"script1.sah\");
_setValue(_textbox(\"q\"),\"1\");
_setValue(_textbox(\"q[1]\"),\"2\");
_setValue(_textbox(\"q[2]\"),\"3\");
_click(_button(\"Add\"));
_assertExists(_textbox(\"total\"));
_assertEqual(_textbox(\"total\").value,\"1750\");
(or)
_include(\"script1.sah\");
_include(\"script2.sah\");
and also have a look at the attached report of this sequential run.
We are planning to implement the custom logging functionality in tm6 reports using _log(\"log it\") function as,
_include(\"script1.sah\");
_log(\"script 1 is done and script2 is going to start\");
_include(\"script2.sah\");
So that the user can differentiate the reports of script1 & script2.
Also, Is there any requirements for conditional includes?
If there are scripts s1,s2,s3,s4 and its all running sequential, depending on the output of s2, we can decide the scripts should take below paths,
s1->s2->s3 or
s1->s2->s4