cancel
Showing results for 
Search instead for 
Did you mean: 

Keyword Project - Convert from Python to JavaScript

SOLVED
Highlighted
Contributor

Keyword Project - Convert from Python to JavaScript

Short Question - How do you convert a Keyword Project recorded using Python as the underlying language to JavaScript?

 

Long Background - When we were originally creating Projects years ago - we experimented with using different underlying languages for our Keyword Projects.  Quickly we decided to go with JavaScript as our standard as it appeared to be the most universal.  Since what we were reading at the time stated that the underlying language should have no impact on actual function - we didn't bother redoing anything we had in Python. 

 

Now we are running into issues which require some scripting (i.e. - Capture an Order number from a screen, then plug that number into another function).  We don't want to have to find solutions for both languages.  As JavaScript is our standard, we want to convert our Python Projects. 

 

Anyone know how? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Keyword Project - Convert from Python to JavaScript

Hi Rich,

 

Are we out of luck?

Unfortunately, yes, you are.

However, I believe that unless you were using something that is very specific to Python, the conversion should not be that difficult.

Personally I convert from time to time my code that I created in VBScript, DelphiScript and JScript and the process is quite straightforward. (Tip: my preference is to use the means provided by TestComplete instead of native functionality provided by the given scripting language whenever possible. (E.g. functions to work with date, time, strings, etc.) This significantly simplifies future conversion.)

Another option that you may consider is to create Script Extension and move common generic code to there. Script Extensions are not ideal but can be used from projects that are based on different scripting languages.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

Re: Keyword Project - Convert from Python to JavaScript

Hi,

 

Pure keyword tests are language-agnostic. But embedded code snippets must be converted manually.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Contributor

Re: Keyword Project - Convert from Python to JavaScript

Hi Alex,

 

Thank you for responding.  Much appreciated.

 

Not quite the answer I was hoping for though.   We're looking to only need to maintain a code snippet library for a single language - JavaScript.  Hence our desire to convert Projects recorded using Python to JavaScript.  

 

We were really hoping for something along the lines of:

 

1 - Select 'Tools/Options'
2 - Select General/Projects'
3 - Select Default Language= JavaScript
4 - Select the Python Project you wish to convert.
5 - Clone the Project.
6 - Verify the Project is cloned as JavaScript by clicking on the Project's Advanced/Script/Unit1 - Look at footer display.
7 - Run the new JavaScript Project to verify that it functions correctly. Make corrections as needed.

 

So - Are we out of luck?  No such option?  Rerecord is all we can do?

 

I would appreciate your insights,

 

Rich

Highlighted
Community Hero

Re: Keyword Project - Convert from Python to JavaScript

Hi Rich,

 

Are we out of luck?

Unfortunately, yes, you are.

However, I believe that unless you were using something that is very specific to Python, the conversion should not be that difficult.

Personally I convert from time to time my code that I created in VBScript, DelphiScript and JScript and the process is quite straightforward. (Tip: my preference is to use the means provided by TestComplete instead of native functionality provided by the given scripting language whenever possible. (E.g. functions to work with date, time, strings, etc.) This significantly simplifies future conversion.)

Another option that you may consider is to create Script Extension and move common generic code to there. Script Extensions are not ideal but can be used from projects that are based on different scripting languages.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
Contributor

Re: Keyword Project - Convert from Python to JavaScript

Alex - Sorry for the delay - Funny how work keeps getting in the way of work.

 

One of my team mates is taking over this task, and believes she has a solution based on her research and your suggestions. 

 

Thank you for the help,

 

Rich

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