[ptt-users] distinguishing environment in which script is being
run...
Frank Cohen
fcohen at pushtotest.com
Thu Sep 13 07:29:59 PDT 2007
Hi Dominique: There is likely an API to determine the operating
environment at runtime. But I don't remember it.
TestMaker had various methods you could call to find the path to the
running script file and the status of the TestMaker console. These no
longer exist.
Perhaps we should add an object that the test script can call:
/*
* TestEngine is a singleton to provide information to running tests
*
*/
package com.pushtotest.testmaker;
public interface TestEngine {
/**
* Returns the singleton TestEngine object
*/
public TestEngine getTestEngine();
/**
* Returns true if this TestEngine is running on a TestNode
*/
public boolean isTestNode();
/**
* Returns true if this TestEngine is running in the TestMaker
console
*/
public boolean isConsole();
}
What do you think?
-Frank
On Sep 13, 2007, at 5:23 AM, Dominique de Waleffe wrote:
> I am writiung jython test scripts.
>
> When they are run as functional/load test, some method is called by
> the runner. Ok.
>
> When trying out those scripts under testmaker by using the [Agent]>
> [Run Script Locally] menu, I have no way to specify which method/
> call to execute. The file gets loaded and whatever code is runnable
> is being run.
>
> The problem is that if I put test code there, it will also be run
> when the script is loaded onto a testnode, which is not what I want...
>
> example:
> -----------
> class MyTest():
> def setUP():
> pass:
> def test():
> pass
> def tearDown():
> pass
>
> #testing the test...
> t=MyTest()
> t.setUp()
> for i in [1,2,3]:
> t.test()
> t.tearDown()
> ------------
>
> So is there a check I can do to determine whether the code is
> loaded as testnode code or via[Agent]>[Run Script Locally]?
> so that I can use an trick like if __main__=="main": to either
> allow/prevent execution of this bit of code?
>
> Thanks,
> D.
>
> --
> Dominique de Waleffe
> Technical director
>
> Denali S.A., "Bridging the gap between Business and IT"
> Rue de Clairvaux 8, B-1348 Louvain-la-Neuve, Belgium
> Office: +32 10 43 99 51 Fax: +32 10 43 99 52
> http://www.denali.be
>
>
> Legal notice: this message and its attachments may contain
> confidential and/or privileged information. If you are not the
> addressee or authorized to receive this for the addressee, you must
> not use, copy, disclose or take any action based on this message or
> any information herein. If you have received this message by mistake,
> please advise the sender immediately by return e-mail and delete this
> message from your system. Thank you for your cooperation.
> _______________________________________________
> Users mailing list
> Users at lists.pushtotest.com
> http://lists.pushtotest.com/mailman/listinfo/users
>
--
Frank Cohen, PushToTest, http://www.PushToTest.com, phone 408 374 7426
TestMaker: The open-source SOA test automation tool
More information about the Users
mailing list