Forum Discussion

yusufalishaik's avatar
yusufalishaik
Occasional Contributor
4 months ago

No built-in code formatting feature for JavaScript in TestComplete v15.60.44.7

Hi SmartBear Community,

We utilize JavaScript as the scripting language for our TestComplete projects. One recurring challenge we encounter is code formatting. Despite searching for a built-in code formatting feature, I haven't found one. While reviewing this older post dating back five years, I came across references to script extensions, but unfortunately, I couldn't access the shared link. Presently, I'm exploring solutions for code formatting within TestComplete and would greatly appreciate insights and advice from fellow users.

Thank you,

Yusuf.

3 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    In the editor, these are the only options to "format",

    I'm not aware of any functions to format the script within TC. There are online formatters such as https://beautifier.io, that you could use.

    • yusufalishaik's avatar
      yusufalishaik
      Occasional Contributor

      Formatting the code can be achieved using third-party formatters such as VS Code or online compilers like the one you referenced. However, given the substantial number of test scripts we possess (nearly 4 TestComplete Project suites comprising over 10 projects in total), the process of copying the code, formatting it in a third-party tool, and then pasting it back into TestComplete becomes exceedingly laborious. I'm uncertain if the script extensions mentioned in this post still function as described, but if there exists any method to conduct formatting directly within TestComplete, it would be immensely beneficial.

      • rraghvani's avatar
        rraghvani
        Champion Level 3

        VS Code is a fully fledged development tool or source code editor which features debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, etc.

        TC is a light weight editor that is similar to Python IDLE, Windows PowerShell ISE. It would be a nice feature to have within TC, but users should be trained and understand how to code, format etc. have some sort of documentation explaining coding conventions, style guidelines and so on.

        It should be possible to use Notepad++, create a macro to format all of your .js scripts.