finishRun method

Future<void> finishRun(
  1. int testRunId
)

Closes an adapter-owned (or last-peer) test run.

Implementation

Future<void> finishRun(int testRunId) async {
  const label = 'finish run';
  final url = Uri.parse(
    '${config.baseURL}/projects/${config.projectId}/test-runs/$testRunId'
    '/autotest/finish',
  );
  final _Response response;
  try {
    response = await _send(
      'POST',
      url,
      headers: _headers(json: true),
      body: const <int>[],
    );
  } on Object catch (error) {
    throw ApiError('$label failed: $error');
  }
  if (response.statusCode >= 400) {
    throw ApiError(
      '$label failed: HTTP ${response.statusCode} ${response.body.trim()}',
    );
  }
}