Addendum #05 – Include Lookup Value in Restore Archived Sales Document feature

In chapter 6 of my book, on pages 109 and 110, the data model and business logic changes for the Lookup Value business case are listed and discussed.

One way or another these changes are covered by most of the test examples worked on in the book. Accept for the two following business rules that were out scoped as too elaborative for the already packed authoring plan; and were setup up as issues on the GitHub repo for the book.

Now, with some extra hands available – see below – these could get implemented finally. With this post I am going to tackle the first item. The next addendum, #06, will cover the second one.

What was missing?

Although the Sales Archive subfeature did already emerge in the business logic in the first edition of the book, it was incomplete as Maarten Gerritsen, one of the reviewers of the second edition, justly reported. It did only cover the archiving part, not the restoring part. I decided to add it to the test plan breakdown exercise in chapter 6 of the second edition, and at the same time park it as an issue on GitHub (see the already mentioned Issue 10).

It was a great business case to get to learn some basic Business Central functionality and design and code test scenarios for the new apprentice, Jules Jägers, that joined 4PS a couple of months ago.

How was it fixed?

Jules planned, designed and coded the following 7 scenarios:

[SCENARIO #0100] Restore archived sales order with lookup value to sales order with changed lookup value.
[SCENARIO #0101] Restore archived sales order with empty lookup value to sales order with lookup value.
[SCENARIO #0102] Restore archived sales order with lookup value to sales order with empty lookup value
[SCENARIO #0103] Restore archived sales quote with lookup value to sales quote with empty lookup value
[SCENARIO #0104] Restore archived sales invoice with lookup value to sales invoice with empty lookup value
[SCENARIO #0105] Restore archived blanket order with lookup value to blanket order with empty lookup value
[SCENARIO #0106] Restore archived return order with lookup value to return order with empty lookup value
[SCENARIO #0107] Restore archived credit memo with lookup value to credit memo with empty lookup value

As like any testing with test automation choices have to be made on what scenarios are meaningful to implement/execute. The above 8 scenarios are a meaningful (enough) subset of all possible scenarios. It covers:

Scenarios #100, #101 and #102 cover the three basic scenarios for an archived sales order

  1. Restore overwrites a changed lookup value
  2. Restore empties a lookup value
  3. Restore populates an empty lookup value

Note that we could argue about a fourth basic scenario: Restore empties an empty lookup value.

Scenarios #103, #104, #105, #106 and #107

Each of them covering the first basic scenario for each of the other sales document types.

The test designs have been added to the ATDD sheet as shown in the screenshot below.

The scenarios have been coded in a new test codeunit LookupValueSalesArchive2.Codeunit.al as part of the final version of the Lookup Value extension (having separate app and test app).

Note that, like in Addendum #02 – Including all extended pages in permissions testing, the new tests have been assigned ids starting at 0100 for the reason mentioned there:

I often do use higher numbers for scenarios that are added later to make clear that the collection of scenarios is never complete. Scenarios keep on being added later due to better understanding, reported omissions, etc.

Note

As both test codeunits use identical helper functions there is clearly a need for refactoring. I decided, however, not to do this as it would introduce too many changes to the existing code and make repo too much different from what was released with the book.

A BIG thanx to …

Jules Jägers, a very talented apprentice at 4PS, for the design and coding all the test scenarios; what a great job you did.

Maarten Gerritsen, for his reviews, feedback and input on this topic.

Leave a Reply

Your email address will not be published. Required fields are marked *