getBehaviorDrivenDescription method

  1. @override
String getBehaviorDrivenDescription(
  1. TestController tester
)

Gets the most appropriate BDD string based on the values set on the step.

Implementation

@override
String getBehaviorDrivenDescription(TestController tester) {
  var result = variableName == null
      ? behaviorDrivenDescriptions[0]
      : behaviorDrivenDescriptions[1];

  result = result.replaceAll('{{regEx}}', regEx);
  result = result.replaceAll('{{variableName}}', variableName ?? 'null');

  TestRunnerStep? runnerStep;
  try {
    runnerStep = tester.registry.getRunnerStep(
      id: step['id'],
      values: step['values'],
    );
  } catch (e) {
    // no-op
  }

  final desc = runnerStep == null
      ? 'nothing.'
      : runnerStep.getBehaviorDrivenDescription(tester);

  result += '\n1. Then I will execute the sub-step, $desc\n';

  return result;
}