string array caanot be added in function for @test

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

string array caanot be added in function for @test

sreedevivasudevan91

in Beforetest i gave domain id and login link and that executed successfully.

@Test

        public static void new2() throws  InterruptedException {


   String[] email={ "",""};
    String[] passwd= {"","",};

        for(int i = 0; i < email.length ; i++)
        {
     driver.findElement(By.id("")).clear();
           driver.findElement(By.id("")).sendKeys(email[i]);
           System.out.println(email[i]);
           driver.findElement(By.id("")).clear();
           driver.findElement(By.id("")).sendKeys(passwd[i]);
           System.out.println(passwd[i]);

*if i add string args in function it shows -error

 *if i add string in another function and call here by public static void new2(String email) throws InterruptedException it shows-Cannot inject @Test annotated Method [new2] with [class [Ljava.lang.String;]. 

* if i include only one function and give public static void new2() throws InterruptedException -it shows null pointer exception(like above mentioned code) is there any way to add string and fill email id without error in testng ?

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.