TestProject Forum
Powered by leading experts in the test automation community

How to setup VSCode to run TestProject project

Hello,

I generated the code of one of my tests and I want to work on it and run it on vscode. How would I go about setting that up and running it?

Hi @daniela
You need an Integrated Development Environment (IDE) to execute the test with the most convenience.
VSCode is a great editor but it does not have an integrated compiler.
You will need to add one on your own to compile the code and execute the binaries.
(Regardless of any code execution, not unique to TestProject).

I agree with the fact that Visual Studio Code is the best free editor out there.
Visual Studio Code supports running and debugging tests for your extension. These tests will run inside a special instance of VS Code named the Extension Development Host , and have full access to the VS Code API. We refer to these tests as integration tests because they go beyond unit tests that can run without a VS Code instance.
Visual Studio Code provides two CLI parameters for running extension tests, --extensionDevelopmentPath and --extensionTestsPath .

For example:

# - Launches VS Code Extension Host
# - Loads the extension at <EXTENSION-ROOT-PATH>
# - Executes the test runner script at <TEST-RUNNER-SCRIPT-PATH>
code \
--extensionDevelopmentPath=<EXTENSION-ROOT-PATH> \
--extensionTestsPath=<TEST-RUNNER-SCRIPT-PATH>

The test script ( src/test/runTest.ts ) uses the vscode-test API to simplify the process of downloading, unzipping, and launching VS Code with extension test parameters:
The vscode-test API also allows:

  • Launching VS Code with a specific workspace.
  • Downloading a different version of VS Code rather than the latest stable release.
  • Launching VS Code with additional CLI parameters.
    You can more on its official docs.

I hope this helps.