Что я сделал. Поставил Еклипс, ИДЕ, RC. Записал простенький тестовый тест(хорошее словосочетание:)) в ИДЕ, экспортнул его в Junit и TestNG, создал проект в еклипсе и добавил два класса - этот тест в Junit и TestNG. Поставил Грид так как написано здесь http://selenium-grid...et_started.html, после этого запустил хаб и 4 RC. Все вроде поднялось. Теперь соответственно вопросы:
1. Как остановить хаб?:) Делал как написано здесь: http://selenium-grid...enium_grid_hub. Выдает на оба запроса, что команда не является внутренней или внешней командой(запускаю с директории грида)
2. Что мне нужно использовать Junit и TestNG и какая между ними разница в разрезе моей проблемы?
3. Есть какой-то толковый мануал, используя который можно будет запустить тесты параллельно или подскажите что я делаю не так?
Сам тест выглядит следующим образом:
Скрытый текст
import org.testng.annotations.BeforeMethod; import org.testng.Assert; import com.thoughtworks.selenium.*; import org.testng.annotations.*; import org.testng.Assert.*; import java.util.regex.Pattern; public class FootballNG extends SeleneseTestNgHelper { @BeforeMethod @BeforeTest public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com.ua/"); selenium.start(); } @Test(description="Test 1") public void TestOne() throws Exception { selenium.open("http://www.google.com.ua/"); Thread.sleep(3000); selenium.type("id=gbqfq", "football.ua"); selenium.click("id=gbqfb"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("link=Football.ua - все о футболе")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("css=em"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("link=Лига чемпионов")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("link=Лига чемпионов"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("link=календарь игр")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("link=календарь игр"); selenium.waitForPageToLoad("30000"); selenium.select("id=ctl00_ctl17_ddlTeam", "label=Барселона"); selenium.click("css=#ctl00_ctl17_ddlTeam > option[value=\"51\"]"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("xpath=(//a[contains(text(),'2')])[9]")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("xpath=(//a[contains(text(),'2')])[8]"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isTextPresent("Матч завершен! Челси проходит Барселону!")) break; } catch (Exception e) {} Thread.sleep(1000); } verifyTrue(selenium.isTextPresent("Матч завершен! Челси проходит Барселону!")); } @Test (description="Test 2") public void TestTwo() throws Exception { selenium.open("http://www.google.com.ua/"); Thread.sleep(3000); selenium.type("id=gbqfq", "football.ua"); selenium.click("id=gbqfb"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("link=Football.ua - все о футболе")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("css=em"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("link=Лига чемпионов")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("link=Лига чемпионов"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("link=календарь игр")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("link=календарь игр"); selenium.waitForPageToLoad("30000"); selenium.select("id=ctl00_ctl17_ddlTeam", "label=Барселона"); selenium.click("css=#ctl00_ctl17_ddlTeam > option[value=\"51\"]"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isElementPresent("xpath=(//a[contains(text(),'2')])[9]")) break; } catch (Exception e) {} Thread.sleep(1000); } selenium.click("xpath=(//a[contains(text(),'2')])[8]"); selenium.waitForPageToLoad("30000"); for (int second = 0;; second++) { if (second >= 60) Assert.fail("timeout"); try { if (selenium.isTextPresent("Матч завершен! Челси проходит Барселону!")) break; } catch (Exception e) {} Thread.sleep(1000); } verifyTrue(selenium.isTextPresent("Матч завершен! Челси проходит Барселону!")); } }
После запуска хаба и 4-рех RC и рана теста с еклипса выдает следующее: ERROR: ERROR: No sessionId provided. Most likely your original newBrowserSession command failed.
Лог хаба:
Скрытый текст
C:\Users\Oleksandr Moroz\Desktop>cd C:\Program Files (x86)\selenium-grid-1.0.8
C:\Program Files (x86)\selenium-grid-1.0.8>ant launch-hub
Buildfile: C:\Program Files (x86)\selenium-grid-1.0.8\build.xml
launch-hub:
[java] ът│Є 29, 2012 6:11:35 PM com.thoughtworks.selenium.grid.hub.HubRegis
try gridConfiguration
[java] INFO: Loaded grid configuration:
[java] ---
[java] hub:
[java] environments:
[java] -
[java] browser: "*firefox"
[java] name: Firefox on Windows
[java] -
[java] browser: "*firefox"
[java] name: Firefox on OS X
[java] -
[java] browser: "*firefox"
[java] name: Firefox on Linux
[java] -
[java] browser: "*iehta"
[java] name: IE on Windows
[java] -
[java] browser: "*safari"
[java] name: Safari on OS X
[java] -
[java] browser: "*firefox"
[java] name: "*firefox"
[java] -
[java] browser: "*firefox2"
[java] name: "*firefox2"
[java] -
[java] browser: "*firefox3"
[java] name: "*firefox3"
[java] -
[java] browser: "*chrome"
[java] name: "*chrome"
[java] -
[java] browser: "*iexplore"
[java] name: "*iexplore"
[java] -
[java] browser: "*iehta"
[java] name: "*iehta"
[java] -
[java] browser: "*safari"
[java] name: "*safari"
[java] -
[java] browser: "*opera"
[java] name: "*opera"
[java] -
[java] browser: "*googlechrome"
[java] name: "*googlechrome"
[java] -
[java] browser: "*firefoxproxy"
[java] name: "*firefoxproxy"
[java] -
[java] browser: "*pifirefox"
[java] name: "*pifirefox"
[java] -
[java] browser: "*iexploreproxy"
[java] name: "*iexploreproxy"
[java] -
[java] browser: "*piiexplore"
[java] name: "*piiexplore"
[java] -
[java] browser: "*safariproxy"
[java] name: "*safariproxy"
[java]
[java] 2012-04-29 18:11:35.460::INFO: Logging to STDERR via org.mortbay.lo
g.StdErrLog
[java] 2012-04-29 18:11:35.515::INFO: jetty-6.0.x
[java] 2012-04-29 18:11:35.584::INFO: Started SocketConnector @ 0.0.0.0:44
44
[java] ът│Є 29, 2012 6:14:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:17:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:20:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:23:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:25:59 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:25:59 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5555#false]
[java] ът│Є 29, 2012 6:26:01 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:26:01 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5556#false]
[java] ът│Є 29, 2012 6:26:11 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:26:11 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5557#false]
[java] ът│Є 29, 2012 6:26:14 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:26:14 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5558#false]
[java] ът│Є 29, 2012 6:26:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "*iexplore", 2 => "http://localhost:4444", 3
=> "", cmd => "getNewBrowserSession"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Could not find any remote control providing the '*iexplore'
environment. Please make sure you started some remote controls which registered
as offering this environment.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "C:\Users\Oleksandr Moroz\workspace\Diploma1\
test-output\Default suite\TEST-setUp1743957154356274031.png", cmd => "captureScr
eenshot"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "C:\Users\Oleksandr Moroz\workspace\Di
ploma1\test-output\Default suite\TEST-setUp1743957154356274031.png", cmd => "cap
tureScreenshot"' : ERROR: No sessionId provided. Most likely your original newBr
owserSession command failed.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "null", cmd => "selectWindow"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "null", cmd => "selectWindow"' : ERROR
: No sessionId provided. Most likely your original newBrowserSession command fai
led.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "C:\Users\Oleksandr Moroz\workspace\Diploma1\
test-output\Default suite\TEST-selectDefaultWindow8795039411096779149.png", cmd
=> "captureScreenshot"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "C:\Users\Oleksandr Moroz\workspace\Di
ploma1\test-output\Default suite\TEST-selectDefaultWindow8795039411096779149.png
", cmd => "captureScreenshot"' : ERROR: No sessionId provided. Most likely your
original newBrowserSession command failed.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "null", cmd => "selectWindow"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "null", cmd => "selectWindow"' : ERROR
: No sessionId provided. Most likely your original newBrowserSession command fai
led.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "C:\Users\Oleksandr Moroz\workspace\Diploma1\
test-output\Default suite\TEST-selectDefaultWindow1529599659606977600.png", cmd
=> "captureScreenshot"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "C:\Users\Oleksandr Moroz\workspace\Di
ploma1\test-output\Default suite\TEST-selectDefaultWindow1529599659606977600.png
", cmd => "captureScreenshot"' : ERROR: No sessionId provided. Most likely your
original newBrowserSession command failed.
C:\Users\Oleksandr Moroz\Desktop>cd C:\Program Files (x86)\selenium-grid-1.0.8
C:\Program Files (x86)\selenium-grid-1.0.8>ant launch-hub
Buildfile: C:\Program Files (x86)\selenium-grid-1.0.8\build.xml
launch-hub:
[java] ът│Є 29, 2012 6:11:35 PM com.thoughtworks.selenium.grid.hub.HubRegis
try gridConfiguration
[java] INFO: Loaded grid configuration:
[java] ---
[java] hub:
[java] environments:
[java] -
[java] browser: "*firefox"
[java] name: Firefox on Windows
[java] -
[java] browser: "*firefox"
[java] name: Firefox on OS X
[java] -
[java] browser: "*firefox"
[java] name: Firefox on Linux
[java] -
[java] browser: "*iehta"
[java] name: IE on Windows
[java] -
[java] browser: "*safari"
[java] name: Safari on OS X
[java] -
[java] browser: "*firefox"
[java] name: "*firefox"
[java] -
[java] browser: "*firefox2"
[java] name: "*firefox2"
[java] -
[java] browser: "*firefox3"
[java] name: "*firefox3"
[java] -
[java] browser: "*chrome"
[java] name: "*chrome"
[java] -
[java] browser: "*iexplore"
[java] name: "*iexplore"
[java] -
[java] browser: "*iehta"
[java] name: "*iehta"
[java] -
[java] browser: "*safari"
[java] name: "*safari"
[java] -
[java] browser: "*opera"
[java] name: "*opera"
[java] -
[java] browser: "*googlechrome"
[java] name: "*googlechrome"
[java] -
[java] browser: "*firefoxproxy"
[java] name: "*firefoxproxy"
[java] -
[java] browser: "*pifirefox"
[java] name: "*pifirefox"
[java] -
[java] browser: "*iexploreproxy"
[java] name: "*iexploreproxy"
[java] -
[java] browser: "*piiexplore"
[java] name: "*piiexplore"
[java] -
[java] browser: "*safariproxy"
[java] name: "*safariproxy"
[java]
[java] 2012-04-29 18:11:35.460::INFO: Logging to STDERR via org.mortbay.lo
g.StdErrLog
[java] 2012-04-29 18:11:35.515::INFO: jetty-6.0.x
[java] 2012-04-29 18:11:35.584::INFO: Started SocketConnector @ 0.0.0.0:44
44
[java] ът│Є 29, 2012 6:14:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:17:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:20:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:23:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:25:59 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:25:59 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5555#false]
[java] ът│Є 29, 2012 6:26:01 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:26:01 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5556#false]
[java] ът│Є 29, 2012 6:26:11 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:26:11 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5557#false]
[java] ът│Є 29, 2012 6:26:14 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] ът│Є 29, 2012 6:26:14 PM com.thoughtworks.selenium.grid.hub.manageme
nt.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5558#false]
[java] ът│Є 29, 2012 6:26:35 PM com.thoughtworks.selenium.grid.hub.remoteco
ntrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "*iexplore", 2 => "http://localhost:4444", 3
=> "", cmd => "getNewBrowserSession"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Could not find any remote control providing the '*iexplore'
environment. Please make sure you started some remote controls which registered
as offering this environment.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "C:\Users\Oleksandr Moroz\workspace\Diploma1\
test-output\Default suite\TEST-setUp1743957154356274031.png", cmd => "captureScr
eenshot"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "C:\Users\Oleksandr Moroz\workspace\Di
ploma1\test-output\Default suite\TEST-setUp1743957154356274031.png", cmd => "cap
tureScreenshot"' : ERROR: No sessionId provided. Most likely your original newBr
owserSession command failed.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "null", cmd => "selectWindow"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "null", cmd => "selectWindow"' : ERROR
: No sessionId provided. Most likely your original newBrowserSession command fai
led.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "C:\Users\Oleksandr Moroz\workspace\Diploma1\
test-output\Default suite\TEST-selectDefaultWindow8795039411096779149.png", cmd
=> "captureScreenshot"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "C:\Users\Oleksandr Moroz\workspace\Di
ploma1\test-output\Default suite\TEST-selectDefaultWindow8795039411096779149.png
", cmd => "captureScreenshot"' : ERROR: No sessionId provided. Most likely your
original newBrowserSession command failed.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "null", cmd => "selectWindow"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "null", cmd => "selectWindow"' : ERROR
: No sessionId provided. Most likely your original newBrowserSession command fai
led.
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] INFO: Processing '1 => "C:\Users\Oleksandr Moroz\workspace\Diploma1\
test-output\Default suite\TEST-selectDefaultWindow1529599659606977600.png", cmd
=> "captureScreenshot"'
[java] ът│Є 29, 2012 6:27:09 PM com.thoughtworks.selenium.grid.hub.HubServl
et forward
[java] SEVERE: Failed to parse '1 => "C:\Users\Oleksandr Moroz\workspace\Di
ploma1\test-output\Default suite\TEST-selectDefaultWindow1529599659606977600.png
", cmd => "captureScreenshot"' : ERROR: No sessionId provided. Most likely your
original newBrowserSession command failed.
Прошу сильно не пинать. Первый раз столкнулся с подобным делом да и в тестировании вообще очень недолго, поэтому вопросы может и глупые, но все же...