Professional Documents
Culture Documents
TAFJ-Application Test Framework
TAFJ-Application Test Framework
Fra mework
R20
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
Amendment History:
Revisio
Date Amended Name Description
n
1 7th August 2017 T. Aubert Initial version
Basheer
2 21st March 2019 R19 AMR review
Ahamed
3 26th March 2020 Dhanya J R20 AMR review
Page 2
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
C o pyri g h t
Copyright © Temenos Headquarters SA 2009-2020.
All rights reserved.
This document contains proprietary information that is protected by copyright. No part of this document may
be reproduced, transmitted, or made available directly or indirectly to a third party without the express
written agreement of TEMENOS UK Limited. Receipt of this material directly TEMENOS UK Limited
constitutes its express permission to copy. Permission to use or copy this document expressly excludes
modifying it for any purpose, or using it to create a derivative therefrom.
Err a t a a n d C o m m e n t s
If you have any comments regarding this manual or wish to report any errors in the
documentation, please document them and send them to the address below:
Technology Department
Temenos Headquarters SA
2 Rue de l’Ecole-de-Chimie,
CH - 1205 Geneva,
Switzerland
Please include your name, company, address, and telephone and fax numbers, and email
address if applicable. TAFJdev@temenos.com
Page 3
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
Ta b l e o f C o n t e n t s
Copyright................................................................................................................................................ 3
Errata and Comments............................................................................................................................ 3
Introduction........................................................................................................................... 6
TAT Overview....................................................................................................................... 6
ATF.runOfs(<OFSRequest>)............................................................................................ 8
ATF.setOfsSource(<OfsSource>).................................................................................... 8
ATF.setDescription(<a_description>)............................................................................... 8
ATF.isRequestCommitted().............................................................................................. 8
ATF.reset()....................................................................................................................... 8
ATF.resetDateTime()........................................................................................................ 8
Assertions methods.............................................................................................................. 9
ATF.assertEquals(<value1>, <value2>)........................................................................... 9
ATF.assertNotEquals(<value1>, <value2>)..................................................................... 9
ATF.assertContains(<value1>, <value2>)........................................................................ 9
ATF.assertTrue(<value>)................................................................................................. 9
ATF.assertFalse(<value>)................................................................................................ 9
ATF.assertGreaterThan(<value1>, <value2>)................................................................. 9
ATF.assertLessThan(<value1>, <value2>)...................................................................... 9
ATF.assertStartsWith(<value1>, <value2>)..................................................................... 9
ATF.assertEndsWith(<value1>, <value2>)...................................................................... 9
Page 4
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
ATF.assertMatches(<value1>, <mask>).......................................................................... 9
Running tests...................................................................................................................... 11
In console mode............................................................................................................. 11
Return value.................................................................................................................. 12
In Eclipse....................................................................................................................... 13
Important note.................................................................................................................... 13
Page 5
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
Intro d u c ti o n
The “Application” test framework is offering facilities to run OFS request and make
assertions. It is folowing the same approach of the UnitTestFramework (UTF) but require a
full running T24 (Libraries and Database running).
TAT Ov e rvi e w
A .tat file is a jBC file. However, the extension .tat is necessary to help the different tools to
discover the tests.
A tat, same as the tut is not a SUBROUTINE, neither a PROGRAM nor a FUNCTION. This is
a
“TESTCASE”.
So every tuts are starting with TESTCASE <name of test> as shown here :
We could wonder why this could not be a simple SUBROUTINE or PROGRAM, and later in
the document, everything will make sense. For now, we simply need to know that a
ApplicationTest is declared in the code with TESTCASE. Same as the UTF
Then, this is just jBC, anything jBC can do can be done in a tat. However, this would not be
really useful to stop at that point, and this is here that the TESTCASE declaration starts to
make sense. In fact, by using TESTCASE, this will automatically add a low-level reference in
the code.
If the file has the extension .tut, this is the UTF object reference which is made available. If
this file has the extension .tat, this is the ATF object reference made available.
T h e ATF “C o m p o n e n t ”
So we know now that a Temenos Application Test is a file with the “tat” extension that this is
written in jBC and that the declaration is “TESTCASE” because we need the “ATF
Component” which will help us doing a test. So let's look in details at this Component.
First, this is a low-level component, sitting into the runtime, so don't try to find something like
ATF.component on your disk, it doesn't exists. Then, this component is automatically “here”.
No need to do a $USING or whatsoever, it sits behind your code. You can consider it as a
language extension. Let's explore all these extensions. The full list :
Global methods :
ATF.runOfs(<OFSRequest>)
ATF.setOfsSource(<OfsSource>)
Page 6
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
ATF.setDescription(<a_description>)
ATF.isRequestCommitted()
ATF.reset()
Assertions methods:
ATF.assertEquals(<value1>, <value2>)
ATF.assertNotEquals(<value1>, <value2>)
ATF.assertContains(<value1>, <value2>)
ATF.assertTrue(<value>)
ATF.assertFalse(<value>)
ATF.assertGreaterThan(<value1>, <value2>)
ATF.assertLessThan(<value1>, <value2>)
ATF.assertStartsWith(<value1>, <value2>)
ATF.assertEndsWith(<value1>, <value2>)
ATF.assertMatches(<value1>, <mask>)
Date/time methods:
ATF.resetDateTime()
Page 7
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
Gl o b a l ATF M e t h o d s
ATF.r u n O f s ( < O F S R e q u e s t > )
This is the main method. run the given ofs request and return the response
ATF. m o c k D a t a ( < t a b l e > , < i d > , < f m > , [ < v m > , [ < s m > ] ] < v a l u e > )
Mock a specific data (field, [vm, [sm]]) for a given table / record.
ATF.i s R e q u e s t C o m m i t t e d ( )
Return true (1) if an update takes place
ATF.r e s e t ( )
Clear all mocked data, reset date/time and reset OFS source to default (GCS)
ATF. s e t D a t e ( d d , m m , yyyy )
Allow the test to set the date. This affects functions like DATE(), TIMEDATE(), TIMESTAMP(),
SYSTEM(12). The time is not modified. Note that the timezone is irrelevant.
ATF. s e t Ti m e ( h h , m m , s s )
Allow the test to set the time. This affects functions like TIME(), TIMEDATE(), TIMESTAMP(),
SYSTEM(12). The date is not modified. Note that the timezone is irrelevant.
ATF.r e s e t D a t e T i m e ( )
Reset (cancel any setDate() or setTime()) the date / time to the current / default one.
Page 8
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
As s ertio n s m e t h o d s
These methods are obvious and talking by themselves. If one of these method is evaluated
as “false”, the test will be in “failure”. Please refer to the “reporting” and “eclipse” chapters for
more details.
eg
ATF.assertMatches(P1, "3N4X")
P1 = "123ABCD" : TRUE
P1 = "123ABC" : FALSE
Page 9
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
Cr e a t i n g a n e w Ap p l i c a t i o n Te s t , f u l l e x a m p l e
There are no “facilities” to create a new Application test.
Just create a file having the “.tat” extension and define it with TESTCASE (same as tuts).
TESTCASE Test
$USING ST.CurrencyConfig
response = ATF.runOfs("ENQUIRY.SELECT,,INPUTT/123456,%CURRENCY")
CRT response
ATF.assertContains(response, "1.29872")
response = ATF.runOfs("ENQUIRY.SELECT,,INPUTT/123456,%CURRENCY,@ID:EQ=CHF")
CRT response
ATF.assertContains(response, "0.12345")
END
. . .ll R a t e/DATE.TIM E::Ti m e S t a m p ,"C H F" "7 5 6" "2 " " " "1 " "
0. 1 2 3 4 5 " " 0. 9 7 8 1 3" " 0. 9 5 8 1 3" "2 3 APR . . .
Runnin g tests
In c o n s ol e m o d e
Running a test is not very different as running a program. There is only one flag to specify : “-
test”. This flag is necessary as the class generated is prefixed with “testcase.” to not conflict
with the target subroutine.
Page 10
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
To resume :
example : tRun MY.SUBROUTINE will try to run the class MY_SUBROUTINE_cl.class which
is wrong. You have to run :
So this is
TESTCASE myTest
You can also run your test by specifying the full file name.
Example :
Run ni n g m ultiple t e st s at o n c e
You can also specify a directory. In that case, all tests in this directory will be run
Example :
Page 11
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
And last but not least, you can use the -recurs flag if you want to find tests resursively in a
directory and run them :
Example :
R et ur n valu e
In console mode, the exit value of tRun will be 1 if one or more test are failing. A success
value is 0.
Note that a failure can be something else than a wrong assertion. It can be a call to a non-
existing routine, a test without assertion, or any kind of technical failure.
Page 12
TAFJ-Ap plic a ti o n Te s t F r a m e w o r k
In Eclip s e
Running a test in eclipse consist of selecting
Automatically, a new window will open showing the tests and their results:
T h e “r e s u l t” vi e w
When running an Application test, the results will be shown in the same view as the
UnitTests, with one difference, there will be no code coverage (for obvious reasons).
Imp orta nt n ot e
The tat files are not running during a component build. Therefore, these are not taken in
consideration in the number of tests in the header of the JBC routines. Again, this is obvious
since there is no such a target routine in Application Tests.
Page 13