omnitest 0.2.6+1

  • Installing
  • Versions
  • 0


Pub Package

To make testing Omnibus based programs easier, this package implements a function that can evaluate test files that contain a YAML representation of the tests that should be executed. Using this omnitest function you can greatly simplify your testing code.

Test configuration

An Omnibus testing configuration file looks as follows:

description: >
  General description of the module you are testing and what you are testing.

- test/messages/messages.yaml
- package:messages/messages.yaml

# When the module is loaded a tracking HTTP request is fired.
- PUT http://tracking.api/random-message-generator

- description: >
    Trigger random message about terminator.
    https-only: true
  # This event should trigger the module to publish a random message.
  - package.v1.mTriggerMyEvent:
      subject: terminator
    # First the module requests a new random message.
    - package.v1.mGetRandomMessage:
        subject: terminator
      # The module gets a random message from the random message API.
      - GET http://generator.api/message/terminator.json
      - package.v1.mRandomMessage:
          message: I'll be back!
    # A random message is now published as a result of the initial trigger.
    - package.v1.mFinalMessage:
        say: I'll be back!

The messages used in this test are described in this omnibuild template:

- name: mFinalMessage
  type: event
  - name: say
    note: Something to say
    type: String
- name: mTriggerMyEvent
  type: event
  - name: subject
    note: Subject for a random message
    type: String
- name: mGetRandomMessage
  type: request
  - name: subject
    note: The random message subject
    type: String
- name: mRandomMessage
  type: response
  - name: message
    note: The random message
    type: String

Test code

To run this test file, and use it form code coverage reports, you have to include it in your testing code. Omnitest is built to be used along with the test package. The test code with omnitest should look something like this:

library package.test.random_message_module_test;

import 'package:test/test.dart';
import 'package:omnitest/omnitest.dart';

import 'package:package/random_message_module.dart' as random_message_module;

void main() {
      'Test the random message module',
          random_message_module.main, 'test/random_message_module_test.yaml'));


To test messages with enumerations you have to put the enumeration indices in the test data. In general this is not preferable since it makes the test data much less readable. A simple way to overcome this issue is to use YAML anchors. A convention for this is included below.

- MyEnumeration:
  - option1: &MyEnumeration.option1 0
  - option2: &MyEnumeration.option2 1
  - option3: &MyEnumeration.option3 2

- messages:
  - package.v1.mMessageWithEnum:
      option: *MyEnumeration.option1

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  omnitest: ^0.2.6+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:omnitest/omnitest.dart';
Version Uploaded Documentation Archive
0.2.6+1 Oct 17, 2016 Go to the documentation of omnitest 0.2.6+1 Download omnitest 0.2.6+1 archive
0.2.6 May 19, 2016 Go to the documentation of omnitest 0.2.6 Download omnitest 0.2.6 archive
0.2.5 May 9, 2016 Go to the documentation of omnitest 0.2.5 Download omnitest 0.2.5 archive
0.2.4+2 Apr 28, 2016 Go to the documentation of omnitest 0.2.4+2 Download omnitest 0.2.4+2 archive
0.2.4+1 Apr 27, 2016 Go to the documentation of omnitest 0.2.4+1 Download omnitest 0.2.4+1 archive
0.2.4 Apr 27, 2016 Go to the documentation of omnitest 0.2.4 Download omnitest 0.2.4 archive
0.2.3 Apr 20, 2016 Go to the documentation of omnitest 0.2.3 Download omnitest 0.2.3 archive
0.2.2 Apr 9, 2016 Go to the documentation of omnitest 0.2.2 Download omnitest 0.2.2 archive
0.2.1 Apr 7, 2016 Go to the documentation of omnitest 0.2.1 Download omnitest 0.2.1 archive
0.2.0 Apr 6, 2016 Go to the documentation of omnitest 0.2.0 Download omnitest 0.2.0 archive

All 13 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.14.0 <2.0.0