Forum Discussion

mfoster711's avatar
mfoster711
Regular Contributor
16 days ago

Using AI to write scripts

Has anybody tried using AI to help write their scripts for TestComplete?

I have been researching CoPilot Github and Claude Code as AI tools to assist with coding. Both have integrations that work with VS Code or Pycharm (I using python). 

I was considering using VS Code or Pycharm to write and edit scripts so I can then take advantage of AI. But, you can't run your scripts from VS Code or Pycharm. I would have to bounce back and forth between IDE's and not sure if this is worth the hassle.  

Has anybody tried this and have any recommendations on how to best use AI with scripting?

8 Replies

  • NThomas's avatar
    NThomas
    Occasional Contributor

    Hi!

    We heavily use AI for writing visual regression tests, but unfortunately not in the TestComplete IDE, because, as mentioned earlier, their IDE has become obsolete. We use Cursor (but it also works with VS Code + Copilot).

    TC projects are written in JavaScript, so we can add extensions like ESLint for better code analysis. There's also an unofficial TestComplete extension that provides access to all the engine's specific methods (aqstring, aqobject, etc.), so we can have IntelliSense within the IDE. Git management is also much better. Namemapping hasn't been used for years; we prefer to use Find with a component repository (we use a POM architecture, which helps a lot).

    If you have the application's source code available (accessible via Cursor or Copilot), they can easily generate tests that take into account the specifics of the agent.md file.

    As a bonus, it even handles component identification automatically because it has access to the component IDs. We don't use much of TestComplete anymore besides the engine (we're still dependent on it because we have applications with WPF/Delphi/Web interoperability -_-' we're not perfect either :-D).

    You can also launch TestExecute from VS Code via the command line, but you won't have access to debugging.

  • wsgarcia's avatar
    wsgarcia
    Occasional Contributor

    I do use VS and Copilot (Copilot is our approved AI tool) to create helper scripts. I've created an MD file to make sure it uses the TC built-in functions and does proper formatting and structuring of the code. 
    We use Python for our scripts. While it's usage is limited, it has saved me time when I have been able to use it. Yes, you do have to toggle IDE's but it's easily managed with git. 

    • rjm7390's avatar
      rjm7390
      New Contributor

      Very interested in the MD file you created! Would you mind sharing it assuming it doesn't have sensitive info?

  • mfoster711's avatar
    mfoster711
    Regular Contributor

    A few notes about our setup:

    • We don't use namemap. It is too slow and clunky to work with. We have other methods to identify fields. Also, using namemap locks us into TestComplete
    • We aim to keep all of our TestComplete specific logic in one class. Everything else is standard python
    • TestComplete's IDE is a decade behind other tools and needs a major upgrade. This is one of the main reasons we are looking to use other IDE.
    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      NameMapping was a good idea at the time, but it became a nightmare to maintain once it grew huge, and sometimes it would get corrupted. I've moved away from NameMapping and now use the Find and FindAll methods. If SmartBear could create a plugin to be used in VS Code, that would make things so much easier. However, I really don't see that happening ever!

      • eykxas's avatar
        eykxas
        Regular Contributor

        Same thing ! Instead of name mapping I created my own architecture to replace it. With collections of locators. (We use xpath exclusively).

        I use AI for some optimisations but nothing more.

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    One thing to consider is how TestComplete scripts are typically structured. In many projects, a large portion of the script (often 70โ€“80%) is made up of interactions with NameMapped objects โ€” clicking controls, setting values, checking states, etc. That type of code is very tool-specific and already fairly declarative.

    Because of that, using an external IDE with AI assistance can feel like overkill for pure UI interaction, especially when you have to switch back and forth between IDEs and still rely on TestComplete to run and debug the scripts.

    Where AI tools may add more value is outside of direct UI actions โ€” for example:

    • Helper or utility functions
    • Data-driven logic
    • String/file handling
    • Simplifying or explaining more complex control flow

    In those cases, selectively using AI to assist with small, focused pieces of logic may be more practical than trying to author entire TestComplete scripts in an external IDE.

    ๐Ÿค– AI-assisted response
    ๐Ÿ‘ Found it helpful? Click Like
    โœ… Issue resolved? Click Mark as Solution

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Personally, I don't think it's necessary to rely on AI to write automation scripts, as scripting is fairly easy to do on your own. However, when working with complex code that involves concepts like Classes, Polymorphism, Inheritance, Encapsulation, etc., in Object Oriented Programming languages like Python, AI can be extremely helpful for guidance. It saves you from having to think about how to create and pass parameters to objects, but relying on AI too much can also make you forget the fundamentals of programming.

    There's no official SmartBear plugin available for Visual Studio Code. Additionally, there are limitations when using Python in TestComplete, so code written in VS Code may not work seamlessly in TestComplete.