Forum Discussion

shubhangi's avatar
shubhangi
Contributor
13 years ago

Pass/Fail status of a job

Hi,



Is there a way to find if a job is passed or failed.

I am running tests in distributed environment.



Last function in the master project sends logs via email.

I want to list the number of jobs/tests passed/failed in the mail.



Regards,

Shubhangi

  • Hi Shubhangi,





    In root.xml, you can find something like this:





    <LogData name="Script Test Log [Unit1\Main]" id="{8FBBB434-6843-4D09-B373-5FE2FA6BDE59}" status="0">...</LogData>





    By analyzing the value of the status attribute, you can find out whether a test run was successful:





    0: the test run was successful;

    1: there were warnings;

    2: the test failed.


  • Anonymous's avatar
    Anonymous

    Hi Shubhangi,



    You can accomplish your task by using one of the following approaches:



    1. You can parse the test log from script. At the end of the test, you need to export your test results to the XML format by using the Log.SaveResultsAs method. To learn more about this method, please see the "Log.SaveResultsAs" article. After that, you need to parse the generated XML file to get necessary information. The "Exported Results Structure" article contains information about the structure of exported logs. 



    2. You can write a script and add event handlers to TestComplete master and slave projects.



    In the master project, you need to do the following:

       - add a new Network Suite Persistent variable to the project. See the "Network Creating Network Suite Variables" help topic to learn how to do this. This variable will be modified in a slave project each time when errors are posted to the test log on a slave machine. If  the value of the variable differs from the initial one at the end of the test, it means that the executed job finished with errors. Actually, this variable indicates whether a job failed or not.

       - the value of the variable should be checked in the OnNetJobStateChange event handler when the status of the job is equal to ns_Stopping. Please read the "Creating Event Handlers - General Procedure" and "OnNetJobStateChange Event" articles to learn more about the event and how to create event handlers in TestComplete.



    In slave projects, you need to do the following:

      - you need to change the Network Suite variable's value after an error was posted to the log. A new value should be assign in the OnLogError event handler. Please read the "OnLogError Event" and "Creating an Event Handler for the OnLogError Event" articles for details.



    I hope this helps.
  • Hi Tanya,

    Thanks for the ideas.

    I will try to investigate and use one of them.



    Regards,

    Shubhangi








  • Hi Tanya,



    I looked at the root.xml after exportig it.

    It has got <LogData> nodes for every testcase.

    Dose status attribute give the Pass/Fail result ?



    Regards,

    Shubhangi


  • Anonymous's avatar
    Anonymous

    Hi Shubhangi,



    Please see our answer to your question in that forum thread.
  • Can I get the test item name or script name of the failed scripts?

    or a list of all the failed scripts?



    Thanks

    Pankaj Kukkar