Support Article

Unit Test: Leading zeroes data page parameter stripped

SA-32701

Summary



Data page unit test case execution fails as Pega strips the leading zeroes from the parameter value.

The data page under test expects a parameter, in the unit test case configuration we have provided a value for the parameter with 5 leading zeroes.

When the test case is executed, pega invokes the data page with the parameter value specified in the unit test case rule but without the 5 leading zeroes.

Unit test case is executing a data page with the parameter RelationID, the value for this RelationID is set to “000000110068281”
However when the data page is executed the leading zeroes in the parameter value are stripped and the data page is invoked with the value “110068281”. This causes the execution to fail.


Error Messages


Since the leading zeroes are stripped, the test case execution fails as the system of record expects a parameter with leading zeroes.
------------------------------------------------
.singh</pxCreateOperator>
<pzDocumentKey>RULE-TEST-UNIT-CASE RBG-DATA-RELATIONASCRIPTION TC_ED24F638CE025C23196C30A1DD8B86FB #20170113T095408.528 GMT</pzDocumentKey>
<pyDescription>Run and verify D_SelectAndGetAscriptionList data page with following parameters, <RelationID : 000000110068281></pyDescription>
<pyMemo>check in</pyMemo>
<pyRUTClassModified>false</pyRUTClassModified>
<pyActualElapsedTime>0.168</pyActualElapsedTime>



<pxObjClass>Embed-RuleUnderTest</pxObjClass>
<pyParamsAsString>RelationID="000000110068281"</pyParamsAsString>
<pxWarningsToDisplay REPEATINGTYPE="PageList"/>
<pyDetails>
<pyRuleUnderTestName>D_SelectAndGetAscriptionList</pyRuleUnderTestName>
<pyRuleUnderTestObjClass>RBG-Data-RelationAscription</pyRuleUnderTestObjClass>
<pyRuleUnderTestLabel>D_SelectAndGetAscriptionList</pyRuleUnderTestLabel>
<pxObjClass>Embed-RuleUnderTest-Details</pxObjClass>
<pyRuleUnderTestType>Rule-Declare-Pages</pyRuleUnderTestType>
<pyRuleUnderTestInsName>D_SELECTANDGETASCRIPTIONLIST</pyRuleUnderTestInsName>
</pyDetails>
<pyParameters REPEATINGTYPE="PageList">
<rowdata REPEATINGINDEX="1">
<pyParametersParamName>RelationID</pyParametersParamName>
<pxObjClass>Embed-MethodParams</pxObjClass>
<pyParametersParamValue>000000110068281</pyParametersParamValue>
</rowdata>
</pyParameters>
</pyRuleUnderTest>
<pyRuleVersionsList REPEATINGTYPE="PageList">

<pzIndexOwnerKey>RULE-TEST-UNIT-CASE RBG-DATA-RELATIONASCRIPTION TC_ED24F638CE025C23196C30A1DD8B86FB #20170113T095408.528 GMT</pzIndexOwnerKey>
<pzIndexes REPEATINGTYPE="PropertyGroup">
<rowdata REPEATINGINDEX="RuleReference">2</rowdata>
</pzIndexes>
</rowdata>
</pxRuleReferences>
<pyPagesAndClasses REPEATINGTYPE="PageList">
<rowdata REPEATINGINDEX="1">
<pxObjClass>Embed-PagesAndClasses</pxObjClass>
</rowdata>
</pyPagesAndClasses>
<pyUnexpectedResults REPEATINGTYPE="PageList">
<rowdata REPEATINGINDEX="1">
<pxObjClass>Embed-ExpectedResults</pxObjClass>
<pyAssertionType>ExpectedRuntime</pyAssertionType>
</rowdata>
<rowdata REPEATINGINDEX="2">
<pxObjClass>Embed-ExpectedResults</pxObjClass>
<pyAssertionType>Property</pyAssertionType>
</rowdata>
</pyUnexpectedResults>
<pxAPIMethodReferences REPEATINGTYPE="PageList"/>
<pyRMAction>
<pxObjClass>Embed-RuleManagement</pxObjClass>
<pyAction>save</pyAction>
</pyRMAction>
</pagedata>
</PrimaryPageContent><ParameterPageName>=unnamed=</ParameterPageName><ParameterPageContent><pagedata><RelationID>110068281</RelationID></pagedata></ParameterPageContent></TraceEvent><TraceEvent sequence="109" ruleNumber="" stepMethod="loading in thread scope" stepPage="" step="" stepStatus="GOOD" eventType="Data Pages" elapsed="" name="RULE-DECLARE-PAGES D_SELECTANDGETASCRIPTIONLIST #20170105T091436.084 GMT [RelationID:"110068281"]" inskey="RULE-DECLARE-PAGES D_SELECTANDGETASCRIPTIONLIST #20170105T091436.084 GMT" keyname="RULE-DECLARE-PAGES D_SELECTANDGETASCRIPTIONLIST #20170105T091436.084 GMT [RelationID:"110068281"]" rsname="RBGAppSvcAscription" rsvers="01-02-02" ><Sequence>109</Sequence><DateTime>20170113T095425.834 GMT</DateTime><EventType>Data Pages</EventType><EventName>Data Pages</EventName><Interaction>470</Interaction><ThreadName>TABTHREAD0</ThreadName><RequestorID>HFCA95EDDD9C63A9A3CF4C3DFB43D79CD</RequestorID><CorrelationID>HFCA95EDDD9C63A9A3CF4C3DFB43D79CD</CorrelationID><WorkPool></WorkPool><ActivePALStat>pxDeclarativePageLoadElapsed</ActivePALStat><FirstInput>Activity=pzRunActionWrapper</FirstInput><LastStep>RULE-TEST-UNIT-CASE PZRUNTESTUNITCASE #20160401T135713.190 GMT Step: 1 Circum: 0</LastStep><EventKey>RULE-DECLARE-PAGES D_SELECTANDGETASCRIPTIONLIST #20170105T091436.084 GMT [RelationID:"110068281"]</EventKey><StepMethod>loading in thread scope</StepMethod><mStepStatus>GOOD</mStepStatus><mStepStatusInfo></mStepStatusInfo><PrimaryPageName>D_SelectAndGetAscriptionList</PrimaryPageName><PrimaryPageClass>Code-Pega-List</PrimaryPageClass><PrimaryPageContent>


Steps to Reproduce



1) Create a data page with a string parameter.
2) Create a unit test case for the data page and specify a parameter value with leading zeroes.
3) Execute and trace the unit test case, check the parameter value passed to the data page.


Root Cause




As the engine proceeded the input parameter as Integer, the preceding zeros got truncated.

Resolution



If user do not want this to happen then user can open test case and there will be a gear(edit) icon on the parameter value, user can edit it and specify the values within double quotes. This will take the value as string and truncation will not happen.

Published January 20, 2017 - Updated February 15, 2017

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.