Cannot run or debug unit tests from within VSCode 3
See original GitHub issueI can run unit tests from the terminal with
mage/Mage.Tests % mvn '-Dtest=LicidAbilityTest' test
But I can’t use VSCode’s test runner integration to run tests. I’d like to have access to the VSCode debugger here…
Repro:
- Set up VSCode with Mage as specified in README.md:
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Launch) - Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Run Client",
"request": "launch",
"mainClass": "mage.client.MageFrame",
"projectName": "mage-client",
"cwd": "${workspaceFolder}/Mage.Client"
},
{
"type": "java",
"name": "Run Server",
"request": "launch",
"mainClass": "mage.server.Main",
"projectName": "mage-server",
"cwd": "${workspaceFolder}/Mage.Server"
}
]
}
// .vscode/settings.json
{
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"java.configuration.updateBuildConfiguration": "interactive"
}
- Click the “Run Test” link above LicidAbilityTest. Nothing happens…
- View “Java Test Runner” output console, see
org.mage.test.cards.abilities.activated.LicidAbilityTest.Failed to parse the message: %ERROR 1
- Change
MageTestPlayerBaseto extendjunit.framework.TestCase - Rename
CopyGameStatePerformanceTest.runtoCopyGameStatePerformanceTest.goto avoid the name conflict and fix the build - Click “Run Test” above LicidAbilityTest. Now the test runs, but it doesn’t initialize
playerAand we get aNullPointerException…
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Can't run or debug unit tests - Visual Studio Feedback
I'm using Visual Studio Community Edition 15.8.1 and I can't run or debug any unit tests. Every time I'm trying to run the...
Read more >Visual Studio - suddenly cannot debug tests - Stack Overflow
I tried to debug tests using Resharper 8 Unit Test Session window. The message in the result window was "Test wasn't run".
Read more >Cannot debug single unit test anymore · Issue #2241 - GitHub
Assuming that the unit tests are discovered and the 'Run Test| Debug Test' links are visible, click on the Debug Test link of...
Read more >How to Use VS Code to Debug Unit Test Cases | by Jennifer Fu
Click the following Run button on the left side panel. It presents an interface for Run and Debug. By specifying a proper configuration,...
Read more >Using Visual Studio Code to debug Jest based unit tests
Step 3 Debugging our project · Place breakpoints in your code. · Click on the debug icon (sidebar). · Pick up from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You don’t need to change any code. Try to research first error. It’s can be missing database files (game test needs db files). Run full tests from maven command line (it’s will create all missing db) or copy-paste db folder from
\Mage.Server\dbor\Mage.Client\dbfolder to\Mage.Tests\db(or any other folder like\Mage.\Verify\db– it’s depend on your test).Thanks, works for me!