Table of Contents

Class TestCaseGenerator

Namespace
Microsoft.Accordant
Assembly
Accordant.Operations.dll
public class TestCaseGenerator
Inheritance
TestCaseGenerator
Inherited Members

Methods

ConstructDescriptionForConcurrentTestCase(IList<TestCaseSegment>)

public static string ConstructDescriptionForConcurrentTestCase(IList<TestCaseSegment> segments)

Parameters

segments IList<TestCaseSegment>

Returns

string

ConstructDescriptionForSequentialTestCase(IList<OperationCall>)

public static string ConstructDescriptionForSequentialTestCase(IList<OperationCall> operationCalls)

Parameters

operationCalls IList<OperationCall>

Returns

string

CreateManualConcurrentTestCase(TestingContext, InputSet, IList<string>, IList<string>)

public static ConcurrentTestCase CreateManualConcurrentTestCase(TestingContext context, InputSet inputSet, IList<string> sequentialPrefixOperationNames, IList<string> concurrentOperationNames)

Parameters

context TestingContext
inputSet InputSet
sequentialPrefixOperationNames IList<string>
concurrentOperationNames IList<string>

Returns

ConcurrentTestCase

CreateManualSequentialTestCase(TestingContext, InputSet, params string[])

public static SequentialTestCase CreateManualSequentialTestCase(TestingContext context, InputSet inputSet, params string[] operationNames)

Parameters

context TestingContext
inputSet InputSet
operationNames string[]

Returns

SequentialTestCase

DeserializeConcurrentTestCases(TestingContext, string)

public static IList<ConcurrentTestCase> DeserializeConcurrentTestCases(TestingContext context, string serializedTestCases)

Parameters

context TestingContext
serializedTestCases string

Returns

IList<ConcurrentTestCase>

DeserializeConcurrentTestCases<T>(TestingContext, string)

public static (T, IList<ConcurrentTestCase>) DeserializeConcurrentTestCases<T>(TestingContext context, string serializedTestCases) where T : ITestingMetadata

Parameters

context TestingContext
serializedTestCases string

Returns

(T, IList<ConcurrentTestCase>)

Type Parameters

T

DeserializeSequentialTestCases(TestingContext, string)

public static IList<SequentialTestCase> DeserializeSequentialTestCases(TestingContext context, string serializedTestCases)

Parameters

context TestingContext
serializedTestCases string

Returns

IList<SequentialTestCase>

DeserializeSequentialTestCases<T>(TestingContext, string)

public static (T, IList<SequentialTestCase>) DeserializeSequentialTestCases<T>(TestingContext context, string serializedTestCases) where T : ITestingMetadata

Parameters

context TestingContext
serializedTestCases string

Returns

(T, IList<SequentialTestCase>)

Type Parameters

T

ExploreStateSpace(TestingContext, IState, InputSet, TestGenerationOptions)

This methods explores the state graph in the same way as its explored during test case generation. One difference is that it currently also fully explores the interleaving of step functions spawned the behavior (say, to model background asynchrony) with the rest of the operations, so its exploration is more exhaustive. It returns the root node of the resulting state graph to the caller.

public static StateGraphNode ExploreStateSpace(TestingContext context, IState startingState, InputSet inputSet, TestGenerationOptions options = null)

Parameters

context TestingContext
startingState IState
inputSet InputSet
options TestGenerationOptions

Returns

StateGraphNode

GenerateConcurrentTestCases(TestingContext, IState, InputSet, TestGenerationOptions)

This method generates test cases by gathering all test sequences starting from the rootNode, where each test case is a (sequentialPrefix, concurrentSteps) pair. The step functions in "sequentialPrefix" are meant to be run one after another. The step functions in "concurrentSteps" are all meant to be run concurrently. A test case here contains the labels of the step functions in consideration. This method returns a dictionary whose key is the

public static IList<ConcurrentTestCase> GenerateConcurrentTestCases(TestingContext context, IState startingState, InputSet inputSet, TestGenerationOptions options = null)

Parameters

context TestingContext
startingState IState
inputSet InputSet
options TestGenerationOptions

Returns

IList<ConcurrentTestCase>

GenerateSequentialTestCases(TestingContext, IState, InputSet, TestGenerationOptions)

This method generates test cases by gathering all distinct paths starting from rootNode, where each path consists of the step function labels for the transitions in that path. If a path loop backs into itself, this method stops generating that path and doesn't follow the cycles. This method returns a dictionary whose key is the unique identifier for the test case and whose value is the list of operations comprising a test case.

public static IList<SequentialTestCase> GenerateSequentialTestCases(TestingContext context, IState startingState, InputSet inputSet, TestGenerationOptions options = null)

