cancel
Showing results for 
Search instead for 
Did you mean: 

Script Extension Help

Contributor

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 18
Community Manager

Re: Script Extension Help

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?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Script Extension Help

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.

Community Hero

Re: Script Extension Help

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Community Manager

Re: Script Extension Help

Get well soon, Robert!

 

David, absolutely, it's worth checking out your script extension.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Script Extension Help

This is the shell I created and crashes TestComplete.  Not much in it.  Basically I just wanted to see if I could even get it to open a custom form.

Community Hero

Re: Script Extension Help

Based upon the following (https://support.smartbear.com/testcomplete/docs/working-with/extending/script/creating/keyword-test-...) my best guess is that you have not created the Setup handler properly.  You need to have the method take the Data and Parameters items in, and the method needs to return a boolean as a result.  You are doing neither and so I think this is causing the crash.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Script Extension Help

Robert,

 

I have started trying to add the various parts of the actual routines since apparently the stub records don't work.  I am now returning the boolean as you suggested and referenced in the document, but TestComplete is still crashing.

 

I have attached my updated files.  I still haven't added the code that would run on execution, but that should not be relevant to testing if this will import.

Community Hero

Re: Script Extension Help

Do you have any particular error message that comes up on the crash?  Or does it just shut down entirely?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Script Extension Help

This is the error that I receive each time I try to activate the extension.

 

crash.PNG

New Here?
Join us and watch the welcome video:
Top Kudoed Authors