Take the 2-minute tour ×

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("", 4444, "*firefox", "");


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.

share|improve this question
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 7 '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 7 '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 7 '13 at 15:15
mmm ok thanks, but it doesn't provide me any answers... :-) –  daguerrier May 7 '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 7 '13 at 15:21

Your Answer



Browse other questions tagged or ask your own question.