Skip to content

i-unit/iunit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IUNIT IBM i Unit Testing Framework

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

Building in library IUNIT (install and use bash)

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

Test

addlible iunit
runone iunit pass
runall iunit

Using

  • Create a test suite library 'mytest'
  • Create a CLLE program named 'pass' with this program source.
  • addlible iunit
  • crtdupobj utemsg iunit *msgf mytst
  • addlible mytest
  • 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 I_
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
I_SETUP is called before RUNONE and RUNALL run any tests
I_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 (a test suite). 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 I_SETUP and I_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