Selenium Testing
Selenium Testing
Selenium Testing
SELENIUM TESTING
OLAT
SELENIUM TESTING
Objectives:
Overview testing
What is Selenium Testing Framework? OLAT Selenium Testing Framework. What is this, why do we need it? Testing Workflow in OLAT
OLAT
SELENIUM TESTING
1. Testing in OLAT
the well known JUnit test classes from olat3/webapp/WEB-INF/test/java, triggered by the nightly process
Black box load Testing JMeter (e.g. Enroll, Download, Start Courses, etc.)
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
(http://seleniumhq.org/projects/core/reference.html ,chrome://selenium-ide/content/ui-doc.html)
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
Firefox
javascript
Selenium Java JUnit Test Class controls the browsers via the RC Server
OLAT
SELENIUM TESTING
(continues)
Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC comes in two parts: 1. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. That is, the Selenium Server is acting as a client-configured proxy for the browser that you automatically started with "getNewBrowserSession". Specifically, it configures your browser to use the Selenium Server as a proxy in its browser preferences. 2.
(http://seleniumhq.org/projects/remote-control/)
The RC server also bundles Selenium Core, and automatically loads it into the browser. By default, Selenium looks for a file called "user-extensions.js", and loads the javascript code found in that file. This file provides a convenient location for adding extensions to Selenium, like new actions, checks and locator-strategies, without needing to modify the core Selenium sources.
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
Firefox
Selenium IDE
javascript
Selenium Java JUnit Test Class controls the browsers via the RC Server
OLAT
SELENIUM TESTING
Links: - http://seleniumhq.org/projects/ide/
OLAT
SELENIUM TESTING
Enable UI-Element
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
OLAT Context
(context.xml)
ui-map xml files XPaths as UI Locators ant gen_olat-ui-map OLAT Testing Framework Selenium independent
user-extensions.js
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
(continues)
Is has the role to decouple the test cases from the selenium (com.thoughtworks.selenium Selenium) implementation. It is designed as an hierarchical object model with a OLATWorkflowHelper instance as root, acquired via the Context class. From the test developer point of view an OLATWorkflowHelper instance incapsulates the services offered by a just logged in OLAT. Motivation: increasing the code reuse and maintainability of tests classes. Related reading: Webdrivers Page Objects
http://code.google.com/p/webdriver/wiki/PageObjects
Open Problems Language dependent UI locators. The UI locators are language dependent which is very inconvenient. It would have been better if the UI locators could use IDs or names but this is not possible in OLAT. We must find a solution to make the UI locators language independent.
OLAT
SELENIUM TESTING
Create new test class and test it locally. If OK, CVS commit.
The local test setup must be defined into the customcontext.xml (this overwrites the defaultcontext.xml)
Test results evaluation each tests run generates a JUnit report as an html doc. The
test result report contains the list with the errors or failures, if any. The System.out from JUnit report contains all the info for debugging an error/failure. An error/failure in a new commited class must be fixed by the author. If an error/failure occurs in an old test class than it is Lavinias responsability to fix the problem.
OLAT
SELENIUM TESTING
(continues)
Results evaluation
OLAT
SELENIUM TESTING
use the org.olat.test.util.setup.context.Context class for the test setup use the selenium (com.thoughtworks.selenium.Selenium) instances, got via the Context, directly. Based on OLAT application abstraction layer (e.g. org.olat.test.demo.SeleniumDemo1Test) get an org.olat.test.util.selenium.olatapi.OLATWorkflowHelper via the Context class. develop the test case based on the olatapi package.
OLAT
SELENIUM TESTING
cron
HTTP
- rebuilds & restarts several times - runs the selenium tests javascript
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
Translation Issue encountered. Well, title says it all. Our seleniums test fails if the string
'translation::::' occurs anywhere.
ERROR: Element ui learningResources::content_clickLearningResource(nameOfLearningResourc e=resourceName) not found. This means that your test expects a course to be there but it can't find it.
OLAT
SELENIUM TESTING
5. Tools
Firebug as Firefox add-on, for support with the XPath detection.
(https://addons.mozilla.org/de/firefox/addon/1843)
OLAT
SELENIUM TESTING
OLAT Selenium Mitarbeit Melden bei "Kristina Isacson fr Organisation <kristina.isacson@id.uzh.ch> OLAT JUnit Testcases schreiben Bug Reports mit Selenium Testcase versehen
OLAT
SELENIUM TESTING
Run the SeleniumServer. So we have a running selenium RC server! Install the Selenium IDE, in Firefox (download at http://seleniumhq.org/projects/ide/). Go to 'Tools'>'Selenium IDE' to launch the tool in Firefox after install. Add the user-extensions.js to the Selenium IDE, by going to Selenium IDE/Options/Options.../General/Selenium Core extensions/ browse and add the previously generated file (...user-extensions.js). AND select 'Enable UI-Element' and then restart Selenium IDE.
OLAT
SELENIUM TESTING
OLAT
SELENIUM TESTING
Run test from eclipse, as JUnit. Your class should look like: org.olat.test.demo.SeleniumDemo1Test.java.