No, there isn't a STAX variable which traces the number of passed or
failed test cases. The STAX Monitor (when monitoring a STAX job that's
already been started) gets testcase information like the # passed/failed
test cases by submitting a "STAX LIST JOB <Job ID> TESTCASES" request (the
job id of the current STAX job is provided in variable STAXJobID) and then
adds together the numPasses and numFails for each testcase provided in the
list result from this request. You can submit this request via a STAX job
using the <stafcmd> element and then iterate through the list,
accumulating the numPasses and numFails for each testcase to get the total
number of passes and fails. For more information on the "STAX LIST JOB
<JobID> TESTCASES" request and its result, see sub-section "LIST" in
section "Request Syntax" in the STAX User's Guide at
http://staf.sourceforge.net/current/STAX/staxug.html#Header_List.
Note that STAX provides a function named STAXUtilQueryAllTests in the
libraries/STAXUtil.xml file that queries the results for all testcases in
the currently running job, accumulating the total number of testcases,
passes, and fails recorded so far as well as providing a map of all the
testcases and their passes, fails, elapsed times, and number of starts.
So, you can simply import the STAXUtilQueryAllTests function from the
STAXUtil.xml file and call it to get the total number of testcase passes
and fails instead of writing a function yourself that does the same thing.
The STAXUtil.xml file is in the libraries subdirectory when you extract
the STAXVxxx.tar or .jar file that you can download from the "Download
STAX Service" web page at http://staf.sourceforge.net/getstax.php. The
STAX User's Guide, "Appendix A: STAX XML Document Examples", section "STAX
Libraries Containing Common Utility Functions", sub-section "STAX Utility
Functions" at
http://staf.sourceforge.net/current/STAX/staxug.html#Header_STAXUtil gives
an overview of each function provided in the STAXUtil.xml file. See
http://staf.sourceforge.net/current/STAXLibraries/index.html (accessible
via the "Download STAX Service" web page at
http://staf.sourceforge.net/getstax.php when you click on "STAX V3 Library
Function Definitions for STAFUpgradeUtil and STAXUtil") for detailed
documentation on this function and other functions provided in the
STAXUtil.xml file. It says:
STAXUtilQueryAllTests
Query the results for all testcases in the currently running job,
accumulating the total number of testcases, passes, and fails recorded so
far as well as a map of all the testcases and their passes, fails, elapsed
time, and number of starts.
This function does not allow any arguments
Returns:
Returns the following in a list:
Return code (0 if successful; if not successful, set to the return code
from the STAX LIST TESTCASES request or 1 if an error occurs parsing the
results from the LIST request),
Result (blank if the query is successful; otherwise, it contains
information about the error),
List containing the total number of testcases, the total number of passes,
and the total number of fails (an empty list if fails),
Testcase results map containing an entry for each testcase (an empty map
if fails). The map's key is testcase name and its value is a list of the
number of passes, number of fails, elapsed time, and number of starts.
For example, if the query of testcase results was successful and there
were 2 testcases, TestA and TestB, where Test A had 4 passes, 1 fail, ran
for 5 minutes and 23 seconds, and was started once and Test B had 1 pass,
0 fails, ran for 26 hours 5 minutes and 45 seconds and was started 5
times, and "Log TC Elapsed Time" and "Log TC Num Starts" are enabled for
the job, the following would be returned:
[0, '', [2, 5, 1], {'TestA': [4, 1, '00:05:23', 1], 'TestB': [1, 0,
'26:05:45', 5]}]
If the LIST TESTCASES request failed, the following could be returned if a
Python exception occurred while parsing the result:
[1, 'Error while processing result from STAX LIST TESTCASES JOB 5 ...',
[], {}]
Example:
Here's an example that queries the results of all testcases run so far in
the current job. If the query is successful, it checks if there have been
any testcase failures logged so far. If so, it logs a message and sends it
to the STAX Monitor. If the query fails, it logs a failure message and
sends it to the STAX Monitor.
<call function="'STAXUtilQueryAllTests'"/>
<script>[rc, result, totals, testcases] = STAXResult</script>
<if expr="rc == 0">
<sequence>
<script>[totalTests, totalPasses, totalFails] = totals</script>
<if expr="totalFails > 0">
<call function="'STAXUtilLogAndMsg'">
'Total Testcases: %s, Total Passes: %s, Total Fails:
%s\nTestcases: %s' % \
(totalTests, totalPasses, totalFails, testcases)
</call>
</if>
</sequence>
<else>
<call function="'STAXUtilLogAndMsg'">
'STAXUtilQueryAllTests failed. RC=%s Result=%s' % (rc, result)
</call>
</else>
</if>
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Luca Robusto <lucarobu...@gmail.com>
To: "staf-users@lists.sourceforge.net"
<staf-users@lists.sourceforge.net>,
Date: 07/08/2013 04:52 AM
Subject: [staf-users] Number of Passes and Failed TC
Is there a variable which traces number of passes or failed testcases, so
as we see them on the Stax Monitor, or I have to implement my own one?
Luca.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users