Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Selenium + PHP, jak zacząć
Olimpia_ona
post
Post #1





Grupa: Zarejestrowani
Postów: 71
Pomógł: 2
Dołączył: 10.03.2005
Skąd: Elbląg

Ostrzeżenie: (0%)
-----


Witam, czy ktoś z Was pisał testy w selenium za pomocą PHP?

Mam zainstalowane selenium IDE, nagrany test, wyeksportowany do PHP. Uruchomiłam serwer Selenium RC i apacha (na xampp).
W wyeksportowanych plikach mam takie odniesienie:
1. require_once 'Testing/Selenium.php';

ale nigdzie na dysku nie mam takiego pliku jak Selenium.php

Mam też drugi plik wyeksportowany do PHP (PHPUnit), a w nim:

2. class Example extends PHPUnit_Extensions_SeleniumTestCase

po uruchomieniu dostaję komunikat:
Fatal error: Class 'PHPUnit_Extensions_SeleniumTestCase' not found

Czy ktoś może mi pomóc? Jak przygotować środowisko do testów selenium w php?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Olimpia_ona
post
Post #2





Grupa: Zarejestrowani
Postów: 71
Pomógł: 2
Dołączył: 10.03.2005
Skąd: Elbląg

Ostrzeżenie: (0%)
-----


(IMG:style_emoticons/default/smile.gif) to mam (chyba), bo mam już w katalogu

C:\xampp\php\PEAR\PHPUnit\Extensions\ pliki typu: Selenium2TestCase.php, SeleniumBrowserSuite.php itd.

mam już również

C:\xampp\php\PEAR\Testing a w nim Selenium.php

pliki wyeksportowane z Selenium IDE mam na D:\htdocs\selenium (tak mam ustawiony serwer, że pliki php uruchamiam np. http://localhost:8080/selenium/phplog.php)

jednak po uruchomieniu pliku phplog.php
  1. <?php
  2.  
  3. require_once 'Testing/Selenium.php';
  4.  
  5. class Example extends PHPUnit_Framework_TestCase
  6. {
  7. protected function setUp()
  8. {
  9. $this = new Testing_Selenium("*chrome", "http://172.18.96.34:8020/");
  10. $this->open("/");
  11. $this->type("id=dnn_ctr597_Login_Login_DNN_txtUsername", "syshost");
  12. $this->type("id=dnn_ctr597_Login_Login_DNN_txtPassword", "mojehaslo");
  13. $this->click("id=dnn_ctr597_Login_Login_DNN_cmdLogin");
  14. $this->waitForPageToLoad("30000");
  15. $this->assertEquals("Wyloguj", $this->getText("id=dnn_dnnLOGIN_loginLink"));
  16. }
  17. }
  18. ?>


dostaję komunikat: Fatal error: Cannot re-assign $this in D:\htdocs\selenium\phplog.php on line 10

po uruchomieniu pliku phplogunit.php

  1. <?php
  2.  
  3. class Example extends PHPUnit_Extensions_SeleniumTestCase
  4. {
  5. protected function setUp()
  6. {
  7. $this->setBrowser("*chrome");
  8. $this->setBrowserUrl("http://172.18.96.34:8020/");
  9. }
  10.  
  11. public function testMyTestCase()
  12. {
  13. $this->open("/");
  14. $this->type("id=dnn_ctr597_Login_Login_DNN_txtUsername", "syshost");
  15. $this->type("id=dnn_ctr597_Login_Login_DNN_txtPassword", "mojehaslo");
  16. $this->click("id=dnn_ctr597_Login_Login_DNN_cmdLogin");
  17. $this->waitForPageToLoad("30000");
  18. $this->assertEquals("Wyloguj", $this->getText("id=dnn_dnnLOGIN_loginLink"));
  19. }
  20. }
  21.  
  22.  
  23. ?>


dostaję komunikat: Fatal error: Class 'PHPUnit_Extensions_SeleniumTestCase' not found in D:\htdocs\selenium\phplogunit.php on line 3

i właśnie nie wiem, jakie pliki gdzie powinnam przerzucić, by to działało.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 04:02