Task: UnitTest

Description

This task executes IBM Test Accelerator for Z unit tests.
NOTE: This task requires a user jobCard to be provided.

Task dependency list

List of tasks that must execute before this task.

  • File Analysis
  • Language Tasks

Actions

  • Filter the BUILD_SET for TAZ unit test configuration files.
  • For each configuration file generate and submit a JCL job to execute the test case.
  • Save the job output and report file of the test results to z/OS UNIX.

Syntax

- task: UnitTest
  comment: String # Message printed to stdout when the task begins executing.
  condition: Boolean # Boolean expression to optionally execute task. Default is true.
  variables: 
    - name: jobCard # Unit test JCL job card.
      value: String # Default NONE.
    - name: configSources # File patterns used to match files in the BUILD_SET as Unit Test configuration files. 
      value: String # Default is "**.bzucfg".
    - name: configDS # Partitioned dataset for configuration files.
      value: String # Default is "${HLQ}.BZU.BZUCFG".
    - name: configDSSpace # Space allocation for creating configDS. Use BPXWDYN syntax.
      value: String # Default is "cyl space(1,1)".
    - name: recordingDS # Partitioned dataset for recording files.
      value: String # Default is "${HLQ}.BZU.BZUPLAY".
    - name: recordingDSSpace # Space allocation for creating recordingDS. Use BPXWDYN syntax.
      value: String # Default is "cyl space(5.5)".
    - name: recordingSearch # The search path used to find the testcase recording source files on z/OS Unix.
      value: String # Default is "search:[SYSPLAY:]${WORKSPACE}/?path=${APP_DIR_NAME}/**.rec"
    - name: reportDS # Partitioned dataset for test report files.
      value: String # Default is "${HLQ}.BZU.BZURPT".
    - name: reportDSSpace # Space allocation for creating reportDS. Use BPXWDYN syntax.
      value: String # Default is "tracks space(200,40)".
    - name: testDS # Partitioned dataset containing the unit test load modules.
      value: String # Default is "${HLQ}.TEST.LOAD".
    - name: programDS # Partitioned dataset containing the program load modules.
      value: String # Default is "${HLQ}.LOAD".
    - name: userLibrary # Optional additional user dataset needed to execute tests.
      value: String # Default NONE.
    - name: jobParm # Unit test JCL PARM value.
      value: String # Default is "STOP=E,REPORT=XML"
    - name: useDebug # Flag to run test case in debug mode.
      value: Boolean # Default is false.
    - name: debugParm # Unit test debug JCL PARM value.  Concatenated to 'parm'.
      value: String # Default is "TEST(ERROR,,PROMPT,DBMDT:*)".
    - name: useCodeCoverage # Flag to activate code coverage.
      value: Boolean # Default is false.
    - name: codeCoverageHost # Code coverage host machine address.
      value: String # Default is NONE.
    - name: codeCoveragePort # Code coverage host machine port.
      value: String # Default is NONE.
    - name: codeCoverageOptions # Code coverage options.
      value: String # Default is NONE.
    - name: fileBuildRank # File associated variable used to control the execution order of test cases.
      value: Integer # Default value is NULL.
    - name: logEncoding # The file encoding of the JCL output log file.
      value: String # Default is "IBM-1047".
    - name: maxRC # Maximum JCL step return code to indicate a successful test case execution.
      value: Integer # Default is 4.
    - name: useHLQ # Since 3.0.2: Optional variable to override the default &SYSUID
      value: String # Default is &SYSUID
    - name: reportTag # Since 3.0.2: The file tag of the generated XML report. Changes tag, not encoding.
      value: String # Default is UTF-8

YAML variables

Required variables

Must be defined for the task to execute.

jobCard

Type: String
Unit test JCL job card. Use YAML multi-line format.
Example:

