omnitest 0.2.6+1

  • Installing
  • Versions
  • 34


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

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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...


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


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


Detected platforms: Flutter, other

Primary library: package:omnitest/omnitest.dart with components: io, isolate.


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Homepage does not exists.

    We were unable to access at the time of the analysis.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 5 hints.

    Strong-mode analysis of lib/src/data/utils.dart failed with the following error:

    line: 14 col: 28
    The function expression type '(String) → bool' isn't of type '(dynamic) → bool'. This means its parameter or return type does not match what is expected. Consider changing parameter type(s) or the returned type(s).

    Strong-mode analysis of lib/data.dart gave the following hint:

    line: 7 col: 25
    The library 'dart:core' doesn't export a member with the hidden name 'Resource'.

    Similar analysis of the following files failed:

    • lib/src/data/raw_messages.dart (hint)
    • lib/src/test/main.dart (hint)
  • Package is getting outdated.

    The package was released 86 weeks ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use omnitest.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.14.0 <2.0.0
ansicolor ^0.0.9 0.0.9 0.1.0
collection ^1.5.1 1.14.10
http ^0.11.3+5 0.11.3+16
mustache ^0.2.5 0.2.5+1 1.0.1
omnibuild ^0.5.2+1 0.5.2+2
omnibus ^0.15.3 0.15.3+1
passive_data ^0.7.1 0.7.1+1
quiver ^0.21.4 0.21.4 0.29.0+1
resource ^1.1.0 1.1.0 2.1.4
test ^0.12.7 0.12.37 0.12.40
yaml ^2.1.8 2.1.14
Transitive dependencies
analyzer 0.29.11 0.32.1
args 0.13.7 1.4.3
async 2.0.7
boolean_selector 1.0.3
charcode 1.1.1
cli_util 0.0.1+2 0.1.3
convert 2.0.1
crypto 2.0.3
csslib 0.14.4
dart_style 0.2.16 1.0.14
glob 1.1.5
html 0.13.3+1
http_multi_server 2.0.5
http_parser 3.1.2
io 0.3.2+1
isolate 1.1.0 2.0.1
js 0.6.1
logging 0.11.3+1
matcher 0.12.2+1
meta 1.1.5
mime 0.9.6+1
multi_server_socket 1.0.1
node_preamble 1.4.2
package_config 1.0.3
package_resolver 1.0.3
path 1.6.0
plugin 0.2.0+2
pool 1.3.5
pub_semver 1.4.1
shelf 0.7.3+1
shelf_packages_handler 1.0.3
shelf_static 0.2.7+1
shelf_web_socket 0.2.2+2
source_map_stack_trace 1.1.4
source_maps 0.10.5
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.7
string_scanner 1.0.2
term_glyph 1.0.0
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+8
web_socket_channel 1.0.8
when 0.2.0
which 0.1.3