Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions user-submitted/api-scripts/dart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
![Dutchie Logo](https://dutchie.com/favicons/default/apple-touch-icon.png)

[Pub Dev](https://pub.dev/packages/test_rail_dart)
[Repo](https://github.com/GetDutchie/test_rail_dart)

# Test Rail Dart

This package is a thin wrapper around the Test Rail API that will allow for automated test reporting in Dart. It enables a user to start, report case pass/fail, and close your test runs from a Dart interface.

## Getting Started

Initialize the TestRail instance using the config method:

```dart
TestRail.config(
username: 'USERNAME',
password: 'PASSWORD',
/// The url that points to the test rail server => https://example.testrail.com
serverDomain: 'https://YOUR_SERVER.testrail.com'
)
```

## Usage

### Create or Update Runs

```dart
/// Start by creating a new run
final newRun = await TestRun.create(
name: 'Test execution',
projectId: 1
);

/// Add cases to the run
await newRun.updateRun(
caseIds: [1, 2, 3, 5],
);
```

Once the run is created, results can be reported by case:

```dart
final result = await newRun.addResultForCase(
caseId: 1,
statusId: 1,
);

// Optionally add a screenshot or other image to the result
await result.addAttachmentToResult(
'/workspace/attachments/failure.png',
);
```

### Get

Historical runs, cases, and sections can be retrieved:

```dart
final testCase = await TestCase.get(1);

final testRun = await TestRun.get(1);

final testSection = await TestSection.get(1);
```
## About Dutchie

We’re not just building the future of shopping for cannabis, we’re building a culture of innovation, customer care, and challenge to the status quo.

Inspired? Join a our team of [Dart and Flutter developers](https://dutchie.com/careers) today
59 changes: 59 additions & 0 deletions user-submitted/api-scripts/dart/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// ignore_for_file: unused_local_variable
import 'package:test_rail_dart/test_rail.dart';
import 'package:test_rail_dart/test_case.dart';
import 'package:test_rail_dart/test_run.dart';
import 'package:test_rail_dart/test_section.dart';

void main(List<String> args) async {
TestRail.configure(
serverDomain: args[0],
username: args[1],
password: args[2],
);

// replace with your own caseId
final testCase = await TestCase.get(142864);

// replace with your own projectId, extra parameters available in method
final testRuns = await TestRun.getAll(projectId: 1125, limit: 10);

// replace with your own projectId
final testRun = await TestRun.get(1125);

// replace with your own sectionId
final section = await TestSection.get(13);
final newRun = await TestRun.create(
caseIds: [testCase.id],
description: '121',
name: 'newRun',
// replace with your own projectId
projectId: 134,
);

final testCaseResult = await newRun.addResultForCase(
testCase.id,
// Status - 1: PASSED
statusId: 1,
);

await newRun.update(
caseIds: [1, 6, 7],
includeAll: false,
);

// Replace with attachment path
await testCaseResult.addAttachment('<attachment_path>');
}
© 2022 GitHub, Inc.
Terms
Privacy
Security
Status
Docs
Contact GitHub
Pricing
API
Training
Blog
About
Loading complete