On Mon, Dec 1, 2008 at 3:13 PM, Sharon Lucas <[EMAIL PROTECTED]> wrote:
>
> Importing a Jython module and running it via a <script> element runs it
> within the same Jython interpreter as the STAX job. You can have your
> Jython script return whatever you want (e.g. return 'pass' or return 'Failed
> with xxx'. So that it could return an indication of the test status which
> you can assign to a variable such as "testOutput" and then check it to
> determine if the test passed or failed. For example:
>
> <testcase name="'Test1'">
> <sequence>
>
> <script>
> testOutput = FreqAndLevelTest()
> </script>
>
> <if expr="testOutput == 'Success'">
> <tcstatus result="'pass'"/>
> <else>
> <tcstatus result="'fail'">testOutput</tcstatus>
> </else>
> </if>
>
> </sequence>
> </testcase>
>
> If you really neededto use a <process> element instead to run your test,
> perhaps because you need to run the program on a remote machine, you could
> do this instead as I'll talk about next.
>
> Is there a reason why you're using Jython to call the java programs that
> test your APIs instead of just running a Java program (or programs) directly
> to test your APIs via a <process> element? For example:
>
> <process>
> <location>'local'</process>
> <command mode="'shell'">'java Test'</command>
> <stderr mode="'stdout'"/>
> <returnstdout/>
> </process>
>
> If there is a good reason why you're using Jython instead of Java directly,
> you could run a Jython script via a <process> element on a machine if Jython
> is installed and accessible in the path, or you can fully qualify the path
> to the jython executable, on the machine where the process is run. Also,
> your Jython script must provide a main() function and check if the __main__
> top level module is called and have it call the main() function in order to
> handle being run as a program. To run a particular function in your Jython
> script, you would need to modify your Jython script to accept a argument by
> having it's main() function check the argument(s) passed in. See Python
> documentation such as
> http://www.artima.com/weblogs/viewpost.jsp?thread=4829 for more
> information on the main() function and on passing arguments to it. You
> don't import the Jython module in this case as you are running the Jython
> script in a separate program. Here's an example of running a Jython script
> via a <process> element:
>
> <process>
> <location>'local'</process>
> <command mode="'shell'">'jython C:/tests/test1.py'</command>
> <stderr mode="'stdout'"/>
> <returnstdout/>
> </process>
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin, [EMAIL PROTECTED]
> (512) 286-7313 or Tieline 363-7313
>
Sharon,
The whole purpose of using Java is to load the dll and access its exported
APIs which at the moment Jython is unable to do because of the absence of
Ctypes modules in it. The ctypes is planned on its roadmap and is expected
to be out in a period of four to five months.
Had ctypes been available this time then also all the Tests had to be
written in Jython. With the idea of keeping the tests unchanged, I thought
of calling the dlls and its associated APIs from Java. This way my Tests
would need quite a less number of changes (to adapt them to using cytpes
when it is available) as opposed to writing them now purely in Java ( as you
pointed out) and then changing them to entirely in Jython (when ctypes is
available).
I have had a look at STAX User guides and Training manuals, but they all do
not deal with the real world test cases. Could you please direct me to some
useful sites where I can actaully see the Stax jobs, how they use Jython,
and how different people do different test setups. I think this would give
me more clarity and enable me to use the STAF/STAX to the fullest ( as we
are naive users and starting to implememt it on our organization).
I will work on your above post and will disturb you :o) again if in case I
have more to ask you on this.
Many thanks,
Cheers,
Rajat
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users