OmnisTAP is a Test Anything Protocol producer for Omnis Studio.
Full documentation is available in the wiki.
- Assertions comparing primitive Omnis types, include lists and row
- Assertions for the existence of classes, libraries, xcomps, and files
- Startup and shutdown methods for a test run
- Setup and teardown methods for each test
- Automatic testing for:
- Leaking object references
- Leaking window instances
- Unit tests running too long
- A full-featured and expressive mocking utility
- Storing, mocking and automatically restoring task variables during a test run
- Running tests in the Omnis IDE
- Running tests from the command-line using OmnisCLI
- Measuring code coverage and test performance
TAP specification support
Supported:
- Pass (ok) and fail (not ok) assertions
- Diagnostic messages
Not yet supported:
- Plans (OmnisTAP automatically generates a plan for the number of tests run, xUnit-style)
- Bailing out
- Skipping tests (although this is easy to code into your tests)
- Marking tests as TODO (although you can add this note to your test message)
- Omnis Studio 8.1.x
- macOS 10.9
- Windows 7
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")
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
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: 95000
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/
Clone this repository to a working directory:
git clone https://github.com/suransys/omnistap.git
- Open
omnistap/lib/[your Omnis version]/omnistap.lbs
in Omnis Studio - Set your library's startup task to subclass
omnistap.kgTAPTask
- Restart your library's startup task
-
Create a object class in your library named
_oHelloOmnisTAP
-
Set
_oHelloOmnisTAP
to subclassomnistap.ogTAPSuper
-
Add the method
$u_sayHello
to_oHelloOmnisTAP
with this codeDo ioTAP.$pass("Hello OmnisTAP!")
-
Go to TAP -> Test Current Class
-
Follow the OmnisCLI guide to install OmnisCLI
-
Ensure your startup task's construct has this code:
Do $cinst.$processCLI() Returns lbCLIRun If lbCLIRun=kTrue Quit method End If
-
Ensure
omnistap.lbs
,omniscli.lbs
, and your library are opened at startup -
Run this command from a command prompt:
[path to bin/omniscli] runtests [path to tap output directory]
Please see the wiki for full documentation.
Please see our guide to contributing.