Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grpc-cucumber-js

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-cucumber-js

Gherkin framework for gRPC API cucumber-js testing

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by42.86%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status npm version


grpc testing framework for cucumber.js

Inspired by handy libraries for testing REST APIs like apickli or relish, this package gives a basic start for cucumber testing against a gRPC service.

Basic Start

Install with your usual tool via yarn add grpc-cucumber-js or npm install grpc-cucumber-js. Then you need to initialize the library to your gprc API in a Before cucumber event. A good example of a basic set up can be found in test/features/support/init.js.

Built-in Gherkin Expressions

The following gherkin expressions are available within the framework source/grpcucumber-steps.js:

GIVEN:
	I set request message to (.*)
	I set request message to
	    | name | value |
	    | | |
	I set request metadata to (.*)
	I set request metadata to
	    | name | value |
	    | | |
	I pipe contents of file (.*) to request message
	I store the raw value (.*) as (.*) in scenario scope
	I store the raw value (.*) as (.*) in global scope

WHEN:
	I request (.*)

THEN:
	I store the value of response message path (.*) as (.*) in global scope
	response message path (.*) should be (((?!of type).*))
	response message path (.*) should not be (((?!of type).+))
	response message path (.*) should be of type array
	response message path (.*) should be of type array with length (.*)
	value of scenario variable (.*) should be (.*)
	value of scenario variable (.*) should not be (.*)
	value of global variable (.*) should be (.*)
	value of global variable (.*) should not be (.*)

Variable Interpolation

Variables are available to inject stored values into messages or steps.

By default, backticks are use to indicate a variable in a feature file, but can be changed during initialization (first char is open, second is close):

Before(function() {
    this.grpcucumber = new grpcucumber.grpcucumber(
		'localhost:8080', 
		PROTO_PATH, 
		'Greeter', 
		credentials, 
		{ variableDelimiter: '{}' }
	);
});

Quick commands

FunctionCommand
Run mock serveryarn run mock
Run tests (run mock first)yarn run test
Run lintyarn run lint

Contributing to grpc-cucumber-js

We welcome Your interest in Capital One’s Open Source Projects (the “Project”). Any Contributor to the Project must accept and sign an Agreement indicating agreement to the license terms below. Except for the license granted in this Agreement to Capital One and to recipients of software distributed by Capital One, You reserve all right, title, and interest in and to Your Contributions; this Agreement does not impact Your rights to use Your own Contributions for any other purpose.

Sign the Individual Agreement

Sign the Corporate Agreement

Code of Conduct

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.

Keywords

FAQs

Package last updated on 21 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc