简体   繁体   中英

Unable to run junit tests in intellij - play button greys out

在此处输入图片说明

Hello,

I am wondering if anyone has came across this issue before. I have a maven project where I can run maven commands like clean, verify, compile etc.

However when I try to run or debug anything debug related (like my Junit runner attached), nothing happens, the buttons just grey out. I don't see anything happening on the ide, just the buttons disabled and I am not sure why this is. I did not make any changes in the code so it was working before but I don't know why its not working now:

In the edit config for this junit runner the command is set as:

在此处输入图片说明

Here is the code for my runner:

@RunWith(SerenityRunner.class)
@CucumberOptions(features="src/test/java/resources/features/", glue = {"uk/co/xxx/cucumber/stepDefs"}, tags = {"@currentTest"} )
public class CurrentTestRunner {

    @BeforeClass
    public static void startAppium() {
        AppiumServerController.startAppiumServer();
    }

    @AfterClass
    public static void stopAppium() {
        AppiumServerController.stopAppiumServer();
    }

I have tried the following:

Invalidate and restart

Remove idea and open project again

Pull project again from GIT and try again

Updated IntelliJ

You can't run your unit tests because you don't have any tests to run.

You should have at least one method annotated with @Test.

Right now you have two methods in your class. One is annotated with BeforeClass, the other is annotated with AfterClass.

Those are just methods that run once before the first test (@BeforeClass) and after the last test (@AfterClass).

Add a method like this:

@Test
public void testCondition(){
//Assertions
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM