Search code examples
javajunitparameterized

Type mismatch: cannot convert from Class<Parameterized> to Class<? extends Runner>


I am trying to execute the JUNIT tests with parameters.

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.beust.jcommander.Parameterized;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class QtyByParam extends TestBase_Post {

I have included the jars junit-4.11.jar, junit-dep-4.11.jar

Is there anything missing? I am getting Type mismatch: cannot convert from Class<Parameterized> to Class<? extends Runner> error at @RunWith section.


Solution

  • You have the wrong class imported:

    import com.beust.jcommander.Parameterized;
    

    this is the correct import:

    import org.junit.runners.Parameterized;