Site MapAccessibilityContact Us

Call us at (855) 254-1164 to learn more about Enterprise

PushToTest - Open Source Test

Welcome, Guest
Please Login or Register.    Lost Password?
With the new features planned for TestMaker IDE, test authoring of Rich Internet Applications (RIA using Ajax, Flex, Flash) becomes a whole lot easier.
Go to bottomPage: 1
TOPIC: Multi File Sahi Test
#375
Multi File Sahi Test 2 Years, 2 Months ago Karma: 0
Sahi API does not allow to run multiple scripts in the same browser/session.

Currently sahi API is simple and straight forward
TestRunner tr = new TestRunner(script, browser, url,
\"localhost\", \"9999\", \"1\");
tr.setInitJS(newmap);
tr.addReport(new Report(\"tm6\", path.getAbsolutePath()));
results = tr.execute();

So you set the script and execute it, really clean, yet it is not enough, because in TestMaker we can link scripts using the entity tag:

<test>
<run name=\"Open\" method=\"firefox\" langtype=\"sahi\" resource=\"open.sah\" instance=\"abc\"/>
<run name=\"Loggin\" method=\"firefox\" langtype=\"sahi\" resource=\"login.sah\" instance=\"abc\" />
</test>
priya
Admin
Posts: 58
graphgraph
User Offline Click here to see the profile of this user
The topic has been locked.
 
#379
Re: Multi File Sahi Test 2 Years, 2 Months ago Karma: 0
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
panipri
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
The topic has been locked.
 
#381
Re: Multi File Sahi Test 2 Years, 2 Months ago Karma: 0
Comments from the TestMaker Engineer on the above solution:


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\");

Generates this

<report>
...
<step name=\"script 1 is done and script2 is going to start\" />
....
</report>


That will be fine. Remember we need to have some information in the report, because that is the file we parse to get the results into TestMaker.

Another important thing I overlooked yesterday is the in between steps. In TestMaker you can do things like this


<test>
<run name=\"Open\" method=\"firefox\" langtype=\"sahi\" resource=\"open.sah\" instance=\"abc\"/>
<run name=\"Another Thing\" method=\"doSomething\" langtype=\"java\" />

<run name=\"Loggin\" method=\"firefox\" langtype=\"sahi\" resource=\"login.sah\" instance=\"abc\" />
</test>

So you first run Sahi, then Java, then Sahi again, with your proposal of _include(), both of sahi steps will be run first, then the java. The results will be as expected, first Sahi test, java Test, then second sahi Test, yet the execution will be First Sahi Test, Second Sahi Test, Java Test. This is because _include will run entire Sahi Tests at the beginning.

This won\'t be a problem with sequential sahi test, but it will surely will with non-sequential sahi test.

Finally, another issue is the second, third, fourth (an so on) scripts won\'t use their own DPLs, all the test will use the DPL defined (if any) in the first Sahi test.
This is because TestMaker will only execute only one TestRunner execution.

This issues doesn\'t exists in Selenium RC, because in selenium RC, you have a session (open browser), and you can execute test in that session until you finish it.

Another approach will be like in Selenium RC, being able to execute more that one script in the TestRunner, like

TestRunner tr = new TestRunner( browser, url,

\"localhost\", \"9999\", \"1\");
tr.setInitJS(newmap);
tr.addReport(new Report(\"tm6\", path.getAbsolutePath()));
results = tr.execute(script1);
results = tr.execute(script2);
results = tr.execute(script3);
tr.finalize()

So we will create the test runner at the beginning and will execute the scripts when it is required.

Is this possible?
priya
Admin
Posts: 58
graphgraph
User Offline Click here to see the profile of this user
The topic has been locked.
 
Go to topPage: 1