Forum Discussion

mortenb123's avatar
mortenb123
Contributor
6 years ago

use python in a jscript project

Hi I've inherited a TC jsscript desktop project, now I want to speed up some of the desktop tests by connecting to a rest-api. (I've done this in another project using python).

 

Is it possible for me to use this in this project without rewriting it entirely into python.

  • Hi,

     

    As Wamboo said, python code (like JavaScript one) cannot be reused anywhere but python (Javascript) project.

    VBScript or JScript code can be moved to Script Extension and reused from there from any project.

     

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi,


    "by connecting to a rest-api"


    You are connecting to external resources with for example JSON data or you mean that You have (somehow) TestComplete project methods as Rest-Api service?


    "Is it possible for me to use this in this project without rewriting it entirely into python."


    In my opinion You can't use python sctipts inside JS project. What You can do is to put JS scripts inside script extansions and then use it in python projects.

    • mortenb123's avatar
      mortenb123
      Contributor

      |You are connecting to external resources with for example JSON data or you mean that You have (somehow)

      |TestComplete project methods as Rest-Api service?

      I have a python module which drags in some modules called as an import, modules are installed with pip in the TC test execute context venv. I fear I have to do the same with nodejs.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    As Wamboo said, python code (like JavaScript one) cannot be reused anywhere but python (Javascript) project.

    VBScript or JScript code can be moved to Script Extension and reused from there from any project.