ElkArte Community

Project Support => General ElkArte discussions => Topic started by: forumsearch0r2 on October 21, 2014, 09:03:10 pm

Title: Selenium: How does it work?
Post by: forumsearch0r2 on October 21, 2014, 09:03:10 pm
I noticed that Selenium is in the dev tree now. Can anyone tell me how it works? What do I need to install, what do I need to code? My boss asked me to evaluate it for our company.
Title: Re: Selenium: How does it work?
Post by: Spuds on October 22, 2014, 09:06:32 am
We are using it to run functional browser tests with phpunit although I still can't get the code coverage reports to work.

For us its a very basic setup.  run selenium server (single .jar file) inside xvfb with firefox as the browser so a headless display setup.   PhpUnit has a selenium extension that we use as a webdriver, it sends the commands to selenium with in turn runs the browser (or browsers if you want).   You interact with Dom based syntax, byId, byName byCssSelector, click, move, etc ... and check results.   Right now its really just to test our controller interaction and results vs any true browser support.

You would not have to run it headless necessarily, or could export the display.  I'd expect you would probably use a grid setup with whatever browsers/os combo you support.  The biggest thing of course is writing all the test cases to run.
Title: Re: Selenium: How does it work?
Post by: forumsearch0r on October 22, 2014, 09:23:08 am
Well, we have two FreeBSD servers and a number of OSX clients; on the other project, it's an OSX server with the same clients.

Is there any good, ehm, tutorial for that? I'm stuck between even the different Selenium downloads.
(I hate unit tests.)
Title: Re: Selenium: How does it work?
Post by: Spuds on October 22, 2014, 10:33:14 am
I'll poke around and see if I can find any good tutorials

On way to think about selenium is its a server, like say Apache in a way.  Its a java app, so on OSx you should just be able to download the latest server and do a
Code: [Select]
java -jar selenium-server-standalone-2.24.1.jar
and it should start and be running  ... then visit
Code: [Select]
http://127.0.0.1:4444/wd/hub/static/resource/hub.html
to see status and
Code: [Select]
 http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
to turn it off.

On your *nix server you would do about the same thing, but headless or exported.  How you use it depends on what /how your testing / continuous integration is set up.  Jenkins is a popular CI choice when you have your own servers and it has a good interface to run selenium as well.  You could look for tutorials on Jenkins + Selenium or check on sauce labs.
Title: Re: Selenium: How does it work?
Post by: forumsearch0r2 on October 22, 2014, 03:27:40 pm
We use Jenkins for our Java/C++ projects internally, so maybe this would work. Still it won't for our (my :D) PHP project, right?