Selenium Test Design
Purpose:
This document outlines the current overall design of the Selenium Testing Suite. This document is meant to give insight on what classes, objects, structures, etc. are meant to do and briefly explains their intended purpose. This document is subject to change as further progress ensues and new issues arise.
Running Selenium tests in a headless environment
After you’ve installed xvfb (apt-get install xvfb), in Terminal (Ubuntu) enter the following commands:
Creating Javadocs
In order to create the javadocs associated with the files run the following commands:
Now in your directory browser go to:
Java Object Design
Test Suite
Uses the @RunWith and @SuiteClasses to define which tests should be run
@BeforeClass
{
insert data using hibernate in order to ensure data for OMD Tests as we can not guarantee that the functional tests will run before OMD tests or that they will succeed (Note: in order to do this, we will need to be able to remotely access the MySQL server for the OSCAR instance we’re testing against.)
these will NOT be tests just normal functions and they will be inside a try catch block (This occurs because tests cannot be run from the BeforeClass while having maven track them but also because this has restrictions with java’s static methods)
separate insertions into different try catch blocks (insert demographic/provider)
initialize the config
}
@AfterClass
{
clean-up - use hibernate to eliminate specific sets of data defined by the config file
}
Tests
src/test/java - org.oscarehr.selenium.functionaltests
@BeforeClass
{
initialize driver and profile
}
@Rule
ScreenshotRule();
applies a test watcher on the driver instance that captures a screenshot of failed tests
Is responsible for logout procedure
@Before
{
Load necessary page objects in order to get to navigate to the page you want
}
@Test
{
Call a get on the page you want
Call the necessary page methods in order to execute the tests
}
@AfterClass
{
quit the driver
}
Page Objects
src/main/java - org.oscarehr.selenium.pages
isLoaded() {
checks correct URL
checks for an element on the page
}
Load() {
knows how to navigate to itself from the parent page
}
functions() {
the individual page’s elements should be referenced here
these functions are called by the tests in order to perform what is necessary
}
Config.java and Connection_Config.java
src/main/java - org.oscarehr.selenium.resources
Contains getters and setters for all necessary data entries (appointments, providers, demographics)
load() {
reads the XML file and inputs data to the beans
}
save() {
ability to input new data entries into the XML file
}
config.xml
home directory
holds all information necessary for providers,demographics,appointments etc.
connection_config.xml
home directory
holds all connection information necessary for the test (Base URL, Timeout Length)
Bean (AppointmentDetails, LoginCredentials, etc.)
src/main/java - org.oscarehr.selenium.resources
holds the structural data for the specified information type
PageUtils
src/main/java - org.oscarehr.selenium.resources
contains generic commands use through the testing suite
anything placed in here should be generic and not contain any data types that are unique to a test case