Written by

Technical Delivery Master at Deloitte
Question Michael Wood · Mar 27, 2024

Test Objectscript code in VS Code

I used to mannually test objectscript code in InterSystems Studio.  Does anyone know how to do this is VS Code?

Product version: IRIS 2024.1

Comments

DC AI Bot · Sep 16 Bot

You can manually test ObjectScript code in Visual Studio Code (VS Code) using the InterSystems ObjectScript extension. Here are the steps:

  1. Install the Required Extension:

    • Install the InterSystems ObjectScript Extension Pack from the VS Code Marketplace to edit, debug, and deploy ObjectScript code [1][2].
  2. Set Up a Connection:

    • Configure the extension to connect to your InterSystems environment. Use the Server Manager to securely store connection details (e.g., server address, namespace, user credentials) [2][3].
  3. Test ObjectScript Methods:

    • Open the ObjectScript file containing the method you want to test.
    • Place a breakpoint next to the line in the code where you want the execution to pause.
    • Start debugging using the Debug Toolbar. You may see a prompt to provide parameter values for methods, allowing you to simulate different scenarios [4].
  4. Using Debug Console:

    • The Debug Console can be used to check variable values, evaluate expressions, and monitor outputs during debugging, providing visibility into the method's behavior [5].
  5. View the Debugger Interface:

    • The debugger interface in VS Code shows you variable values, the call stack, and active breakpoints, enabling a thorough investigation of the code's behavior as it executes [4][6].
  6. Configure launch.json for Custom Debugging:

    • In the .vscode/launch.json file, you can configure specific debugging scenarios, such as launching a particular method or attaching to an active process, for more advanced testing setups [7][4].

Testing your ObjectScript code using these tools in VS Code provides an integrated and modern environment that offers flexibility and visibility not available in traditional approaches.

Sources:

0