selenium - automated browser-based testing -
DESCRIPTION
A presentation for Hiruben at atWare, Inc.TRANSCRIPT
Selenium- automated browser-based testing -
KOMATSU Seiji (comutt)atWare, Inc.
September 21, 2012
What is Selenium?
Automates browser
Testing feature(element assertion, etc)
Selenium IDEsupported on Firefox
Other browsers are supported for testing
UI Testing
Logic testing doesn’t cover UI
Web application’s UI is browsers
It’s not easy to testing with browsers
With Selenium
Testable with Browsers
Test cases can be written in:Java, C#, Ruby, Python, etc
Using CI,UI becomes testable continuously
Architecture
Selenium 2.0
WebDriver
A driver, which is run by a Client Driver
Client Driver
Test drivers, implemented in some languages (Java, C#, Python, etc)
Architecture
Browser
WebDriverplugin
Client Driver( library )
Selenium IDE
Drive a browser directly from a client
Architecture
Browser
WebDriverplugin
Client Driver( library )
Selenium IDE
Drive a browser from Selenium Server
SeleniumServer
( java daemon )
RemoteWebDriver
Selenium IDE
Firefox Plugin
Available at Downloads
Here
Get Selenium IDEAll plugins installed at once
Got Selenium IDE
Now you can run Selenium IDE
Recording Mode
Selenium IDE has a recording mode
Recording mode:ON
Recording mode:OFF
Be Careful
If recording mode on:
All actions recorded automatically
May be an accident,if the mode is on by mistake
Otherwise:
No actions recorded automatically
Let’s Record
To record, turn on the recording mode
You only do browsing,same as when you browse normally
Demonstration
Twitter login/tweet/logout test
01. recording
02. fail with missing element
03. fix the element
04. captcha error
05. mostly success, except tweeting
To JUnit Test Case
It’s easy to convert to JUnit Test Case, or other formats.
Enable the feature,[Options]-[Options]-[Enable experimental features]
To convert,[Options]-[Format]-[What a format you want]
GotJUnit Test Case
As a result:
Other Ways
Copy directly to clipboard:[Options]-[Clipboard Format]-[What a format you want]
Export as a file:[File]-[Export Test Case As...]-[What a format you want]
Architecture Comparison
It takes about a minute to run test
As I investigated,class loading is a little slow
Browser
Client Driver( library )
WebDriverplugin
Selenium IDE
Architecture Comparison
Required that the server is ready
It takes rather a half time than without the server
Browser
WebDriverplugin
Client Driver( library )
Selenium IDE
SeleniumServer
( java daemon )
RemoteWebDriver
Conclusion
UI testing is complex,so the maintenance is not easy
Suggest that test the critical patterns
Login/Logout, and any othervery important features
Powerful to prevent the regression