Skip to content

sequence

Samuel Martel edited this page Oct 6, 2022 · 2 revisions

Sequence

The Sequence function allows the packaging of Test into an element that can be toggled (executed or not). It is, put simply, nothing more than a suite of tests.

Multiple Sequences can be active at the same time. In those cases, Frasy will order them based on the Requires clauses of those sequences.

In its simplest form, a Sequence has a name and a function to execute. The sequence's function is where the Tests are located, and can define as many tests as desired.

Frasy loads the enabled sequences when the sequencing is initiated by the user, and an instance of every Sequence is created for each UUT that needs to be tested.

This process, under the hood, possesses the following logic:

uuts = LoadMappingOfEnabledUuts()
sequences = LoadAllEnabledSequences()
context = GetCurrentContext()

for uut in uuts:
    for sequence in sequence:
        DoSequence(sequence, uut, context)

Note

It is important to note that the order in which sequences are declared is not representative of the order in which they will be executed!

Frasy will order the sequences based on the rules and requirements given to each sequence, as well as the available resources, finding the most optimized execution order.

Functions

function Sequence(name: string, sequence: function(SequenceContext)) -> RequirementSpecifier

Creates a sequence of test called name, described by the function sequence.

Parameters:

  • name: string: Name assigned to the sequence. Must be unique!
  • sequence: function(Map, SequenceContext): Function that describes the tests that are done by the sequence.

Returns: RequirementSpecifier

Example:

Sequence("MySequence", function(sequenceContext)
    Test("MyTest", function(testContext)
        local resistance = TestBench.GetResistance(testContext.Map.TP1)
        Expect(resistance).ToBeNear(1000, 0.10)
    end)
end)

Exceptions:

  • Defining a Sequence nested into another sequence will result in a NestedSequence exception.
  • Multiple sequences under the same name will result in a SequenceAlreadyDefined exception.

function Sequence([name: string]) -> SequenceStatus

Used to get the current status of a Sequence in Requires expressions. When used without a name, gets the status of the currently active sequence.

Parameters:

  • name: string (optional): The name of the Sequence to get.

Returns: The SequenceStatus for the requested sequence, if it is found.

Exceptions:

  • Requesting a Sequence that does not exist will result in a SequenceNotFound exception.

Types

class SequenceStatus

{
    name = "SequenceName",            -- Name of the sequence
    sequenceFunc = function(ctx) end, -- Function used to populate the sequence's tests
}

class SequenceContext

Map

Clone this wiki locally