A framework that helps you build your e2e tests more easily using the BDD style
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 information
Please see our wiki DOCs for more details.
These instructions will give you a sample feature file to show you how easy is to make your own tests
Before continue, check that you have completed the following requirements:
nodejs
project and add walnutjs to it:
mkdir my-app && cd my-app
npm init -y
npm i --save walnutjs
walnut-config.js
file inside rootFolder based on this file > my-app
> test
> features
sample.feature
> step-defs
custom-steps.js
> locators
locators.json
> params
params.json
You can create these folders above on your own, just be sure to indicate the correct paths inside
walnut-config.js
file.
locators.json
file:
{
"containers":[
{
"name": "GoogleHome",
"locators":[
{ "key": "SearchInput", "type": "name", "value": "q" },
{ "key": "SearchButton", "type": "p:xpath", "value": "//input[@value='{0}']" }
]
}
]
}
sample.feature
file:
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'
selenium webserver
was started correctly. For this sample we will use webdriver-manager
webdriver-manager start
...
10:15:57.230 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
package.json
:
"scripts": {
"start": "walnut",
}
npm start
You can also run using
$(npm bin)/walnut
on your terminal
Review this project boilerplate to get more insights and this documentation to see more details.
Just run the following command inside the root folder:
npm run test
npm run coverage
See also the list of contributors who participated in this project.
This project is licensed under the MIT License.