0

I'm trying to launch "selenium" only once for my test suite but it's not working. Here is what I've done :

My file AllTest.java is generating the test suite and I want to launch selenium from here:

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;  
import junit.textui.TestRunner;
import com.thoughtworks.selenium.*;

public class AllTests extends TestCase {

public static Selenium selenium;    


public static Test suite()  
{  
TestSuite suite = new TestSuite();  
suite.addTestSuite( ConnexionGTEST.class); 
suite.addTestSuite( test.class); 
return suite;  
}  

public static void main(String arg[])
{

selenium = new DefaultSelenium("172.29.16.252", 4444, "*firefox", "http://172.19.90.23:8080/");
selenium.start();
TestRunner.run(suite());

}
} 

In that way, even in my test "ConnexionGTEST.class" and "test.class", I don't have to initialize my selenium and directly call it. But it's not running. Any ideas?

Thanks in advance.

Mark Rowlands
  • 5,357
  • 2
  • 29
  • 41
daguerrier
  • 25
  • 2
  • 10
  • Out of curiosity, Are you using selenium RC? Do you mean you want all your tests to execute within the same browser window, without closing it and creating a new one? – confusified May 07 '13 at 14:54
  • yes that's exactly what I mean ! i want to launch at the begining of my suite RC and then keep the same browser window all test long. Selenium RC is running on my machine – daguerrier May 07 '13 at 15:05
  • I'm not overly familiar with Selenium rc, but selenium Webdriver using junit uses @ before and @ after annotations for set-up and tearDown methods to cleanly provide a new browser for each test. I have forced all my tests to run in one session before, but it leads to very messy test cases, and wouldn't be recommended.. – confusified May 07 '13 at 15:15
  • mmm ok thanks, but it doesn't provide me any answers... :-) – daguerrier May 07 '13 at 15:20
  • It was as much a question as an answer! Why exactly do you need to run all your tests within one browser session? Also have you looked into Selenium Webdriver at all? – confusified May 07 '13 at 15:21
  • Some constraints oblige me to use RC and not WebDriver... And I want to do that in order to re-use smaller testcase into different testsuit. For example, one test case is to connect, this one will be used in several test suite. But if in each test case I recreate a new environment, i'll have to reconnect in each testcase – daguerrier May 07 '13 at 15:24
  • I see, I assume that RC is using similar setup and teardown methods somewhere, but where exactly they could be I'm unfamiliar with. – confusified May 07 '13 at 15:27

0 Answers0