tun-test-automation-core v0.0.80
Installation requirements
- Node.js
- Visual Studio Code
Installation
- Clone this project/repository
- Run
npm install
in the root folder
How to execute internal tests
Gherkin tests (Web UI tests) - Command Line
Run node_modules\.bin\wdio tests\gherkin\wdio.conf.js
Mocha tests (intended for REST API integration testing) - Command Line
Run node_modules\.bin\mocha tests\Mocha\features\*.js
WDIO Configuration usage
We use the WebdriverIO cucumber test runner for when executing web tests.
The wdio
executable expects a wdio config file as first argument (as seen in the Gherkin test example above).
Tunstall internals
debug
- set this to true in order to activate WDIO debug mode
Example usage:
const debug = process.env.DEBUG;
WDIO debug documentation:
http://webdriver.io/guide/testrunner/debugging.html
http://webdriver.io/api/utility/debug.html
defaultTimeoutInterval
- the time that Selenium Webdriver will wait for an element to meet a certain state (e.g. visible, hidden)
Example usage:
const defaultTimeoutInterval = 20 * 1000;
Selector usage for WDIO web tests
All of the keyActions that are exposed for external usage require that selectors have been registered as global.selectors
at startup.
A selector is simply a HTML DOM element that is part of a browser web application. These elements can be identified in many ways, e.g. by id
, className
, cssSelector
and xpath
.
A selector can be a button, input field, a paragragh, anything that's part of a web page.
The main way of registering the selectors that we want to use is by creating a data
folder in your root project folder, followed by a selectors
folder. In this folder you may add .js
files with any name and within any folder hierarchy.
The idea of having seperate files is that you should be able to separate or structure your selector content, avoiding to have everything in one file.
Lets assume you have 1 file named home-page-selectors.js
which holds this json data:
[
{
"name" : "white submit button",
"selector" : "#whiteButton",
"text" : 'Submit'
},
{
"name" : "username field",
"selector" : "#username",
"text" : null
}
]
The files within \data\selectors
aren't magically assigned to the global.selectors
variable by itself. You simply need to make us of the dataSelectorParser.js
to make this happen.
Example implementation from an external project:
const tunstallCore = require('tun-test-automation-core');
tunstallCore.clients.web.dataSelectorParser.loadAtStartup('/path-to-/data/selector/-folder', (done) => {
console.log("global.selector setup done");
});
The above example implementation ensures that all json/selectors from the /data/selectors/
(and beyond) are parsed and concatenated into a single array of selectors - an array which is assigned to the global global.selectors
variable.
The core keyActions take selectorName
's as arguments. For instance, if we make use of the example selectors mentioned above, an implementation would look like this:
Clicking on an element:
tunstallCore.clients.web.click('white submit button');
Writing a value in an element:
tunstallCore.clients.web.write('my text', 'username field');
The methods take the "friendly" selector name as a parameter and map this to the actual element selector.
The click
will in this case pull a selector from global.selectors
that has the name white submit button
and click on its selector, #whiteButton
.
The write
function will enter the text "my text" in the #username
selector, belonging to "username field".
We make use of a "friendly name" in our selector data so that we can write gherkin tests that make sense.
A tester is able to create a test case and write Then I click on the google search button
whereas the google search button
is a dynamic parameter that exists as a selector in the project specific selector data (/data/selectors/
).
Todo list
- Add a test case that uses image comparision (Visual Regression service)
- Use Selenium Grid?
- Determine which report services to use (for Mocha and Gherkins/Cucumber)
- Add an Android App test case (Gherkins)
- Add an iOS App test case (Gherkins)
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago