Forum Discussion

DavidE's avatar
DavidE
Contributor
6 years ago

Script Extension Help

We have a specific need to do some special logging around some property checkpoints.  Initially we just outlined how it was to be done, which was multiple lines in a keyword test.  Which included specific wording in the logging.

 

What we quickly discovered, is that the output was varying by team member working on our tests.  Not only that, but creating the multiple step process for each checkpoint is extremely inefficient.

 

I started looking at how I could wrap this up in a unit script, but then realized that even that was clunkier than I wanted it to be.  Then today I discovered the script extensions option.  I thought my problem was solved.

 

However, I can't seem to create a keyword test script entension that works.  Everytime I try it just crashes TestComplete.  I am sure I am doing something wrong, but can't for the life of my figure it out.  I even resorted to trying to create a basic shell that didn't really do anything but put the object into the Checkpoints category, but even that crashed it.

 

Does anyone have a simple example of a keyword test script extension that they might be willing to share as an example?  I have reviewed the tutorial and documentation, and I just can't figure out what it is that I am doing wrong.

 

Thanks!

18 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi DavidE,

     

    TestComplete uses some script extensions itself. So, you can find a ready-to-use examples  in <TestComplete>\Bin\Extensions\ScriptExtensions.

    Backup the extension file first if you want to play with it.

     

    To help you, could you please describe your task in detail? What do you want to implement? What is the current and expected behavior of the script extension?

    • DavidE's avatar
      DavidE
      Contributor

      Thank you for the reply.  Currently, there is non functionality of my script extension, because when I try to enable anything TestComplete just crashes on me.  Again, I am sure I am doing something wrong, but can't seem to determine exactly what.

       

      Let me describe what we are wanting to do as their may be a better way to do this than the path I am trying to go down.

       

      Goal:  Produce a text based log file which we can upload as an artifact into our change system that indicates that the test ran successfully.  Our change system will not allow large files or MHT extensions to be uploaded into it.

       

      I wrote a function that writes out to a text log file that we can upload as an artifact.  It functions much like the existing Log.Message function, but instead of writing into the TestComplete log, it just writes into a standard text file.

       

      We are then putting this logging function before and after a checkpoint.  Indicating that we are attempting to validate the object/property.  And then afterwards that we successfully validated the object/property.  Because the test fails on error, what we see in the log is that we are attempting to validate, but never get a success message.  This is OK, but obviously could be better.

       

      So it takes 3 steps to preform this, and the wording that each team member puts into the messages is inconsistent, therefore the output from test to test is not the same.

       

      My hope was to write a script extension that did this all in one step and the messages we write to the log file could be embedded into the extension so that they are consistent.

       

      Seemed simple enough, but I can't seem to figure out what it is I am doing wrong that is causing the script extension to crash.  I even stripped it down to a very basics setup that didn't really do anything thinking a clean slate would get me started.  I assume it has something to do with the relationship between the description.xml and the script file that I am just not getting.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Can you provide the tcx file that you created?  I'll rip it open, examine the guts, do an autopsy, add Abby Normal's brain, zip it up and add a lightning bolt... we'll get his monster to LIVE!!!

         

        Sorry... feeling a bit silly today.  But anyways, yes, upload the file and someone can take a look.

    • DavidE's avatar
      DavidE
      Contributor

      No I haven't.  I opened a ticket with SmartBear and have uploaded the crash log and the TCX file.  Waiting for a response.