cannot add void return wrapper method

View: New views
4 Messages — Rating Filter:   Alert me  

cannot add void return wrapper method

by Marlena-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm trying to make a method to wrap some setup functionality for some
tests in Eclipse for java.  The functionality is setting up selenium
and logging into a page as a user.

The method I wrote to start selenium and login works just fine:
public Selenium startLogin(String portNum, String browser, String
user, String pass){

                  Selenium selenium= new DefaultSelenium("localhost",
Integer.parseInt(portNum), "*" + browser, "http://localhost:8080");
                  selenium.start();
                  selenium.open("/login.action");
                  selenium.waitForPageToLoad("30000");
                  selenium.type("os_username", user);
                  selenium.type("os_password", pass);
                  selenium.click("login");
                  selenium.waitForPageToLoad("30000");

                  return selenium;

          }

My trouble is with the method I wrote for logging out and stopping
selenium:

public void stopLogout(Selenium selenium){

                  selenium.open("dashboard.action");
                  selenium.click("//a[@id='logout-link']/span");
                  selenium.waitForPageToLoad("30000");
                  selenium.stop();


          }

I get this error:  Method stopLogout requires 1 parameters but 0 were
supplied in the @Test notation.

Here is how I'm calling the stopLogout method:
this.stopLogout(selenium);

Thanks for your help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cannot add void return wrapper method

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Marlena,

Can you post the @Test annotation you are using on stopLogout()?  If you don't have any, there must be one at the class level which is telling TestNG that stopLogout() should be a test method.  Either make it private or make sure it doesn't have a @Test annotation.

--
Cedric


On Sun, Oct 25, 2009 at 8:40 PM, Marlena <marlena.compton@...> wrote:

I'm trying to make a method to wrap some setup functionality for some
tests in Eclipse for java.  The functionality is setting up selenium
and logging into a page as a user.

The method I wrote to start selenium and login works just fine:
public Selenium startLogin(String portNum, String browser, String
user, String pass){

                 Selenium selenium= new DefaultSelenium("localhost",
Integer.parseInt(portNum), "*" + browser, "http://localhost:8080");
                 selenium.start();
                 selenium.open("/login.action");
                 selenium.waitForPageToLoad("30000");
                 selenium.type("os_username", user);
                 selenium.type("os_password", pass);
                 selenium.click("login");
                 selenium.waitForPageToLoad("30000");

                 return selenium;

         }

My trouble is with the method I wrote for logging out and stopping
selenium:

public void stopLogout(Selenium selenium){

                 selenium.open("dashboard.action");
                 selenium.click("//a[@id='logout-link']/span");
                 selenium.waitForPageToLoad("30000");
                 selenium.stop();


         }

I get this error:  Method stopLogout requires 1 parameters but 0 were
supplied in the @Test notation.

Here is how I'm calling the stopLogout method:
this.stopLogout(selenium);

Thanks for your help.





--
Cédric



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cannot add void return wrapper method

by Marlena-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Thank you Cedric.  Changing the method to private did the trick, and
is better for the code anyway.

I'm not sure why TestNG would expect this method to have an @Test
annotation.  The only place I call it is in the @afterClass method.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cannot add void return wrapper method

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Mon, Oct 26, 2009 at 4:36 AM, Marlena <marlena.compton@...> wrote:


Thank you Cedric.  Changing the method to private did the trick, and
is better for the code anyway.

I'm not sure why TestNG would expect this method to have an @Test
annotation.  The only place I call it is in the @afterClass method.

Do you have a @Test annotation on your class?

--
Cédric



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---