Reputation: 61
Code:
package tests;
import org.testng.annotations.Test;
@Test
public class SearchText {
public void createzoo(String[] args) {
String[] elems = {"lion", "tiger", "duck"};
System.out.println(elems[0]);
System.out.println(elems[1]);
System.out.println(elems[2]);
}
}
Results:
SKIPPED: createzoo org.testng.TestNGException: Method createzoo requires 1 parameters but 0 were supplied in the @Test annotation.
Upvotes: 2
Views: 9793
Reputation: 41
The example createzoo method is not actually using the args passed in. Since it is not using them, just change the message signature to:
public void createzoo()
Most JUnit/TestNG tests do not take any arguments. You may be confusing it with the typical program that has a public static void main(String[] args)
Tests don't have a main()
per se and the framework will run your tests for you.
Only use the parameters mentioned by others if you really need them and the method is going to do something with them.
Upvotes: 4
Reputation: 5082
You need to provide the value for the parameter String[] args
in the createzoo
method. Here are several ways to do it:
Read TestNG documentation - it has a lot of examples on how to accomplish this.
Upvotes: 1
Reputation: 15608
Here is the relevant documentation: http://testng.org/doc/documentation-main.html#parameters-dataproviders
Upvotes: 0