suransys / omnistap

Unit testing framework for Omnis Studio
MIT License
15 stars 7 forks source link
integration-testing mocking omnis-studio tap unit-testing

OmnisTAP

OmnisTAP is a Test Anything Protocol producer for Omnis Studio.

Full documentation is available in the wiki.

Features

TAP specification support

Supported:

Not yet supported:

Requirements

Examples

OmnisTAP code

Do ioTAP.$ok(1=1,"1 equals 1")
Do ioTAP.$is_char(low("FOO"),"foo","low() works")
Do ioTAP.$isnotclear($libs.$findname("omnistap_example"),"Our library is open")

Raw TAP output

1..3
# 2017-09-02 12:19 PM (Unit) Library:omnistap_example Test:_oOmnisTAPExamples/$u_sampleAssertions
ok 1 1 equals 1
ok 2 low() works
ok 3 Our library is open
# 17 ms

OmnisTAP in the IDE

OmnisTAP Example output in the IDE

OmnisCLI

Sat Sep 2 13:47:51 2017 Notice: Starting OmnisTAP run on omnistap_example to /Users/aclay/Desktop/tap
Sat Sep 2 13:47:51 2017 Notice: Test timing multiplier is set to 1
Sat Sep 2 13:47:51 2017 Notice: Max timing for unit tests: 5000
Sat Sep 2 13:47:51 2017 Notice: Max timing for integration tests: 90000
Sat Sep 2 13:47:51 2017 Notice: ogTAPManager.$run: ilTests linecount is 1
Sat Sep 2 13:47:51 2017 Notice: Starting up...
Running _oOmnisTAPExamples/$u_sampleAssertions...   [ pass ]
Sat Sep 2 13:47:52 2017 Notice: running tests shutdown
Sat Sep 2 13:47:52 2017 Notice: OmnisTAP run on omnistap_example complete in 1 second to /Users/aclay/Desktop/tap
Sat Sep 2 13:47:52 2017 Notice: Temp folder for this session is /tmp/suran/omnistap25002500/

Installation

Clone this repository to a working directory:

git clone https://github.com/suransys/omnistap.git

Quickstart

Add OmnisTAP to your library

  1. Open omnistap/lib/[your Omnis version]/omnistap.lbs in Omnis Studio
  2. Set your library's startup task to subclass omnistap.kgTAPTask
  3. Restart your library's startup task

Add a test

  1. Create a object class in your library named _oHelloOmnisTAP
  2. Set _oHelloOmnisTAP to subclass omnistap.ogTAPSuper
  3. Add the method $u_sayHello to _oHelloOmnisTAP with this code

    Do ioTAP.$pass("Hello OmnisTAP!")
  4. Go to TAP -> Test Current Class
  5. You will see this output: Quickstart Say Hello

Run from the command line

  1. Follow the OmnisCLI guide to install OmnisCLI
  2. Ensure your startup task's construct has this code:
    Do $cinst.$processCLI() Returns lbCLIRun
    If lbCLIRun=kTrue
        Quit method
    End If
  3. Ensure omnistap.lbs, omniscli.lbs, and your library are opened at startup
  4. Run this command from a command prompt:

    [path to bin/omniscli] runtests [path to tap output directory]

Documentation

Please see the wiki for full documentation.

Contributing

Please see our guide to contributing.