Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nespresso/ntaf
Nestlé Test Automation Framework (NTAF)
https://github.com/nespresso/ntaf
automated-testing cucumberjs gherkin node-module test-automation testing wdio
Last synced: 2 months ago
JSON representation
Nestlé Test Automation Framework (NTAF)
- Host: GitHub
- URL: https://github.com/nespresso/ntaf
- Owner: nespresso
- License: mit
- Created: 2017-05-23T14:51:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-16T13:36:39.000Z (almost 6 years ago)
- Last Synced: 2024-09-30T07:43:24.035Z (3 months ago)
- Topics: automated-testing, cucumberjs, gherkin, node-module, test-automation, testing, wdio
- Language: JavaScript
- Homepage:
- Size: 781 KB
- Stars: 13
- Watchers: 6
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: License.md
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/ntaf.svg)](https://badge.fury.io/js/ntaf)
[![Build Status](https://travis-ci.org/nespresso/ntaf.svg?branch=master)](https://travis-ci.org/nespresso/ntaf)
[![Quality Gate status](https://sonarcloud.io/api/project_badges/measure?project=ntaf&metric=alert_status)](https://sonarcloud.io/dashboard?id=ntaf)# Nestlé Test Automation Framework (NTAF)
This framework is designed to help you get quickly started with test automation on any project.
It is based on [WebdriverIO](http://webdriver.io/) and [cucumber](https://cucumber.io/) ([cucumberJS](https://github.com/cucumber/cucumber-js) to be exact).
Integrating this module provides a ready-to-go environment to write and execute functional test scenarios on Google Chrome and Mozilla Firefox.
It includes:
* A template to generate your test automation project so that you don't start from a blank page
* The necessary packages pre-configured to be able to run your scenarios without requiring any other setup. The only requirement is to have a browser on the machine running the tests: either Chrome or Firefox.
* [Guidelines and good practices](https://github.com/nespresso/ntaf/blob/master/template/doc/Framework.md) to ensure great maintainability of test scenarios
* A decoupled architecture between scenarios and data sets to allow high execution scalability
* Some useful [custom browser commands](http://webdriver.io/guide/usage/customcommands.html) such as `fillInForm` to ease and accelerate test automation writing. See related [JSDoc](https://nespresso.github.io/ntaf/) for more details.This framework is suitable for big solutions that will be covered by an important number of scenarios.
Note that it requires good development skills as well as good knowledge and understanding of JavaScript.## Integrating NTAF to Your Project
### Prerequisites
* Install [npm](https://www.npmjs.com/) and [Node.js](https://nodejs.org) (latest LTS available 10.X.X version)
* Install [npx](https://www.npmjs.com/package/npx): `npm install -g npx`
* Install [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (version 8 or greater)### Adding NTAF Package and Configuration to Your Project
1. Create a new folder in your project to host your automated tests.
2. Create a new NPM project by executing `npm init`. More information about the different options [here](https://docs.npmjs.com/getting-started/using-a-package.json).
3. Install NTAF package by running the following command from : `npm install --save ntaf`. It creates a `node_modules` directory containing all the dependencies needed to run the project.
4. From , run `npx ntaf install` to generate the skeleton of your test project.### Behind a Proxy
Set the configuration of your proxy by editing the `.npmrc` file in your home directory:
```
proxy=http://localhost:3128
https-proxy=http://localhost:3128
```## Running Functional Tests
* Run `npx ntaf run` to launch the tests as they would be played remotely.
* Run `npx ntaf run wdio.local.conf.js` to run the tests with local configuration.
* Run `npx ntaf run wdio.debug.conf.js` to run the tests with debug configuration (see Running Tests in Debug Mode section
for mode details).Note that the local and debug configurations have to be generated first (see Configuration section).
### Configuration
* The global configuration is set in the `wdio.conf.js` file, in the root folder of your project.
* The local configuration is set in the `wdio.local.conf.js`. This local configuration can be reset by running
`npx ntaf generate-local-conf`.
* The debug configuration is set in the `wdio.debug.conf.js`. This debug configuration can be reset by running
`npm ntaf generate-local-conf`.### Parameters
To pass parameters to the command, add `--`: `npx ntaf run --parameter1=value1`#### URL of the Website to Test
Add command line parameter `--baseUrl="https://base.url"` or update the wdio configuration file accordingly.#### Locale
Add command line parameter `--locale="en"` or update the wdio configuration file accordingly.#### Running a Subset of Tests Using Tags
Add command line parameter `--tagExpression='@tag'`.Tags can be combined:
* `--tagExpression='@tag1 or @tag2'` runs test tagged with `@tag1` or `@tag2`
* `--tagExpression='@tag1 and @tag2'` runs test tagged with both `@tag1` and `@tag2`
* `--tagExpression='not @tag1'` runs tests not tagged with `@tag1`See [Cucumber Tag Expressions documentation](https://docs.cucumber.io/cucumber/api/#tag-expressions) for more details.
#### Realm (market, brand, environment, ...)
A realm is a configuration file that defines some wdio properties specific to a realm. A realm can be seen as a market,
a brand, an environment (such as dev or staging), etc. or a combination of them. Realm files are stored in the
`conf/realm` directory.Usually realms define at least the following properties:
* `baseUrl`: website to test
* `specs`: list of features to runAdd command line parameter `--realm="xxx"`. Where `xxx` is the file name in `conf/real` without the `.js` extension.
For example:
* To run NRT tests from the catalog domain on mywebsite.com: `npx ntaf run --baseUrl="https://mywebsite.com" --tagExpression='@nrt and @catalog'`
* To run NRT tests on realm `us-dev`: `npx ntaf run --realm="us-dev" --tagExpression='@nrt'`## Running Functional Tests in Debug Mode
For IntelliJ, follow instructions at [Debug with Chrome Debugging Protocol](https://www.jetbrains.com/help/idea/running-and-debugging-node-js.html#ws_node_debug_remote_chrome).
At step #4, run `npx ntaf run wdio.debug.conf.js`## Running Unit Tests
* Run `npx ntaf test-unit` to run unit tests
* Run `npx ntaf test-unit-with-coverage` to run unit tests with code coverage computation## Writing Automated Tests
Read detailed explanations in [Framework.md](https://github.com/nespresso/ntaf/blob/master/template/doc/Framework.md).