-2

I'm testing this website:

website

public static void main(String[] args) {
    
    WebDriver firefox = new FirefoxDriver();

    
    firefox.get("http://test.naimi.me");
    
    WebElement row = firefox.findElement(By.className("row"));
    
    
   
    WebElement navigationPane = 
            firefox.findElement(By.xpath("//nav[contains(@nav,'nav')]"));
    
    
    WebElement billboard = firefox.findElement(By.id("billboard")) ;
    if(billboard != null) System.out.println("good bilboard") ;

I have some Java test code to check if elements loaded after opening the main page. How do I make it run automatically? and on what server/software? Maybe cloud?

halfer
  • 19,824
  • 17
  • 99
  • 186
ERJAN
  • 23,696
  • 23
  • 72
  • 146
  • 2
    There's a lot of... things here, notwithstanding the fact that the "cloud" isn't the end-all thing that you need to hook into somehow. "Running automatically" is also very subjective and depends on what continuous integration server you're using. If you've not heard of a CI service like Jenkins or CircleCI, I would suggest that you start there (at least, as far as automatically running the tests). I'll say that the test itself needs some work (i.e. assert statements), but I've got a feeling that you're just getting started with it. – Makoto Feb 18 '15 at 04:43

1 Answers1

1

Here's my way: TestNG + Selenium-Grid + Jenkins CI.

TestNG is a test framework which is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc...

Selenium-Grid allows you to :

  • scale by distributing tests on several machines ( parallel execution )
  • manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS.
  • minimize the maintenance time for the grid by allowing you to implement custom hooks to leverage virtual infrastructure for instance.

Jenkins CI is the leading open-source continuous integration server, which could be used to run your tests automatically and continuously.

user2432405
  • 1,406
  • 2
  • 14
  • 29
  • i actually was following same path, installed testng already... thx! i will add to this toolchain grid and jenkins. – ERJAN Feb 18 '15 at 06:01
  • also you could use onlineservices like browserstack.com or saucelabs.com to run your tests in different configured virtual machines. – Paulquappe Feb 18 '15 at 15:52