Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute a single test in latest IntelliJ (13.1.2) #18

Closed
michaeladler opened this issue Apr 23, 2014 · 2 comments
Closed

Unable to execute a single test in latest IntelliJ (13.1.2) #18

michaeladler opened this issue Apr 23, 2014 · 2 comments

Comments

@michaeladler
Copy link

Since the latest update of IntelliJ (13.1.2), I can no longer execute a single test within a class.

Example:

import org.junit.Test;
import org.junit.runner.RunWith;

import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;

@RunWith(DataProviderRunner.class)
public class ExampleTest {

    @DataProvider
    public static Object[][] exampleProvider() {

        return new Object[][] {{"foo"}};
    }

    @Test
    @UseDataProvider("exampleProvider")
    public void testSomething(String input) {}

}

Below is the exception I get when trying to execute the test:

java.lang.Exception: No tests found matching Method testSomething(ExampleTest) from org.junit.internal.requests.ClassRequest@4c032069
    at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:41)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

However, executing the whole test class works. I'm not sure if this can be fixed in the junit-dataprovider.

aaschmid added a commit that referenced this issue Apr 25, 2014
Fix issue #18:  Unable to execute a single test in latest IntelliJ
aaschmid added a commit that referenced this issue Apr 25, 2014
@aaschmid aaschmid added this to the v1.6.0 milestone Aug 15, 2014
@aaschmid aaschmid self-assigned this Aug 15, 2014
@spaceCamel
Copy link

I'm having this issue with IntelliJ IDEA 14 CE (14.0.1 and 14.1.4); junit-dataprovider 1.9.4; junit 4.12;

java.lang.Exception: No tests found matching Method testMethodName(com.company.MyTest) from org.junit.internal.requests.ClassRequest@2ac1fdc4
    at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:41)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
RunWith(DataProviderRunner.class)
public class MyTest
{
    @Test
    @UseDataProvider(value = "data_table")
    public void testMethodName(String input)
    { ... }

    @DataProvider
    public static List<List<Object>> data_table()
    { ... }
}

@aaschmid
Copy link
Member

aaschmid commented Jul 5, 2015

Hi @spaceCamel,

thanks for reporting this. Can you please open a new issue if the exception is still raised? For me, though, the following example works using junit-dataprovider v1.9.4 and IntelliJ IDEA 14.1.3:

package com.tngtech.test.java.junit.dataprovider;

import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RunWith(DataProviderRunner.class)
public class MyTest {

    @Test
    @UseDataProvider(value = "data_table")
    public void testMethodName(String input) {
        System.out.println(input);
    }

    @DataProvider
    public static List<List<Object>> data_table() {
        return Arrays.asList(
                Arrays.<Object>asList("test1"),
                Arrays.<Object>asList("test2")
            );
    }
}

Regards,
Andreas

@aaschmid aaschmid reopened this Jul 5, 2015
@aaschmid aaschmid closed this as completed Jul 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants