cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a Script Unit Template

SOLVED
Occasional Contributor

Creating a Script Unit Template

Currently, when a new Script unit is added a blank page is displayed. Since we have a style/formatting guide that includes commented blocks for script headers and function descriptions (see below example), is there a way to create a Script unit template that includes these by default everytime a new Script is added?

 

Example 1 - Script Header

/**************************************

Information about script, inclusions, constants

etc entered here.

**************************************/

Example 2 - Function Header

/*F************************************/

Brief info on function, param, etc entered here

/**************************************/

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Creating a Script Unit Template

I've used the CTRL-J method a LOT in the past, creating the necessary default headers, etc., in a file.  IT doesn't automatically execute when you create a unit but it's a quick keystroke to do so.  

Alternatively, you could create a default script.sj file that you then use Add -> Existing item to add to your project and then, "Save As..." to save it as a new file name, preserving the original script.sj file.  


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
Vegas Thrill Rider
Extensions available

View solution in original post

2 REPLIES 2
Highlighted
Community Leader

Re: Creating a Script Unit Template

No but you have several ways of speeding the things :

  • Ctrl + J in editor to call Code templates and thus you can put quickly in a newly created your own template
  • Build a command line project builder. I've made a standard jscript, ran in command  prompt without the need of TestComplete, which create all the files i need by answering some questions to make it more useful (is it web project ? desktop project ? in closure mode ? only a standalone unit ? ..)

But yes it would be great to have it directly in TestComplete (an entry in Options module where you can define, according the langage used, your project script template and an entry in New project or Add new file where you check the Use template option)

Un sourire et ça repart

Highlighted
Community Hero

Re: Creating a Script Unit Template

I've used the CTRL-J method a LOT in the past, creating the necessary default headers, etc., in a file.  IT doesn't automatically execute when you create a unit but it's a quick keystroke to do so.  

Alternatively, you could create a default script.sj file that you then use Add -> Existing item to add to your project and then, "Save As..." to save it as a new file name, preserving the original script.sj file.  


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
Vegas Thrill Rider
Extensions available

View solution in original post