walnutjs v2.0.3
walnutjs
walnutjs is a collection of generic steps for interact with web-applications.
You can easily simulate user interactions using a business-readable way. You only need to write some feature files using the Gherkin syntax and plan your tests with BDD (Behavior Driven Development) pattern.
Enjoy It!
Usage: walnut [options]
Walnut Framework - Automated BDD Tests for Web Applications
Options:
-V, --version output the version number
-c, --config <path> path to JSON config file
-t, --tags <tagName> name of tag to run (default: [])
-m, --execMethod <method> execution method [e.g runOnlyAPI]
-h, --help output usage informationPlease see our wiki DOCs for more details.
Getting Started
These instructions will give you a sample feature file to show you how easy is to make your own tests
Prerequisites
Before continue, check that you have completed the following requirements:
- java - Java runtime environment - tested on 1.8.0_211
- nodejs - A javascript runtime - tested on v10.16.0
- selenium webserver:
- webdriver-manager - A selenium server and browser driver manager.
- zalenium - A flexible and scalable selenium grid.
Setup the project
- Start by creating a simple
nodejsproject and add walnutjs to it:mkdir my-app && cd my-app npm init -y npm i --save walnutjs - Setting up a
walnut-config.jsfile inside rootFolder based on this file - Create a folder structure like that:
> my-app > test > features sample.feature > step-defs custom-steps.js > locators locators.json > params params.jsonYou can create these folders above on your own, just be sure to indicate the correct paths inside
walnut-config.jsfile. - Add the folowing content to
locators.jsonfile:{ "containers":[ { "name": "GoogleHome", "locators":[ { "key": "SearchInput", "type": "name", "value": "q" }, { "key": "SearchButton", "type": "p:xpath", "value": "//input[@value='{0}']" } ] } ] } Add the following content to
sample.featurefile:Feature: First test with walnutjs @simple_web Scenario: I want see the Google Page Given user navigates to 'http://www.google.com' When user fills 'GoogleHome-SearchInput' by replacing text with 'led zeppelin wikipedia' And user clicks on 'GoogleResult-SearchButton'Before execution check that
selenium webserverwas started correctly. For this sample we will usewebdriver-managerwebdriver-manager start ... 10:15:57.230 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444Define a single start script in your
package.json:"scripts": { "start": "walnut", }- Execute your script
npm startYou can also run using
$(npm bin)/walnuton your terminal
More details
Review this project boilerplate to get more insights and this documentation to see more details.
Running the tests
Just run the following command inside the root folder:
- test:
npm run test - coverage:
npm run coverage
Built With
- nodejs - A JavaScript runtime
- cucumber - tool for running automated tests written in plain language
- selenium-webdriver - The official Webdriver Javascript bindings from the Selenium project.
Authors
- Marcio Mendes - Initial work - mmendesas
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License.
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
