Skip to content

.NET 6 LTS (C# 10), SpecFlow, RestSharp, MSTest V2, GitHub Actions

Notifications You must be signed in to change notification settings

kathyrollo/specflow-restsharp-demo

Repository files navigation

SpecFlow-RestSharp Demo

Feature File

A Scenario Outline with Examples table is used for data-driven testing.

@users
Feature: Users

	@get @listUsers
	Scenario Outline: ListUsers_FindByName_ReturnUser
		Given The list of users is requested
		When The name '<firstName>' '<lastName>' is searched
		Then The user exists

		Examples:
			| firstName | lastName |
			| Janet     | Weaver   |
			| Rachel    | Howell   |

Environment Variables

Create an env.json file under the ReqRes.Specs project.

env

{
  "BASE_URL": "https://reqres.in",
  "EMAIL": "youremail@domain.com",
  "PASSWORD": "yoursecret"
}

The file only creates runtime env vars. It is automatically ignored by Git and no sensitive data is committed to the repository.

GitHub Actions

Configuration variables and secrets are now managed at CI-level.

vars

secrets

github-actions.yml:

env:
  BASE_URL: ${{ vars.BASE_URL }}
  EMAIL: ${{ vars.EMAIL }}
  PASSWORD: ${{ secrets.PASSWORD }}

The secret PASSWORD is never exposed.

Note:

The same feature is present in all major devops products like Azure Pipelines, GitLab CI/CD, and Bitbucket Pipelines.

About

.NET 6 LTS (C# 10), SpecFlow, RestSharp, MSTest V2, GitHub Actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published