Forum Discussion

clay's avatar
clay
Contributor
8 years ago

Exporting checkpoint test results?

I am looking for a way to export checkpoint results from a test suite run into tabular form - something like a CSV or Excel spreadsheet.  Is there a quick and easy way to do this?

  • clay's avatar
    clay
    8 years ago

    Thank you, Robert.  As always, your responses are thoughtful and clear.

     

    I have too large of a legacy of KWT's to be modified for you suggestion to be practical for our situation (if I had only thought about this more in the beginning...).

     

    I am looking to go in a different direction - looking at the OnLogCheckpoint and OnLogError events.  It looks like I need both (one for "pass" and one for "fail" checkpoint results.  The code will notionally look something like this...

     

    function GeneralEvents_OnLogCheckpoint(Sender, LogParams)

    {

            KWT = ParseForKeywordTestname(Project.TestItems.Current.ElementToBeRun.Caption);

            Checkpoint = ParseForCheckpointName(LogParams.MessageText); 

            Result = "Pass";

            TimeStamp = GetNow();

            PrintToReport(KWT, CheckPoint, Result, TimeStamp);

    }

     

    function GeneralEvents_OnLogError(Sender, LogParams)

    {

            if (ParseForErrorType(LogParams.MessageText) == CHECKPOINT_TYPE)

            {

                    KWT = ParseForKeywordTestname(Project.TestItems.Current.ElementToBeRun.Caption);

                    Checkpoint = ParseForCheckpointName(LogParams.MessageText); 

                    Result = "Fail";

                    TimeStamp = GetNow();

                    PrintToReport(KWT, CheckPoint, Result, TimeStamp);

            }

    }

     

    I am sure it will need quite a bit of tweaking, but I think I have a path forward now :-)

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    There's nothing natively built in to TestComplete to do that, no.  You'll have to build a method to add rows to a CSV or Spreadsheet after executing your checkpoints.

    • clay's avatar
      clay
      Contributor

      That does not surprise me.  Where can I look to find resources to develop such a method?  Is there an API for TestComplete that I missed in the documentation somewhere?

       

      Thanks.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        You're probably looking for this:

        https://support.smartbear.com/testcomplete/docs/reference/project-objects/project/project/logs.html

         

        However, what I was suggesting was something a bit more real-time than that.  That method requires that you auto-save your logs every so many minutes during a test run and then run the method that you right at the very end of the test run.  You then need to parse through the log items to find what you're looking for and then dump them out.

         

        Instead, what I would suggest is build a wrapper around your checkpoints that you use when you create your checkpoint code.  It might look something like the following pseudocode.

         

        function checkpointCustom() {
            //execute the checkpoint
           if (checkpoint == passed) {
               writetofile('check point passed')
        }
        else {
             writetofile('checkpoint failed')
        }
        }

        That way you have control over the write out to the file right away without needing to parse through the log objects to find the specific information you want.