You are on page 1of 13

TAFJ-Ap plic a ti o n Te s t

Fra mework
R19
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

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-2018.
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

Tel SB: +41 (0) 22 708 1150


Fax: +41 (0) 22 708 1160

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

The ATF “Component”.......................................................................................................... 6

Global ATF Methods............................................................................................................. 8

ATF.runOfs(<OFSRequest>)............................................................................................ 8

ATF.setOfsSource(<OfsSource>).................................................................................... 8

ATF.setDescription(<a_description>)............................................................................... 8

ATF.mockData(<table>, <id>, <fm>, [<vm>, [<sm>] ] <value>)....................................... 8

ATF.isRequestCommitted().............................................................................................. 8

ATF.reset()....................................................................................................................... 8

ATF.setDate(dd, mm, yyyy).............................................................................................. 8

ATF.setTime(hh, mm, ss)................................................................................................. 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

Creating a new Application Test, full example.................................................................... 10

Running tests...................................................................................................................... 11

In console mode............................................................................................................. 11

Running multiple tests at once....................................................................................... 12

Return value.................................................................................................................. 12

In Eclipse....................................................................................................................... 13

The “result” view................................................................................................................. 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.mockData(<table>, <id>, <position>, <value>)

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.setDate(<dd>, <mm>, <yyyy>)

ATF.setTime(<hh>, <mm>, <ss>)

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. s e t O f s S o u r c e ( < O f s S o u r c e > )


set the OFS Source name. Default is 'GCS'

ATF. s e t D e s c r i p t i o n ( < a_ d e s c r i p t i o n > )


Define the description of this test.

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.

Value Marker and Sub-Value markers are optional.

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.

ATF. a s s e r t E q u a l s ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> is equals to <value2>, FALSE otherwise

ATF. a s s e r t N o t E q u a l s ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> is different than<value2>, FALSE otherwise

ATF. a s s e r tC o n t a i n s ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> contains <value2>, FALSE otherwise

ATF. a s s e r tTr u e ( < v a l u e > )


TRUE if <value1> is evaluated (jBC) to TRUE (same as IF <value1> ...)

ATF. a s s e r tF a l s e ( < v a l u e > )


TRUE if <value1> is evaluated (jBC) to FALSE (same as IF NOT(<value1>) ...)

ATF. a s s e r tGr e a t e rT h a n ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> GT <value2>, FALSE otherwise

ATF. a s s e r tL e s s T h a n ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> LT <value2>, FALSE otherwise

ATF. a s s e r t S t a r t s W i t h ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> Starts With <value2>, FALSE otherwise

ATF. a s s e r t E n d s W i t h ( < v a l u e 1 > , < v a l u e 2 > )


TRUE if <value1> Ends With <value2>, FALSE otherwise

ATF. a s s e r t M a t c h e s ( < v a l u e 1 > , < m a s k > )


TRUE if <value1> MATCHES <value2>, FALSE otherwise

This is the MATCH equivalent of jBC

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).

To help understanding it, here is a full example :

TESTCASE Test

$USING ST.CurrencyConfig

ATF.setOfsSource("GCS") ;* GCS is default value anyway for ATF

ATF.setDescription("OFS, AED test")

ATF.mockData("FBNK.CURRENCY", "AED", ST.CurrencyConfig.Currency.EbCurNumericCcyCode, "666")

response = ATF.runOfs("ENQUIRY.SELECT,,INPUTT/123456,%CURRENCY")

CRT response

ATF.assertContains(response, "1.29872")

ATF.mockData("FBNK.CURRENCY", "CHF", ST.CurrencyConfig.Currency.EbCurMidRevalRate, "0.12345")

ATF.setDescription("OFS, CHF test")

response = ATF.runOfs("ENQUIRY.SELECT,,INPUTT/123456,%CURRENCY,@ID:EQ=CHF")

CRT response

ATF.assertContains(response, "0.12345")

END

The output of such a test is the following :


. . .ll R a t e/DATE.TIM E::Ti m e S t a m p ,"AED" "6 6 6 " "2 " " " "1 " " 3. 6 7 2 5 0" "
3. 6 7 3 0 0" " 3. 6 7 2 0 0" "2 2 APR . . .

. . .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 :

MY.SUBROUTINE.b generate a class called MY_SUBROUTINE_cl.class

MY.SUBROUTINE.tut generate a class called testcase_MY_SUBROUTINE_cl.class

example : tRun MY.SUBROUTINE will try to run the class MY_SUBROUTINE_cl.class which
is wrong. You have to run :

tRun -test MY.SUBROUTINE in order to run testcase_MY_SUBROUTINE_cl.class.

So this is

tRun -test myTest

Where “myTest” is the name you gave here :

TESTCASE myTest

You can also run your test by specifying the full file name.

Example :

tRun -test /path/to/my/top/dev/directory/appTests/myTest.tat

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 :

tRun -test /path/to/my/top/dev/directory/apptests

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 :

tRun -test -recurs /path/to/my/top/dev/directory

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

1) One *.tat file

2) Multiple *.tat files

3) One or multiple directories (containing “at least” one tut file)


Right-Click - > Run (or Debug) As … - > BASIC Test

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

You might also like