TestNG Runner VS Code ExtensionRun TestNG suites directly from VS Code with a dedicated sidebar. Project Source Code:Interactive AI DocumentationFeatures
How To Use In VS Code1) Install the extensionInstall TestNG Runner from the Visual Studio Code Marketplace:
Marketplace page: 2) Open your Java/TestNG projectOpen the project that contains:
The extension only shows XML files that contain the TestNG
3) Open the TestNG Runner viewIn the Activity Bar, click TestNG Runner. The sidebar shows TestNG suite files grouped by workspace folder and directory. If a suite has been run before, its last run time and exit code appear next to it. 4) Configure Java and Maven if neededIf Otherwise open VS Code settings and search for
Examples:
The status bar shows whether Maven and Java are currently resolved. 5) Run a suiteUse any of these entry points from the TestNG Runner view:
The extension finds the nearest 5b) Run every suite inside a folderFolders and subfolders that contain detected TestNG suite XML files also support inline actions. You can hover a folder in the TestNG Runner view and:
This makes it easier to run a logical group of suites without triggering the entire workspace. 6) Watch logs and outputRuntime output is written to:
To open the log file for a suite:
7) Stop a running suiteClick the inline Stop TestNG Suite icon for the running suite, or use the suite context menu. If you stop from a folder, the extension stops all running suites inside that folder tree. 8) Debug a suite with breakpointsTo debug instead of run:
The extension starts Surefire with JDWP enabled and tries to auto-attach the VS Code Java debugger on If you start debug from a folder, the extension debugs each suite in that folder one by one. Debug prerequisite:
9) Use test category selectionThe extension can detect TestNG groups from Relevant settings:
You can also run the command TestNG Runner: Select Test Category to choose and save a category from the current workspace. For folder-level run or debug actions, category selection is resolved once for the whole batch instead of prompting once per suite. 10) Control headless mode and extra Maven argumentsUse these settings when your test framework needs them:
TroubleshootingNo suites found
Maven not found
Java not found
DevelopmentIf you are working on the extension itself, use the steps below. Build and run the extension locally
Press Common commands
Use Where Are The Logs?Each suite writes to its own log file. The files are stored in VS Code's extension storage directory. You can open them by right-clicking a suite and choosing Open TestNG Suite Log. ChangelogRelease notes are maintained in CHANGELOG.md. Connect with me:Kumar Priyank |