Hi Sunita,
On Wednesday 05 Jan 2011 08:05:04 Sunita Rani Pradhan wrote:
> Hi All
>
>
>
> I work as a automation engineer in organization and I am
> responsible for automation test cases in Perl .
>
>
>
> My parent automated test Perl script generally has 3 sets .
>
> - 1st set has pre-configurations section of test script . It is
> a separate script (called prerun, common to all test cases ) , which get
> called from parent test script .
>
> - 2nd set is coded inside parent script , which is real test
> steps .
>
> - 3rd set has clean up section (called postrun) . This is
> common to all test scripts inside one test plan tar file . Since it is
> common to all , we have put this in another common file and called that
> common file from all parent test scripts as : do $common_cleanup or
> die("$@");
>
OK, using do is usually indicative that you should use a module with "use" or
"require" instead and call subroutines from it:
http://perl-begin.org/tutorials/bad-elements/#file_includes
> 1. which will delete running jobs ,
>
> 2. check server running or not and
>
> 3. undo configuration files changes (if anything is done in any
> parent test script) . We need to skip this 3rd point for those test
> cases which does not have this configuration , else these tests will
> fail , for that I need parent test case name inside postrun . How can I
> print parent test script name inside this postrun ?
>
Well, your message is missing some text. In any case, regarding the need to
get the parent script name inside a child script, either you want to just load
code from modules and call that (which will avoid the script-running-script
anti-pattern), or alternatively you want to set an environment variable that
indicates which script is the caller (if you can't pass it as an argument).
See:
http://en.wikipedia.org/wiki/Environment_variable
>
>
>
>
> Please let me know if you do not understand this scenario .
>
I hope I did.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf
Chuck Norris can make the statement "This statement is false" a true one.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/