Table of Contents

Class TeaPie

Namespace
TeaPie
Assembly
TeaPie.dll
public sealed class TeaPie
Inheritance
TeaPie
Inherited Members
Extension Methods

Properties

ApplicationContext

public IApplicationContext ApplicationContext { get; }

Property Value

IApplicationContext

CollectionVariables

public VariablesCollection CollectionVariables { get; }

Property Value

VariablesCollection

EnvironmentVariables

public VariablesCollection EnvironmentVariables { get; }

Property Value

VariablesCollection

GlobalVariables

public VariablesCollection GlobalVariables { get; }

Property Value

VariablesCollection

Instance

public static TeaPie? Instance { get; }

Property Value

TeaPie

Logger

public ILogger Logger { get; }

Property Value

ILogger

Request

The most recently executed HTTP request.

public HttpRequestMessage? Request { get; }

Property Value

HttpRequestMessage

Requests

Collection of current test case's HTTP requests accessible by names.

public IReadOnlyDictionary<string, HttpRequestMessage> Requests { get; }

Property Value

IReadOnlyDictionary<string, HttpRequestMessage>

Response

The most recently retrieved HTTP response.

public HttpResponseMessage? Response { get; }

Property Value

HttpResponseMessage

Responses

Collection of current test case's HTTP responses accessible by names.

public IReadOnlyDictionary<string, HttpResponseMessage> Responses { get; }

Property Value

IReadOnlyDictionary<string, HttpResponseMessage>

TestCaseVariables

public VariablesCollection TestCaseVariables { get; }

Property Value

VariablesCollection

Methods

Exit(int, string?)

public void Exit(int exitCode = 0, string? reason = null)

Parameters

exitCode int
reason string

GetHttpClient(string?)

public HttpClient GetHttpClient(string? name = null)

Parameters

name string

Returns

HttpClient

GetVariable<T>(string, T?)

Attempts to retrieve the first matching variable with the specified name of type T. If no such variable is found, the defaultValue is returned. Variables are searched across all levels in the following order: TestCaseVariables, CollectionVariables, EnvironmentVariables, GlobalVariables.

public T? GetVariable<T>(string name, T? defaultValue = default)

Parameters

name string

The name of the variable to retrieve.

defaultValue T

The value to return if no variable with the specified name and T type is found.

Returns

T

The variable with the specified name of type T, or defaultValue if no matching variable is found.

Type Parameters

T

The type of the variable to retrieve.

SetEnvironment(string)

Set environment to one with given name. Environment must be defined in the environment file.

public void SetEnvironment(string name)

Parameters

name string

Name of the environment to be set.

SetVariable<T>(string, T, params string[])

Stores a variable with the specified name of type T at the Collection level. The variable is tagged with the specified tags, which are optional.

public void SetVariable<T>(string name, T value, params string[] tags)

Parameters

name string

The name under which the variable will be stored.

value T

The value of the variable to store.

tags string[]

An optional list of tags associated with the variable.

Type Parameters

T

The type of the variable to store.