Table of Contents

Class TestGenerationOptions

Namespace
Microsoft.Accordant
Assembly
Accordant.Operations.dll

This class contains options and configurations used during the test case generation process.

public class TestGenerationOptions
Inheritance
TestGenerationOptions
Inherited Members

Properties

ApplyOperationsRepeatedly

This configures the ShouldPreserveOperation lambda such that no operation is applied more than once. This property does not have a getter. If you want more flexibility, consider specifying the ShouldPreserveOperation lambda directly.

public bool ApplyOperationsRepeatedly { set; }

Property Value

bool

ConcurrentTestCaseAlgorithm

The algorithm to use for concurrent test case generation.

public ConcurrentTestCaseAlgorithm ConcurrentTestCaseAlgorithm { get; set; }

Property Value

ConcurrentTestCaseAlgorithm

DerivationSelectors

List of derivation selectors that filter which request derivations are generated during the test generation phase. All derivations are generated if this property is set to null. Set to an empty list to disable all derivations.

public IList<DerivationSelector> DerivationSelectors { get; set; }

Property Value

IList<DerivationSelector>

MaxConcurrencyLevel

The maximum number of concurrent operations that should be invoked together in a test. This property can be set to -1 if no bound is required on the max number of concurrent calls in a test.

public int MaxConcurrencyLevel { get; set; }

Property Value

int

MaxDepth

This property controls the max depth of the state space graph to explore up to when generating test cases. This property is always checked before the StateConstraint property.

Default is 5 to prevent unbounded exploration. Set to -1 for unlimited depth (use with caution - can cause infinite loops with cyclic state graphs).

public int MaxDepth { get; set; }

Property Value

int

MaxOperationApplicationCount

This configures the ShouldPreserveOperation lambda such that no operation is applied more than configured amount of time on any path. This property does not have a getter. If you want more flexibility, consider specifying the ShouldPreserveOperation lambda directly.

public int MaxOperationApplicationCount { set; }

Property Value

int

RequestTemplates

A dictionary mapping an operation name to a function that returns a template request. Templates are used when deriving requests from other operations, allowing a fuzzer or other external source to provide base request values that the derivation lambda can then modify with data from the source operation.

public Dictionary<string, Func<object>> RequestTemplates { get; set; }

Property Value

Dictionary<string, Func<object>>

SequentialTestCaseAlgorithm

The algorithm to use for sequential test case generation.

public SequentialTestCaseAlgorithm SequentialTestCaseAlgorithm { get; set; }

Property Value

SequentialTestCaseAlgorithm

ShouldApply

This lambda indicates whether the given operation input should be applied in a given state or not.

public Func<OperationInput, IState, bool> ShouldApply { get; set; }

Property Value

Func<OperationInput, IState, bool>

ShouldIncludeTransition

This lambda indicates whether to include a transition where an operation call takes the system from one state to another in the state graph that is used to generate test cases.

public Func<IState, OperationCall, IState, bool> ShouldIncludeTransition { get; set; }

Property Value

Func<IState, OperationCall, IState, bool>

ShouldPreserveOperation

This indicates whether a given operation input is preserved after application or not. The lambda is given the operation input as well as the list of all operation inputs (of all types) that have been executed on this path so far (including itself, always at the end)

public Func<OperationInput, IList<OperationInput>, bool> ShouldPreserveOperation { get; set; }

Property Value

Func<OperationInput, IList<OperationInput>, bool>

ShouldUnwindStepFunction

This lambda is used to decide whether step functions produced by operations should be "unwound" i.e. repeatedly applied till they reach their terminal state as defined by IsTerminalState.

Step functions are typically used to model async background processes. As an example, you might have model an API where the user can upload an image, initially in the Creating state and which triggers a background async process that creates a thumbnail for the image, ultimately changing the state of the image to Created (or Failed, if it encounters a problem). This async functionality is typically modeled using step functions.

The lambda receives an UnwindContext with the operation, request, state, and step function. Only TerminatingStepFunction instances can be unwound (they define their terminal state).

Default: All terminating step functions are unwound.

public Func<UnwindContext, bool> ShouldUnwindStepFunction { get; set; }

Property Value

Func<UnwindContext, bool>

SimplifyOperationCallNames

This property controls whether the operation call names in test cases should be simplified.

public bool SimplifyOperationCallNames { get; set; }

Property Value

bool

StateConstraint

This lambda controls whether exploration should stop at the given state or whether next states should be generated for further exploration. This lambda is only checked after the MaxDepth check passes.

public Func<IState, bool> StateConstraint { get; set; }

Property Value

Func<IState, bool>

UnwindAllTerminatingStepFunctions

Convenience property: Set to true to unwind all TerminatingStepFunction instances. This is equivalent to setting ShouldUnwindStepFunction to check if the step function is a TerminatingStepFunction.

public bool UnwindAllTerminatingStepFunctions { set; }

Property Value

bool