variables:
  - name: jobCard
    value: |-
      //USER1 JOB ,  
      // MSGCLASS=H,MSGLEVEL=(1,1),TIME=NOLIMIT,REGION=144M,COND=(16,LT)  

Optional variables

Only need to be defined to change default values.

configSources

Type: String
Default: **.bzucfg
File patterns used to match files in the BUILD_SET as Unit Test configuration files.

configDS

Type: String
Default: ${HLQ}.BZU.BZUCFG
Partitioned dataset for configuration files.

configDSSpace

Type: String
Default: cyl space(1,1)
Space allocation for creating configDS. Use BPXWDYN syntax.

recordingDS

Type: String
Default: ${HLQ}.BZU.BZUPLAY
Partitioned dataset for recording files.

recordingDSSpace

Type: String
Default: cyl space(5,5)
Space allocation for creating recordingDS. Use BPXWDYN syntax.

recordingSearch

Type: String
Default: search:[SYSPLAY:]${WORKSPACE}/?path=${APP_DIR_NAME}/**.rec
The search path used to find the testcase recording source files on z/OS UNIX.

reportDS

Type: String
Default: ${HLQ}.BZU.BZURPT
Partitioned dataset for test report files.

reportDSSpace

Type: String
Default: tracks space(200,40)
Space allocation for creating reportDS. Use BPXWDYN syntax.

testDS

Type: String
Default: ${HLQ}.TEST.LOAD
Partitioned dataset for where unit test load modules are located.

programDS

Type: String
Default: ${HLQ}.LOAD
Partitioned dataset for where program load modules are located.

userLibrary

Type: String
Default: NONE
Optional additional user dataset needed to execute tests.

jobParm

Type: String
Default: STOP=E,REPORT=XML
Unit test JCL PARM value.

useDebug

Type: Boolean
Default: false
Flag that indicates to run unit test in debug mode.

debugParm

Type: String
Default: TEST(ERROR,,PROMPT,DBMDT:*)
Unit test debug JCL PARM value. Concatenated to 'jobParm'.

useCodeCoverage

Type: Boolean
Default: false
Flag to activate code coverage.

codeCoverageHost

Type: String
Default: NONE
Code coverage host machine address.

codeCoveragePort

Type: String
Default: NONE
Code coverage host machine port.

codeCoverageOptions

Type: String
Default: NONE
Code coverage options.

fileBuildRank

Type: String
Default: NULL
File associated variable used to control the order of unit test execution. Unit tests are executed in the order of the number associated. So, 1 is executed first, 2 is executed second. Test cases with the same value are executed in the same rank. The order within a rank is undefined. Unranked unit tests are executed last. Example:

variables:
  - name: fileBuildRank
    value: 1
    forFiles:  # these test cases are executed first
      - **/tests/eps*.bzucfg

logEncoding

Type: String
Default: IBM-1047
The file encoding of the JCL output log file.

maxRC

Type: Integer
Default: 4
Maximum JCL step return code to indicate a successful test case execution.

useHLQ

Type: String
Default: &SYSUID.
Since 3.0.2: Optional variable to override the default SYSUID.

reportTag

Type: String
Default: UTF-8
Since 3.0.2: File tag of the generated XML report. It changes the tag but not the file encoding. This report is encoded by zUnit and Test Accelerator for Z (TAZ).

  • For zUnit, default encoding is the same encoding as the .bzucfg file. You can also set jobParm to UTF=Y to encode in UTF-8 or to UTF=N to encode in IBM-1047. See Replaying a recording for more information.
  • For TAZ, the report file is always encoded UTF-8.

Build Context (advanced)

In addition to the YAML variables provided by users in the DBB YAML configuration files, some tasks look for inputs and generate outputs to the zBuilder Build Context. The Build Context is a dynamic storage area passed into each task being executed by the zBuilder and is used for task-to-task communication.

Build Context inputs

Keyword Type Source Description
HLQ String Start High-level dataset qualifier.

Build Context outputs

None