Ask a Question

Script Extensions

tristaanogre
Community Hero

Script Extensions

This is just a few brief questions to start discussion.  @shankar_r recently posted a framework he built in a script extension.  There was another discussion yesterday to debug a script extension problem.  As you can see in my signature, I use them a lot and do some development on the side.  Most of the framework I'm using currently in my employment is built into an extension.

 

This is a pretty powerful feature of TestComplete and I think it can be leveraged for a lot of benefit in automation environments.  I think, also, this is an opportunity for sharing of code and resources in a format that is easily dropped in to any project, regardless of initial source base.  I can conceive of a collaborative effort to build a library of extensions that would be universally useful for many TestComplete users.  To that aim...:

 

So... the question:

 

  1. Who else uses script extensions in their automation structure?
  2. What roles do script extensions play in your automation development?
  3. What kinds of things would you like to see script extensions be able to do that they don't already do?
  4. Do you have any extensions that you think would be of universal use that you'd like to have hosted?

Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
9 REPLIES 9
shankar_r
Community Hero

Re: Script Extensions

I would say, what ever the function which we are mentioning or called as a COMMON  that can be changed to a Powerful Script Extension. 

 

Some scenarios I'm using Script Extensions,

 

Scenario #1:

 

I use DDT driver to read the data from excel then store those stuffs in a Project variable. In each cell i will values like below,

 

userNames=tester,devloper,customer

roles=role1,role2,role3

 

For getting the list of userNames in a array i created a function which will return [tester,devloper,customer] array and few more options i want to have.

 

In this case, I created Script Extension that will return me the array values if i input the cell value and what property i want.

 

Scenario #2:

 

Its very simple and basic, I want to convert the String to Integer value for this i can use Test Complte inbuild method aqConvert.StrtoInt.

 

But when you input value as "test" then aqConvert.StrtoInt will thrown an error as Can't convert value.

 

So, I created a custom function Log an error instead Error popup. For this i can created script extension,

 

And same kind of different scenarios i have been using Script Extension.

 

For all this starting point is @tristaanogre session on Script Extensions 🙂

 

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Marsha_R
Community Hero

Re: Script Extensions

Could somebody fix that script extension that won the contest that lets you import/export the variable list?  There was supposed to be an update that I needed to get it to run and the author disappeared.  😞

tristaanogre
Community Hero

Re: Script Extensions

@Marsha_R

 

Can you link up here the extension?  I'll take a look but no guarentees.


Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
Marsha_R
Community Hero

Re: Script Extensions

Thanks! Here's the contest thread.  Towards the bottom you'll see the discussion about an error message.

 

https://community.smartbear.com/t5/TestComplete-General-Discussions/Code-Contest-Export-Importing-Pr...

tristaanogre
Community Hero

Re: Script Extensions

Cool.  I'll have to take a look at it. 🙂 No promises in timing but certainly challenge accepted.


Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
shankar_r
Community Hero

Re: Script Extensions

Looks very interesting, I will also take a look at the code and error. If i get any things working will post here.

 

Nice challenge.


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Manfred_F
Regular Contributor

Re: Script Extensions

I built a Framework using script extensions.

But, sad to say, I can not recommend doing so.

 

For the reasons mentioned here

https://community.smartbear.com/t5/TestComplete-Feature-Requests/Full-net-VB-or-VBA-support-in-TC/id...

the development takes far too much time and makes Your hair's color grey.

 

Scripting is acceptable for simple functionality where Errors show up quickly. Even then a "compile time" Syntax check is what I would strongly ask for.

tristaanogre
Community Hero

Re: Script Extensions

It's no different than building a framework in regular script code outside of the extension capsulation. The bonus of doing it with extensions is that you don't have to worry about adding code units to new projects just to use the framework.  It's "built in" to the environment.

 

True, debugging when a problem occurs within the extension code can get a bit painful at times... but if you do rigorous testing of your extension code before encapsulation, you can minimize that.

 

I think, however, using JScript for extension coding has some advantage over VBScript.  And, if SmartBear adds support for full JavaScript in the extensions, then there are some advantages that come along with that as well.

 

In any case, while I see your point, I think it can be mitigated with better coding practices all around.  And if you want to go more compile time checking, then you can use the TestComplete SDK and build compiled plugins which would be in line with what you're looking for.


Robert Martin
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
dmiscannon
Frequent Contributor

Re: Script Extensions

From what I remember, the original script extension could not handle and did not exclude from export DB Table, Table, and Object data types. I had updated the code back in September to exclude those data types but did not post my updates since the creator of the extension had stated he was going to fix the reported issues. I have attached my updated extension for those that want it. I don’t know if it fixes the issues reported by Sarah Edwards back in October, but I have not had any issues with it. Thanks.

 

Note: I had to posted the extension as a Zip file as I could not post the .tcx file. Just change the extension from .zip to .tcx to treat it as any other script extension.

 

cancel
Showing results for 
Search instead for 
Did you mean: