getBehaviorDrivenDescription method

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

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

Implementation

@override
String getBehaviorDrivenDescription(TestController tester) {
  String result;

  final setDx = dx != null && JsonClass.parseDouble(dx) != 0.0;
  final setDy = dy != null && JsonClass.parseDouble(dy) != 0.0;

  if (timeout == null) {
    if (setDx && setDy) {
      result = behaviorDrivenDescriptions[2];
    } else if (setDx) {
      result = behaviorDrivenDescriptions[0];
    } else {
      result = behaviorDrivenDescriptions[1];
    }
  } else {
    if (setDx && setDy) {
      result = behaviorDrivenDescriptions[5];
    } else if (setDx) {
      result = behaviorDrivenDescriptions[3];
    } else {
      result = behaviorDrivenDescriptions[4];
    }

    result = result.replaceAll(
      '{{timeout}}',
      timeout!.inSeconds.toString(),
    );
  }

  result = result.replaceAll('{{dx}}', dx ?? 'null');
  result = result.replaceAll('{{dy}}', dy ?? 'null');
  result = result.replaceAll('{{testableId}}', testableId);

  return result;
}