Dieses Blog durchsuchen

Freitag, 5. August 2016

Selenium 3 and phpunit with facebooks webdriver

Today, we want to extend our simple test, in wichh we have loaded a page and compared its title,  to a litte more comlex test.

If you do not have the prerequisits installed, you can follow the previous tutorial here:
http://magento2-tuts.blogspot.de/2016/08/phpunit-simple-tests-with-selenium.html





Our goal for today is to:

1) Setup and configure the webdriver, so that all tests are running in Firefox and chrome.

2) execute our test which fills a searchform and submits it to the server. Gets the searchresult and schecks the result for a specific string

3) closes the connection to the webdriver

4) quits the browser.

sounds interresting or?


Lets start with the setup:

As you can see in the setUp() method, the driver gets simply configured. You can setup a list with browsers, which are used for testing by the webdriver.


Lets repeat a simple test.
This test will only load the page and search for a String "GitHub" 


Lets make an automated search.
The next test will automaticly search the searchfield and type i  a serachterm
After that the result gets parsed for the searchstring and gets sserted for it


 
At last we want to sutdown the webdriverconnection and close the window

Thats it. Both tests are green,

You can download  the code here:
https://github.com/pboethig/unittest



Keine Kommentare:

Kommentar veröffentlichen