Skip to content
IBM i Unit Testing Framework
Branch: master
Clone or download
Latest commit 3bc539b Jan 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ibmi
QCLLESRC
QCMDSRC
.project
PREREQUISITES.md
README.md
build.sh

README.md

IUNIT IBM i Unit Testing Framework

Welcome to IUNIT. The lightweight extensible unit testing framework for IBM i.
Check prerequisites.

Building

git clone https://github.com/i-unit/iunit.git
cd iunit
source build.sh
iunit.restore IUNIT

Test

addlible iunit
runone iunit pass
runall

Using

Create a library 'mytest'
Create a CLLE program named 'pass' with this program source.
addlible iunit *last
ADDLIBLE LIB(MYTEST) POSITION(*BEFORE IUNIT)
runall mytest

Create a CLLE program named 'fail' with this program source.
runall mytest

Workings

RUNALL runs all programs in the library that do not start with @
Fail your test program by sending an escape message to *PRV with sndpgmmsg
Make sure the tests do not hang in QSYSOPR message queue by monitoring all commands. Otherwise they will stall your test
@SETUP is called before RUNONE and RUNALL run any tests
@TEARDOWN is called after RUNONE and RUNALL have ran all tests

Best practices

Do not depend one test on the result of another test
A library is set of related tests. Create as many libraries as you need and call them sequentially
When using TD/OMS as your change management system. include tests in your compile or transfer

Tips

Copy @SETUP and @TEARDOWN source from IUNIT into your test libraries and modify
You can copy IUNIT into your test library so that it is completely self contained

Contribute

Did you add functions to IUNIT (like logging)?. Consider contributing back by creating a pull request.

License

MIT Copyright 2019 Remain BV

You can’t perform that action at this time.