Parameters

context TestingContext
startingState IState
inputSet InputSet
options TestGenerationOptions

Returns

IList<SequentialTestCase>

LoadConcurrentTestCases(TestingContext, string)

public static IList<ConcurrentTestCase> LoadConcurrentTestCases(TestingContext context, string filePath)

Parameters

context TestingContext
filePath string

Returns

IList<ConcurrentTestCase>

LoadConcurrentTestCases<T>(TestingContext, string)

public static (T, IList<ConcurrentTestCase>) LoadConcurrentTestCases<T>(TestingContext context, string filePath) where T : ITestingMetadata

Parameters

context TestingContext
filePath string

Returns

(T, IList<ConcurrentTestCase>)

Type Parameters

T

LoadSequentialTestCases(TestingContext, string)

public static IList<SequentialTestCase> LoadSequentialTestCases(TestingContext context, string filePath)

Parameters

context TestingContext
filePath string

Returns

IList<SequentialTestCase>

LoadSequentialTestCases<T>(TestingContext, string)

public static (T, IList<SequentialTestCase>) LoadSequentialTestCases<T>(TestingContext context, string filePath) where T : ITestingMetadata

Parameters

context TestingContext
filePath string

Returns

(T, IList<SequentialTestCase>)

Type Parameters

T

SaveConcurrentTestCases(TestingContext, string, IList<ConcurrentTestCase>)

public static void SaveConcurrentTestCases(TestingContext context, string filePath, IList<ConcurrentTestCase> testCases)

Parameters

context TestingContext
filePath string
testCases IList<ConcurrentTestCase>

SaveConcurrentTestCases<T>(TestingContext, T, string, IList<ConcurrentTestCase>)

public static void SaveConcurrentTestCases<T>(TestingContext context, T testingMetadata, string filePath, IList<ConcurrentTestCase> testCases) where T : ITestingMetadata

Parameters

context TestingContext
testingMetadata T
filePath string
testCases IList<ConcurrentTestCase>

Type Parameters

T

SaveSequentialTestCases(TestingContext, string, IList<SequentialTestCase>)

public static void SaveSequentialTestCases(TestingContext context, string filePath, IList<SequentialTestCase> testCases)

Parameters

context TestingContext
filePath string
testCases IList<SequentialTestCase>

SaveSequentialTestCases<T>(TestingContext, T, string, IList<SequentialTestCase>)

public static void SaveSequentialTestCases<T>(TestingContext context, T testingMetadata, string filePath, IList<SequentialTestCase> testCases) where T : ITestingMetadata

Parameters

context TestingContext
testingMetadata T
filePath string
testCases IList<SequentialTestCase>

Type Parameters

T

SerializeConcurrentTestCases(TestingContext, IList<ConcurrentTestCase>)

public static string SerializeConcurrentTestCases(TestingContext context, IList<ConcurrentTestCase> testCases)

Parameters

context TestingContext
testCases IList<ConcurrentTestCase>

Returns

string

SerializeConcurrentTestCases<T>(TestingContext, T, IList<ConcurrentTestCase>)

public static string SerializeConcurrentTestCases<T>(TestingContext context, T testingMetadata, IList<ConcurrentTestCase> testCases) where T : ITestingMetadata

Parameters

context TestingContext
testingMetadata T
testCases IList<ConcurrentTestCase>

Returns

string

Type Parameters

T

SerializeSequentialTestCases(TestingContext, IList<SequentialTestCase>)

public static string SerializeSequentialTestCases(TestingContext context, IList<SequentialTestCase> testCases)

Parameters

context TestingContext
testCases IList<SequentialTestCase>

Returns

string

SerializeSequentialTestCases<T>(TestingContext, T, IList<SequentialTestCase>)

public static string SerializeSequentialTestCases<T>(TestingContext context, T testingMetadata, IList<SequentialTestCase> testCases) where T : ITestingMetadata

Parameters

context TestingContext
testingMetadata T
testCases IList<SequentialTestCase>

Returns

string

Type Parameters

T

VisualizeStateSpace(TestingContext, IState, InputSet, TestGenerationOptions, VisualizationOptions)

This methods explores the state graph in the exact same way as it is explored during test case generation. It returns a GraphViz visualization of the state graph to the caller.

public static string VisualizeStateSpace(TestingContext context, IState startingState, InputSet inputSet, TestGenerationOptions options = null, VisualizationOptions visualizationOptions = null)

Parameters

context TestingContext
startingState IState
inputSet InputSet
options TestGenerationOptions
visualizationOptions VisualizationOptions

Returns

string