Wiki Spaces
Documentation
Projects
Resources
Get Help from Others
Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack
QAFramework is an OpenMRS’ behaviour driven development (BDD) quality assurance framework.
BDD brings technical(developers, QA) together with business(non-technical, Business analysts) people to foster collaboration and ease problem-solving.
QAFramework uses cucumber for its BDD test case descriptions;
BDD largely uses a simple domain-specific natural language (DSL) to represent the test cases cucumber specifically uses Gherkin for this.
In addition to the clear guidance below, you can see this recording for a tutorial we hosted on setting up Selenium tests for the Reference Application: https://iu.mediaspace.kaltura.com/media/Design+Meeting/1_dh12nkr0?st=321
A demo on how automated tests are carried out can be accessed at https://www.youtube.com/watch?v=XzBAXMj1UN0
A demo for Workflow Based Testing using BDD framework: https://www.youtube.com/watch?v=Wl_KHd11Hyo
GitHub repo from example in Tutorial: https://github.com/openmrs/openmrs-contrib-qaframework/pull/9
10-Min Overview for Technical Steps When Developing a Test in BDD Framework
Install java8, git and maven
QAFramework should be followed when building qaframework
1. Run QAFramework
git clone git@github.com:openmrs/openmrs-contrib-qaframework.git Install project dependencies
|
In order to test within a real desktop browser, you will need a webdriver to connect to your browser (either firefox or chrome).
Properties explanation:
webapp.url=https://qa-refapp.openmrs.org/openmrs [openmrs instance URL] login.username=admin [Above OpenMRS instance username] login.password=Admin123 [Above OpenMRS instance password] login.location=Pharmacy [Above OpenMRS instance login location] webdriver=chrome [Browser instance; chrome/firefox] login.auto=false [Auto login or not on each scenario; true/false] headless=true [Launch browser in the background without UI; true/false] webdriver.chrome.driver=chromedriver/mac/chromedriver |
Tracked projects status
https://github.com/openmrs/openmrs-contrib-qaframework#project-status
How to test different projects
https://github.com/openmrs/openmrs-contrib-qaframework#openmrs-contrib-qaframework
How to run locally tests for 2.x Reference Application
For BDD workflow tests i. Ensure to have done step one in Setup wizard above
ii. Navigate into qaframework-bdd-tests module. iii. See the list of test workflows present in the module by running the command: iv.Trigger any test workflow by running the command: For example a workflow whose name is Note: If you want to watch the test via UI then set headless property value within test.properties file to false. For selenium legacy tests i. Ensure to have done step one in Setup wizard above
ii. Navigate into qaframework-legacy-tests module
iii. Trigger the selenium legacy tests by running the command: instance. So you can change the |
How to run locally tests for 3.x Reference Application
i. Ensure to have done step one in Setup wizard above ii. Navigate into qaframework-bdd-tests module
iii. Install the dependencies required to run the tests by running the command: iv.Trigger 3.x tests by running the command: Note: See a list of registered commands that can trigger specific test workflow by running the command: Example How to Update Node version Check the current version you have: npm -v Clear npm cache
or you can simply use
|
How to run locally tests for Dictionary Manager
i. git clone https://github.com/openmrs/openmrs-ocl-client ii. Install the dependencies required to run the tests by running the command: iii.Trigger ocl tests by running this command: |
Infrastructure
No results were found for groups : CTGCHG
Collaboratively, business analysts translate requirements into test cases and define from them features, scenarios, steps written in a Behavior Driven Development (BDD) approach through a human readable language; Gherkin, this is made easier graphically through cucumber studio.
Exporting the project from cucumber studio for automation avails a feature file with the human readable test case which file can be written from any texteditor and which is imported into the automation library (qaframework) and an automation layer (with step descriptions) is written by a test engineer or developer through a preferred automation framework such as selenium (for the reference application), cypress (OCL) etc.
Running the QA framework locally or in Bamboo CI runs the automated test suite;
- this will read test.properties and launch RunTest.java(junit with cucumber runner) with the loaded configurations which reads all feature files tagged @run and locates each respective step description from mapped (glued) automation package,
- automation steps launch the automation framework (e.g selenium/cypress) by scenario and each scenarios by step order, steps load pages (some are from uitestframework/distribution/qaframework) and return results to the build through its web driver
- the build posts test results to reports.cucumber.io if configured to in cucumber.properties which happens by default within bamboo CI
- Bamboo CI is also configured to post results back into cucumber studio and a result green/red label (build status) is displayed on qaframework basing on CI build result.
Below is a sample tutorial to help ease understanding the structure of feature files, page and step definitions
A feature file is written in a human readable gherkin BDD language, cucumber runs the feature files in their naming alphabetical order.
A simple feature file consists of the following keywords/parts −
Feature − Name of the feature under test.
Description (optional) − Description about feature under test.
Scenario − A test case, each action within a scenario is called a Step and each step is preceded with Given/When/Then/And keywords.
Given − Defines the initial action or/and known system state, it is a prerequisite before the test steps get executed.
When − Specific condition which should match in order to execute the next step.
Then − A verification of the condition above through evaluation of the system response.
An html page structure containing references to DOM elements as well as expected user actions such as clicking, navigation, typing etc
An implementation of the actual functionality of each step within the feature file consuming the page to emulate a complete user system workflow. Each Step class contains all the scenario steps for the respective feature file
Guidelines of Writing/Extending Each Test classes
https://issues.openmrs.org/secure/RapidBoard.jspa?rapidView=240&useStoredSettings=true
Sometimes your added web driver may not be executable if you are running the IDE vs maven which auto makes that so when building. ensure you always manually make it executable to avoid the server quitting before launching.