toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      'testId': testId,
      if (metadata.isNotEmpty) 'metadata': metadata,
      'status': status.name,
      'durationMs': durationMs,
      if (attempts > 1) 'attempts': attempts,
      if (retry > 0) 'retry': retry,
      if (failedStepIndex != null) 'failedStepIndex': failedStepIndex,
      if (failedStep != null) 'failedStep': failedStep!.toJson(),
      if (message != null) 'message': message,
      if (status == TestStatus.failed) 'failure': _failureJson(),
      if (stackTrace != null) 'stackTrace': stackTrace,
      'logs': logs,
      if (report != null) 'report': report!.toJson(),
    };