3

I'm running Ubuntu 18.04 and just installed VSCode 1.35.1. I installed the Java packages, created a project from maven, and then tried to run the unit tests. The tests run, but none of the print messages are showing anywhere.

My launch.json looks like this,

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Launch) - Current File",
            "request": "launch",
            "mainClass": "${file}",
            "console": "integratedTerminal"
        },
        {
            "type": "java",
            "name": "Debug (Launch)-App<ttt>",
            "request": "launch",
            "mainClass": "exercises.App",
            "projectName": "ttt",
            "console": "integratedTerminal"
        }
    ]
}

When I run with F5 or Ctrl-F5, it always runs the main App. When I go to my test file and click on the Run|Debug links, the tests run and generate reports, but I don't see any of the print messages I put in.

What do I need to setup differently?

2 Answers 2

1

The Test Output is in the Java Test Runner Output. You can highlight it with the "Java: Show Test Output" command in the F1 menu

1

With VSCode 1.64 (Jan. 2022), you won't have to look for that view anymore when launching a debug session.
It allows for VS Code to automatically switch to test explorer when users click 'run tests'.

See issue 140596 / issue 135999, solved by commit a47b55c

You now have the options:

  • NeverOpen = 'neverOpen',
  • OpenOnTestStart = 'openOnTestStart',
  • OpenOnTestFailure = 'openOnTestFailure',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.