javaselenium-webdriverjunitjunit4

Problem with Test class should have exactly one public zero-argument constructor


i have problem with constructor. Can anybody help me pls? My test failed on constructor.

public class ParameterTest extends MainTest { 

int number; 
boolean expectedPrime;


@Parameterized.Parameters 
public static List<Integer> getData() { 
    return Arrays.asList(1,2,6,9,482);
}

public ParameterTest(int number){
    this.number = number;
}


@Before
public void openBaseUrl(){
    driver.get(getBASE_URL()+"primenumber.php");

etc.

I trying numbers from List add to number and print it to console.


Solution

  • You need to annotate the class to let the JUnit runner know it's a parameterized test:

    @RunWith(Parameterized.class)
    public class ParameterTest extends MainTest { 
        // The rest of your code goes here...