Code Monkey home page Code Monkey logo

specflowwebapihelpers's Introduction

SpecflowWebApiHelpers

This is a reusable library for creating reusable specflow steps.

It is using xunit as the unit testing framework.

At the moment it is targeting testing any webapi.

It currently has the following steps:

###1) Setting the host and port:

"Given I make a new request to on port "

###2) Setting the path of the url:

"Given the path is "

###3) Adding a dynamic fieldset of query parameters to the query string:

"Given I add the following fields as query parameters" (add table)

###4) Invoking the actual http request:

"When the request has compeleted"

###5) Giving a basic test on the status code returned:

"Then the status code should be "

##Using these steps in your own scenarioss To use this with your own scenarios e.g. test the response body etc, the http response is available in the "ScenarioContext" in the form of a "HttpResponseMessage".

To retrieve the response from the context, use the following code:

var response = ScenarioContext.Current.Get<HttpResponseMessage>(CURRENTRESPONSE);

SpecflowWebApiHelpers - Example

Feature: HttpFeature
	In order to make an http request
	As a webapi tester
	I want to be able to call the webapi generically in all my tests
	

Scenario: Test HTTP call
	Given I make a new request to www.google.com on port 9999
	And the path is api/googlepath
	And I add the following fields as query parameters
	| key   | value         |
	| A   | ValueA            |
	| B   | ValueB |
	| C | ValueC       |
	When the request has compeleted
	Then the status code should be 200
	

specflowwebapihelpers's People

Contributors

thedavejay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.