小编Sal*_*lly的帖子

Visual Studio Code 中的 JUnit

我在 Visual Studio Code 中运行 JUnit 时遇到了各种各样的问题。我有两个主要问题,它们在我创建的所有项目中都不共存。

问题 1:创建并运行 Java 项目后,如果我尝试添加 JUnit 测试类,程序找不到该类/测试。我应该看到一个选项来运行或调试我的测试,但没有弹出这样的选项。此外,当我单击测试资源管理器选项卡时,我没有看到列出的测试类,但它位于项目文件夹中。

问题 2:我将一个最初在 eclipse 中开发的项目导入到 VS 代码中取得了一些成功。这并不理想。这样做时,我遇到的问题是 VS Code 在 JUnit 导入方面存在问题。有时它无法识别 @Test 注释,并会尝试通过让我在程序中进行导入来解决导入问题,(例如:使用 assertSame 方法时,我必须编写: org.junit.Assert.assertEquals("stringName", v1.getName);

Has anyone had similar problems, or does anyone have some insight on how to run a java project without a maven or another project manager? I'm sure there is a way to make this work, but I feel like I'm missing the obvious.

java visual-studio-code

10
推荐指数
2
解决办法
1万
查看次数

标签 统计

java ×1

visual-studio-code ×1