Draft in Progress
This document is a draft and is under development.
Description
- Perform assertions about one or more log files, or one or more log file excerpts.
Attributes
List of assert-logs()
Attributes
- >> REF:
assertion-mode: - >>
Possible Values:
match-all
match-any
failure-id: - >> Type: string
log-defaults: - >> Type: object
(key-value pairs, comma-separated)
{
- >> REF:
}
Individual assert-logs()
Attributes
expected-log:
- An object. An instance of assert-log common properties.
expected-logs:
- A list of objects. Each is an instance of assert-log common properties.
assertion-mode:
- Valid values:
match-all
- Each expected log must match the criteria specified in its assert-log common properties.
match-any
- At least one expected log must match the criteria specified in its assert-log common properties.
failure-id:
- Identifier to use as a Failure ID if the log assertion fails.
log-defaults:
- An object. It is an instance of assert-log common properties.
- Any
log-defaults
property not specified for one of the expected logs will be applied as though it were specified.
Example
Location of expected-log-file
Log Excerpt Files
assert-logs
Code Example
- In the example below, all the
expected-log
conditions must be true, or the test will fail. - This is because
match-all
was specified forassertion-mode
. - In this example, there is actually only one log file, the one specified in log-name-pattern.
- The
expected-log-file
refers to a file that contains an excerpt of text, usually spanning several lines, that you expect to find in the log file.
@Database(id: 'qpt_pet', modes: ['src','lkp'])
@Database(id: 'edw', modes: ['lkp'])
@Database(id: 'qpt-bmw-plant', modes: ['src','tgt'])
class load_item_price_fact
{
@BeforeTest
setVariables()
{
set(variable: 'parm-key', value: '1234567890');
set(variable: 'population_date', value: '20130630');
}
@Test
insertOnly()
{
stage(
source: 'LOAD_PPF_INSERT_BUCKET_DETAIL',
target-table: 'BUCKET_DETAIL',
target-schema: 'DBO',
connection-id: 'qpt_pet',
mode: 'src'
);
// ... [more stage operations]
execute(
workflow: 'wkf_LOAD_ITEM_PRICE_FACT',
folder: 'EDW_QPT_TICKET',
run-instance-name:'1234567890',
context:
{
pet-connection-src: 'informatica.connections.qpt_pet.src',
pet-connection-lkp: 'informatica.connections.qpt_pet.lkp',
edw-connection-lkp: 'informatica.connections.edw.lkp',
bmw-plant-connection-src: 'informatica.connections.qpt-bmw-plant.tgt',
bmw-plant-connection-tgt: 'informatica.connections.qpt-bmw-plant.tgt'
}
);
assert-logs(
assertion-mode: 'match-all',
log-defaults: {
classifier: 'sessionLog',
log-name-pattern: 'log\\.1234567890\\.\\d{0,10}\\.\\d{14}$'
},
expected-logs:
[
{
expected-log-file: 'load_ipf_empty_ipf_src_loadsummary',
failure-id: 'FAIL_BAD_IPF_SRC'
},
{
expected-log-file: 'load_ipf_tld_src_loadsummary',
failure-id: 'FAIL_BAD_BLD_SRC'
},
{
expected-log-file: 'load_ipf_ins_tgt_loadsummary',
failure-id: 'FAIL_BAD_INS_TGT'
},
{
expected-log-file: 'load_ipf_empty_upd_tgt_loadsummary',
failure-id: 'FAIL_BAD_UPD_TGT'
},
{
expected-log-file: 'load_ipf_empty_del_tgt_loadsummary',
failure-id: 'FAIL_BAD_DEL_TGT'
},
{
expected-log-file: 'load_ipf_mapping_sample',
failure-id: 'FAIL_BAD_MAPPING'
}
]
);
}
}
Add Comment