本文介绍了未找到类:IntelliJ中的空测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我刚刚在我的大学开始计算机科学课程,而且我在使用IntelliJ时遇到了一些问题。当我尝试运行单元测试时,我收到消息I'm just starting the computer science program at my college, and I'm having some issues with IntelliJ. When I try to run unit tests, I get the messageProcess finished with exit code 1Class not found: "edu.macalester.comp124.hw0.AreaTest"Empty test suite.我还在屏幕左侧看到一条标题为未找到测试的消息。我的测试代码在这里:I also see a message entitled "No tests were found" on the left side of my screen. My test code is here:package edu.macalester.comp124.hw0;import org.junit.Test;import static org.junit.Assert.*;public class AreaTest { @Test public void testSquare() { assertEquals(Area.getSquareArea(3.0), 9.0, 0.001); } @Test public void testCircle() { assertEquals(Area.getCircleArea(3.0), 28.2743, 0.001); }}我的项目代码在这里:package edu.macalester.comp124.hw0;import java.lang.Math;public class Area {/** * Calculates the area of a square. * @param sideLength The length of the side of a square * @return The area */public static double getSquareArea(double sideLength) { // Has been replaced by correct formula return sideLength * sideLength;}/** * Calculates the area of a circle. * @param radius The radius of the circle * @return The area */public static double getCircleArea(double radius) { // Replaced by correct value return radius * 2 * Math.PI;}}如何让我的测试到工作?提前致谢。我正在使用最新版本的IntelliJ IDEA CE。How can I get my tests to work? Thanks in advance. I'm using the most recent version of IntelliJ IDEA CE.推荐答案有相同的消息。我不得不删除运行/调试配置。Had the same message. I had to remove the Run/Debug configuration.在我的情况下,我之前将单元测试作为本地测试运行。之后我将测试移到androidTest包并尝试再次运行它。 Android Studio记得最后一次运行配置,因此它尝试再次运行它作为本地单元测试产生相同的错误。In my case, I ran the unit test as a local test before. After that I moved my test to the androidTest package and tried to run it again. Android Studio remembered the last run configuration so it tried to run it again as a local unit test which produced the same error.删除配置并再次运行测试后生成了一个新的配置并且有效。After removing the config and running the test again it generated a new configuration and worked. 这篇关于未找到类:IntelliJ中的空测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-16 01:06