“Nav 2013 Application Test Toolset” used in Nav 2013 R2

In a forum thread a user asked for a code coverage tool. Microsoft has developed the Nav 2013 Application Test Toolset, but did not deliver a version for Nav 2013 r2 or Nav 2015. It’s possible to import this Toolset in Nav 2013 r2, but … it does not work. There are some ugly error messages, when running. So i analysed the nav objects of the toolset and made the needed changes. When testing the toolset, especially the code coverage tool, i noticed, that many of the test codeunits are unnecessarily called during execution. So error after error occured. The reasons for the error messages seem partly conversion issues, version problems, changes in standard objects and bugs.

The list of codeunits, which need changes:
130002 Code Coverage Mgt
131301 Library – ERM Unapply
134012 ERM Reminder Apply Unapply
134386 ERM Sales Documents II
134976 ERM Sales Report
134984 ERM Sales Report III
136601 Config. Templates
136606 Config. Wizard & Worksheet
137065 SCM Reservation II
137067 SCM Plan-Req. Wksht
137400 SCM Inventory – Orders
137925 Test Assembly Reservation

Because, i assume, it would be a copyright violation, i do not publish the changed objects. So i describe the needed changes.

130002 Code Coverage Mgt

This CU uses a global variable Timer with (old) subtype “Microsoft.Dynamics.Nav.Timer, Version=7.0.0.0”. Replace the subtype by “Microsoft.Dynamics.Nav.Timer, Version=7.1.0.0”, which is shipped with Nav 2013 r2.
Before you replace the subtype copy the code of the triggers Timer::Elapsed and Timer::ExceptionOccurred to an external text editor. After replacing the subtype copy the code back to the triggers.

131301 Library – ERM Unapply

Function UnapplyCustomerLedgerEntry(CustLedgerEntry : Record “Cust. Ledger Entry”):
replace
GenJnlPostLine.UnapplyVendLedgEntry(GenJournalLine,DetailedCustLedgEntry);
with
GenJnlPostLine.UnapplyCustLedgEntry(GenJournalLine,DetailedCustLedgEntry);

134012 ERM Reminder Apply Unapply

Function CreateReminder(DocumentNo : Code[20];CustomerNo : Code[20])
replace
ReminderMake.Set(Customer,CustLedgerEntry,ReminderHeader,FALSE,FALSE);
with
// function interface (parameter list) was changed between the nav versions
ReminderMake.Set(Customer,CustLedgerEntry,ReminderHeader,FALSE,FALSE,CustLedgerEntry);

134386 ERM Sales Documents II

Function VerifyNavigateEntry(ExtDocNo : Code[20])
replace
Navigate.FindByItemReference.SETVALUE(ExtDocNo);
with
Navigate.ExtDocNo.SETVALUE(ExtDocNo);

134976 ERM Sales Report

Function SaveStatementReport(CustomerNo : Code[20];PostingDate : Date;PrintOverdueEntries : Boolean;PrintReversedEntries : Boolean;PrintUnappliedEntries : Boolean;IncludeAgingBand : Boolean;PeriodLength : DateFormula)
replace
Statement.InitializeRequest(
PrintOverdueEntries,TRUE,FALSE,PrintReversedEntries,PrintUnappliedEntries,IncludeAgingBand,
FORMAT(PeriodLength),DateChoice::”Posting Date”,FALSE);
with
Statement.InitializeRequest(
PrintOverdueEntries,TRUE,FALSE,PrintReversedEntries,PrintUnappliedEntries,IncludeAgingBand,
FORMAT(PeriodLength),DateChoice::”Posting Date”,FALSE,
DMY2DATE(1,1,DATE2DMY(PostingDate,3)),DMY2DATE(31,12,DATE2DMY(CALCDATE(‘<1Y>’,PostingDate),3)));

134984 ERM Sales Report III

Function [Test] CustomerStatementReportWithGenLines()
replace
Statement.InitializeRequest(
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,'<‘ + FORMAT(RandomNumberGenerator.RandInt(5)) +
‘M>’,DateChoice::”Due Date”,TRUE);
with
Statement.InitializeRequest(
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,'<‘ + FORMAT(RandomNumberGenerator.RandInt(5)) +
‘M>’,DateChoice::”Due Date”,TRUE,
WORKDATE,WORKDATE);

