Home

Markus Wessjohann Stefan Macke

Introduction

Welcome to the NatUnit Wiki! Here you can find information about:

  • NatUnit - a unit test framework for Natural
  • L4N - a logging framework for Natural

NatUnit

NatUnit is an easy to use unit testing framework for Software AG's Natural, as the following code (a simple test case) shows. The whole framework is written in Natural itself, so you don't have to use external tools like NaturalONE.

DEFINE DATA
PARAMETER USING NUTESTP
LOCAL USING NUCONST
LOCAL USING NUASSP
END-DEFINE
*
NUTESTP.FIXTURE := 'Example TestCase 1'
*
INCLUDE NUTCTEMP
INCLUDE NUTCSTUB
*
DEFINE SUBROUTINE TEST
*
********************************************************************************
IF NUTESTP.TEST EQ 'compare two equal numbers should pass'
********************************************************************************
ASSERT-LINE := *LINE; PERFORM ASSERT-NUM-EQUALS NUASSP 2 2
END-IF
*
END-SUBROUTINE
*
END

L4N

L4N offers basic logging functionality for Software AG's Natural, including:

  • user- and module-specific logging
  • different log levels (e.g. debug, info, error)
  • combinable logging facilities (e.g. work file, INPUT, WRITE, database)

Using the framework is easy, as the following code shows:

LOCAL USING L4NCONST /* some constants like log levels etc.
LOCAL USING L4NPARAM /* the parameters (e.g. log text) for calling the actual logging
...
* (optional) basic configuration of logging for the current module
L4N-DEBUGUSER := 'macke'
L4N-LOGTYPES := C-LOGTYPE-FILE + C-LOGTYPE-WRITE
L4N-LINENR := *LINE; L4N-DEBUGLEVEL := C-LOGLEVEL-DEBUG
INCLUDE L4NENTER
...
* the actual logging
COMPRESS 'Current value:' #VALUE INTO L4N-LOGTEXT
L4N-LINENR := *LINE; L4N-LOGLEVEL := C-LOGLEVEL-INFO
INCLUDE L4NLOGIT

Links

Users

[Install]
[How_to_use_NatUnit]
[How_to_use_L4N]

Developers

[Developing]
[ToDos]

Natural-Developers

[Softwaretools for Natural]

Initiators of NatUnit and L4N

[Initiators of NatUnit]

Project Admins:

Contact

Markus Wessjohann (mwessjoh) mwessjoh@users.sf.net

Download


Related

Wiki: How_to_use_L4N
Wiki: How_to_use_NatUnit
Wiki: Initiators of NatUnit
Wiki: Install
Wiki: Softwaretools for Natural