As talked about in section "process: Run a process" in the STAX User's 
Guide at 
http://staf.sourceforge.net/current/STAX/staxug.html#Header_Process, after 
a <process> has completed (or if it could not be started) the following 
variables are set and can be referenced by the job: 
RC - the return code from the process. It is numeric. If it's the actual 
return code from the process, it is a Python Long numeric type (e.g. 0L, 
25L). If an error occurred starting the process, it is a Python Integer 
numeric type.
STAFResult - the STAF result from starting the process. If the process 
failed to start successfully, it contains any error messages from starting 
the process in a Python string type. If the process started successfully, 
it is set to special Python object None.
STAXResult - contains any files specified by returnstdout, returnstderr, 
and/or returnfile(s) 

So, if you have a <process>, it sets these three variables.  If you then 
run another process, it will again set these three variables (so the 
previous values are overwritten).  If you don't want to check the RC 
immediately after a <process> for some reason, then you can save the 
process's RC (and STAFResult and STAXResult if desired), e.g. saveRC = RC. 
 Note that in addition to the <process> element setting RC, other elements 
such as <stafcmd>, <job>, or <timer> also set RC, so if you don't check 
the RC variable immediately following the element, then the value of RC 
may have been changed by these elements.

I made some changes in blue in your examples to show how you could save 
the RC and STAFResult from the first process, run another process, and 
then check the RC of the first process.  Or, you could check the RC 
immediately after the <process> (e.g. before running another <process>, 
<stafcmd>, etc).

  <if expr="TestComponent == 'Fitnesse'">
    <sequence>
      <!--pname2 = '"SecurityTemplates?suite"'-->
      <script>
        jarName = 'C:\\Fitnesse\\fitnesse-standalone.jar'
        cmd = 'java'
        param1 = ' -jar '
        pname1 = " -c "
 
        var1 = '?test'
        pname2 = TestDriverName + var1
        myworkdir = 'C:\\Fitnesse'
        pname3 = ' -b "C:\FitnesseResults.html"'
        pname4 = ' -p 8080'
      </script>

     <log message="1">'%s %s %s %s %s %s %s' % (cmd, param1, jarName, 
pname4, pname1,pname2,pname3)</log>
     <process>
       <location>machine</location>
       <command mode="'shell'">
         '%s %s %s %s %s %s %s' % (cmd, param1, jarName, pname4, pname1, 
pname2, pname3)
       </command>
       <workdir>myworkdir</workdir>
     </process>
     <script>
       # Save the process's RC and result to check later
       tcRC = RC
       tcResult = STAFResult
     </script>
 
     <script>
       SendResult ='C:\\Automation_STAF\\Dependacies\\ParseResults.exe'
       newworkdir ='C:\\Automation_STAF\\Dependacies'
     </script>
     <process>
       <location>machine</location>
       <command mode="'shell'">'%s %s' % 
(SendResult,TestDriverName)</command>
       <workdir>newworkdir</workdir>
     </process>
   </sequence>
 </if>
 
 <if expr="tcRC == 0">
   <sequence>
     <log message="1">tcRC</log>
     <tcstatus result="'pass'"/>
     <script>val = 'Passed'</script>
     <call function="'RunTestsInQC'">TCID,val</call>
     <call function="'Etrack'">TCID,TestDriverName,"PASS"</call>
   </sequence>
   <else>
     <sequence>
       <log message="1">tcRC</log>
       <!--<tcstatus result="'fail'">'RC=%s ' % (tcRC)</tcstatus>-->
       <call function="'RunTestsInQC'">TCID,"Failed"</call>
       <call function="'Etrack'">TCID,TestDriverName,"FAIL"</call>
     </sequence>
   </else>
 </if>

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   Sandeep Bhosale <sandeep.bhos...@gmail.com>
To:     staf-users@lists.sourceforge.net, 
Date:   10/18/2013 06:22 AM
Subject:        [staf-users] Difficulty in Identifying RC Code



Hi all,

I have my framework defined in STAF/STAX. I am using the STAF/STAX to run
the fitness test cases in parallel. In the fitness test case I am using 
the
SEND message method to send the test case result back to STAF. And 
depending
on RC I am marking the test case PASS/FAIL in QC and changing he defect
status in ETRACK. 

Here I have written below functions. Here I am able to run the test cases 
on
remote machine. I have used process element to run test cases on remote
machine. But the issue is when the test case is PASS/FAIL i am getting the
RC two times. One is if the test case is launched on remote machine then I
am getting RC code as 0 and second is from my test case I am sending the
message PASS/FAIL. Now the issue is when the test case is failed I am
getting the RC code is 0(coz the test case is launched successfully.) and
then 1 (From the the test case result where  I have used to send the Fail
message to the STAF).

Here I want the RC code which is returned from my test case(PASS/FAIL). 
How
can I suppress the process element RC code and get the actual test case
code. My functions are written as below (Fitnesse is my function name)

  <if expr="TestComponent == 'Fitnesse'">
          <sequence>
            <!--pname2 = '"SecurityTemplates?suite"'-->
            <script>
              jarName = 'C:\\\Fitnesse\\fitnesse-standalone.jar'
              cmd = 'java'
              param1 = ' -jar '
              pname1 = " -c "
 
              var1 = '?test'
              pname2 = TestDriverName + var1
             myworkdir = 'C:\\\Fitnesse'
              pname3 = ' -b "C:\FitnesseResults.html"'
              pname4 = ' -p 8080'
            </script>

            <log message="1">'%s %s %s %s %s %s %s' % (cmd, param1, 
jarName,
pname4, pname1,pname2,pname3)</log>
            <process>
              <location>machine</location>
              <command mode="'shell'">'%s %s %s %s %s %s %s' % (cmd, 
param1,
jarName, pname4, pname1,pname2,pname3)</command>
              <workdir>myworkdir</workdir>
            </process>
            <script>
              SendResult 
='C:\\Automation_STAF\\Dependacies\\ParseResults.exe'
              newworkdir ='C:\\Automation_STAF\\Dependacies'
            </script>
            <process>
              <location>machine</location>
              <command mode="'shell'">'%s %s' %
(SendResult,TestDriverName)</command>
              <workdir>newworkdir</workdir>
            </process>
          </sequence>
        </if>
 
        <if expr="RC == 0">
 
          <sequence>
            <log message="1">RC</log>
            <tcstatus result="'pass'"/>
            <script>val = 'Passed'</script>
            <call function="'RunTestsInQC'">TCID,val</call>
            <call function="'Etrack'">TCID,TestDriverName,"PASS"</call>
          </sequence>
        </if>

        <if expr="RC != 0">
 
          <sequence>
            <log message="1">RC</log>
            <!--<tcstatus result="'fail'">'RC=%s ' % (RC)</tcstatus>-->
            <call function="'RunTestsInQC'">TCID,"Failed"</call>
            <call function="'Etrack'">TCID,TestDriverName,"FAIL"</call>
          </sequence>
        </if>


In the If statement I am checking the RC code returning from the test 
cases.
But here I am getting the RC value 2 times. One from the process element 
and
second from the test case. How can I check the value from test case only?

Thanks in advance.



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most 
from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk

_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to