Beispiel #1
0
def teststory_from_trace(trace: list) -> Story:
    """
    Return a test story based on the given *trace*, a list of macro steps.
    See documentation to see which are the events that are generated.

    Notice that this function adds a *pause* if there is any delay between pairs of consecutive steps.

    :param trace: a list of *MacroStep* instances
    :return: A story
    """
    story = Story()
    story.append(Event('execution started'))
    time = 0

    for macrostep in trace:
        if macrostep.time > time:
            story.append(Pause(macrostep.time - time))
        story.extend(_teststory_from_macrostep(macrostep))
        time = macrostep.time

    story.append(Event('execution stopped'))
    return story
Beispiel #2
0
def teststory_from_trace(trace: list) -> Story:
    """
    Return a test story based on the given *trace*, a list of macro steps.
    See documentation to see which are the events that are generated.

    Notice that this function adds a *pause* if there is any delay between pairs of consecutive steps.

    :param trace: a list of *MacroStep* instances
    :return: A story
    """
    story = Story()
    story.append(Event('execution started'))
    time = 0

    for macrostep in trace:
        if macrostep.time > time:
            story.append(Pause(macrostep.time - time))
        story.extend(_teststory_from_macrostep(macrostep))
        time = macrostep.time

    story.append(Event('execution stopped'))
    return story