Function SaveCustomerBalanceToDate(No : Code[20];AmountInLCY : Boolean;UnappliedEntries : Boolean)
replace
CustomerBalanceToDate.InitializeRequest(AmountInLCY,FALSE,UnappliedEntries);
with
CustomerBalanceToDate.InitializeRequest(AmountInLCY,FALSE,UnappliedEntries,WORKDATE);

136601 Config. Templates

Function [Test] ValidateFieldWithTrigger_SkipValidationFalse_TriggerError()
replace
ASSERTERROR ConfigValidateManagement.ValidateFieldValue(RecRef,FieldRef,FORMAT(Item.”Costing Method”::Standard),FALSE);
with
ASSERTERROR ConfigValidateManagement.ValidateFieldValue(RecRef,FieldRef,FORMAT(Item.”Costing Method”::Standard),FALSE,0);

Function [Test] ValidateFieldWithTrigger_SkipValidationTrue_NoErrors()
replace
ConfigValidateManagement.ValidateFieldValue(RecRef,FieldRef,FORMAT(Item.”Costing Method”::Standard),TRUE);
with
ConfigValidateManagement.ValidateFieldValue(RecRef,FieldRef,FORMAT(Item.”Costing Method”::Standard),TRUE,0);

136606 Config. Wizard & Worksheet

Function [Test] VerifyImportPackage()
replace
ConfigSetup.ImportPackage;
with
ConfigSetup.ImportPackage(ConfigSetup.”Package File Name”);

137065 SCM Reservation II

Function [Test] ReleasedProdOrderComponentsPageWithLocation()
replace
ReleasedProductionOrder.Components.INVOKE;
with
ReleasedProductionOrder.ProdOrderLines.Action1901991404.INVOKE;

137067 SCM Plan-Req. Wksht

Function OpenProductionJournalForReleasedProductionOrder(ItemNo : Code[20])
Uncomment/Change
// ReleasedProductionOrder.ProductionJournal.INVOKE;

137400 SCM Inventory – Orders

Function VerifyNavigateLines(SalesHeader : Record “Sales Header”)
replace
Navigate.FindByItemReference.SETVALUE(SalesHeader.”External Document No.”);
with
Navigate.ExtDocNo.SETVALUE(SalesHeader.”External Document No.”);

137925 Test Assembly Reservation

replace
AsmHeaderReserve.CreateReservationSetFrom(
DATABASE::”Sales Line”,
SalesLine.”Document Type”,
SalesLine.”Document No.”,
”,
0,SalesLine.”Line No.”,
SalesLine.”Variant Code”,
SalesLine.”Location Code”,”,”,
SalesLine.”Qty. per Unit of Measure”);
with
WITH TrackingSpecificationFrom DO BEGIN
“Source Type” := DATABASE::”Sales Line”;
“Source Subtype” := SalesLine.”Document Type”;
“Source ID” := SalesLine.”Document No.”;
“Source Batch Name” := ”;
“Source Prod. Order Line” := 0;
“Source Ref. No.” := SalesLine.”Line No.”;
“Variant Code” := SalesLine.”Variant Code”;
“Location Code” := SalesLine.”Location Code”;
“Serial No.” := ”;
“Lot No.” := ”;
“Qty. per Unit of Measure” := SalesLine.”Qty. per Unit of Measure”;
END;
AsmHeaderReserve.CreateReservationSetFrom(TrackingSpecificationFrom);

Function TestCreateReservEntryForSOL()

replace
SalesLineReserve.CreateReservationSetFrom(
DATABASE::”Assembly Header”,
AssemblyHeader.”Document Type”,
AssemblyHeader.”No.”,
”,
0,0,
AssemblyHeader.”Variant Code”,
AssemblyHeader.”Location Code”,”,”,
AssemblyHeader.”Qty. per Unit of Measure”);
with
SalesLineReserve.CreateReservation(
SalesLine,
AssemblyHeader.Description,
AssemblyHeader.”Due Date”,
0,QtyToReserve,
”,”);

Function TestCreateReservEntForAsmLine()

replace
AssemblyLineReserve.CreateReservationSetFrom(
DATABASE::”Assembly Header”,
AssemblyHeader.”Document Type”,
AssemblyHeader.”No.”,
”,
0,0,
AssemblyHeader.”Variant Code”,
AssemblyHeader.”Location Code”,”,”,
AssemblyHeader.”Qty. per Unit of Measure”);
with
AssemblyLineReserve.CreateReservation(
AssemblyLine,
AssemblyHeader.Description,
AssemblyHeader.”Due Date”,
0,
QtyToReserve,
”,”);

Links:

cheers