0.1.19 • Published 2 years ago

autobahn-core v0.1.19

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Introduction

Autobahn is a BDD framework for performing API & Browser tests via testcafe, supertest & newman. The main goal is to provide a structured folder structure & make it easier to implement within a CI/CD pipeline.

Features

  • Gherkin/Cucumber integration
  • Read browser console output along with api request and responses in debug mode
  • Automatic replacement of application configuration item values (for use with secrets on a CI/CD pipeline)
  • API testing support through supertest & gherkin or newman if preferred :)
  • Generate code such as step definitions & page object models

Getting started

First add the dependency to your project npm i autobahn-core

make sure you are running with typescript version >=4.5.5

in the scripts property of your package.json file add the following:

"generate": "autobahn generate"

Then run the script (npm run generate). On the first run it will ask you to create a project config file. Doing this will also generate the basic folder structure.

After that generate your first project config :) Also feel free to check out the Examples folder to get a head start.

Using the framework:

CLI usage:

Generator

autobahn generate

A wizard will appear and guide you through the test file generation process.

Running Tests

autobahn [...Options]

note: any TestCafe specific CLI options not stated below will be passed through, and processed as normal.

ParameterDescriptionType
Mandatory Parameters
-p,--productthe 'product' name to test againststring
-e, --environmentthe environment to test againststring
General Parameters
--helpShow helpboolean
--versionShows the version/build number number of the frameworkboolean
-d, --debugRun the framework with verbose logging; this will also print browser console statements, api requests & responsesboolean, default: false
-h, --headlessRuns the browser(s) in headless modeboolean
-b, --cacheSets whether browser caching should be enableedboolean, default: false
--retry-test-pagesIf this option is enabled, testcaf retries failed neetwork requests for webpages during the test run. This is limited to 10 attemptsboolean, default: true
-c, --ptsets the number of concurrent/parallel threads the test run should usenumber
-s, --saveReportSaves the files for the configured report typesboolean, default: false
-r, --browserReportsOverrides the configured reports with the provided valuestring
Test Filters
-t, --tagsSets the tags to filter tests against, multiple tag values can be provided by separating the values by pipe | do not include the @ symbol in front of each tag namestring
-f, --filterTestSets the filter to use for the test run. You can provide a fixtureName (Feature name) and/or testName (Scenario/Scenario outline name) regexp. e.g. --filterTest="testName='(.*)I can prerform a search' | fixtureName='(.*)Google'" Filters tests by test name and/or fixture name. Provided parameters are pipe separated. You do not need to provide both testName='(.*)' and fixtureName='(.*)' one or the other can be sufficient. Regex patterns are supported. In the example provided, tests are filtered to only run tests with a name ending in 'Gas Quote' from a feature file with the Feature name ending in 'Quoting Feature'string

Building the repo locally

NPM: npm i -g verdaccio gulp nodemon

Verdaccio is a tool that creaetes a local NPM registry; this can be used to test the package without having to publish to the public registry.

npm i

For versioning, install the GitVersion dotnet tool: dotnet tool install --global GitVersion.Tool --version 5.*

Build and Test

Building and testing can be performed by running: npm run ci

Contribute

Always happy to have contributions & feedback for the project :-)

The release branch for this repository is main, code should first have it's own branch then merged into develop

Please also check our Code Of Conduct

Other noteworthy projects and resources

These are other projects and resources that may come in handy:

  • Arthy000/gherkin-testcafe - Another gherkin framework for browser/integration testing with testcafe

  • Cucumber (Gherkin) Autocomplete - VS Code extension; Provides Gherkin support and can be configured to navigate to step definitions.

    • Example settings.json snnippet:
      "cucumberautocomplete.steps": [
          "./src/**/steps/**/*.ts",
      ],
      "cucumberautocomplete.syncfeatures": "./src/**/specs/**/*.feature",
      "cucumberautocomplete.strictGherkinCompletion": false,
      "cucumberautocomplete.strictGherkinValidation": false,
      "cucumberautocomplete.smartSnippets": true,
      "cucumberautocomplete.stepsInvariants": true,
  • TestCafe Documentation

  • Supertest Documentation
  • Newman Documentation