Skip to the content

Community News

Addendum #02 – Including all extended pages in permissions testing

As promised in my first addendum post I would pick up one-by-one the out-scoped issues logged on the GitHub repo accompanying the book. This one took a bit longer because of my needed Xmas break and the fact that this one would need some to time get it done.

What was missing?

In chapter 8, test example 9, I discuss how to test permissions. In the context of the LookupValue case these tests can be divided into two groups:

  • Accessing the data, that is reading, inserting, modifying and deleting the data in the tables of our extension, being actually only one table: Lookup Value table. I call this direct data access.
  • Accessing the controls that relate to the data, being the Lookup Value Code field control on the various page extensions. I call this indirect data access.

The direct data access – first group – is addressed fully in the book. The indirect data access – second group -, however, only partly. This was due to the fact that this concerns altogether 36 pages and was too much work with too little importance to get it done at that time. I did define and implement the four following scenarios – for two pages – as examples to the rest:

[SCENARIO #0051] Check lookup value on customer card without permissions

[SCENARIO #0052] Check lookup value on customer card with permission

[SCENARIO #0053] Check lookup value on customer list without permissions

[SCENARIO #0054] Check lookup value on customer list with permissions

The permission tests for the other 34 pages were out-scoped and parked .

How was it fixed?

Finally, yesterday, I sat down to get the remaining permission tests done. 34 pages, 2 tests each, making up 68 tests! Wow, how to get this completed in as little as possible time?

Well, by extending the with the 68 additional tests scenarios and making use of the that I discuss in chapter 9.

I decided to number these scenarios starting from 0300 as it would not fit in between the numbers used so far, Note that 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 added later due to better understanding, reported omissions, etc.

Creating those 68 scenarios is a matter of copy-pasting the four example scenarios listed above and making use of some Excel functions to easily apply the relevant page names. This all leads automatically to relevant texts in the ATDD.TestScriptor Format columns input to the ATDD.TestScriptor module.

The test codeunit generated – this is the final result: – I completed by adopting some code from it’s and doing an additional round of copy-pasting. Yep, there is not a lot of reusability in this final result due to the fact that each page needs to be addressed by a unique TestPage variable.

In about 3 hours I added 68 tests – not a bad performance with less than 3 minutes per test – which are, due to my repo and pipelines setup, automatically executed in any next pipeline run.

These are the two tests for the Blanket Sales Order page:

procedure CheckLookupValueOnBlanketSalesOrderWithoutPermissions()
var
    BlanketSalesOrder: TestPage "Blanket Sales Order";
begin
    //[SCENARIO #0300] Check lookup value on Blanket Sales Order without permissions

    //[GIVEN] Full base starting permissions
    SetFullBaseStartingPermissions();

    //[WHEN] Open Blanket Sales Order 
    BlanketSalesOrder.OpenView();

    //[THEN] Lookup value field not shown
    VerifyLookupValueNotShownOnBlanketSalesOrder(BlanketSalesOrder);
end;

[Test]
procedure CheckLookupValueOnBlanketSalesOrderWithPermissions()
var
    BlanketSalesOrder: TestPage "Blanket Sales Order";
begin
    //[SCENARIO #0301] Check lookup value on Blanket Sales Order with permissions

    //[GIVEN] Full base starting permissions extended with Lookup Value permissions
    SetFullBaseStartingPermissionsExtendedWithLookupValue();

    //[WHEN] Open Blanket Sales Order 
    BlanketSalesOrder.OpenView();

    //[THEN] Lookup value field shown
    VerifyLookupValueShownOnBlanketSalesOrder(BlanketSalesOrder);
end;

Note

As both permissions 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.

Business Central: Send an appointment from Job Planning Line

Feature In addition to using Business Central in Outlook, a feature that I think is interesting is that of being

Happy Holidays!

Hey y’all. I just wanted to send my Holiday wishes to the community I value so much. It’s been another crazy year in terms of the world being upside down by this freaking virus. However, it has also shown us how strong this amazing community is – finding new ways to connect, share insights, or …

The “Universal Code Initiative”

A few months ago, I blogged about a new initiative from Microsoft: Microsoft Dynamics 365 Business Central Publisher program. At Directions EMEA, we got more insights to the program. There is still the same focus and intention – but with a different approach and name. I’d like to go more into details on that, as …

Azure AI in Business Central – The Forecasting Model

Azure AI in Business Central – The Forecasting Model AI (Artificial Intelligence) can be used with Business Central; there are

Addendum #01 – Scenario 0032 ‘Test that lookup value shows on standard Customer – List report’

Those who have already acquired and started to read might have discovered that there is a GitHub repo accompanying the book. They also might have seen that a number of out-scoped issues have been already listed. Issues I was going to handle after the book would published. So, here I am with my first addendum to the book tackling the incorporation of the new report extension object introduced in 2020 wave 2, aka BC18. When I was working on this part of the book – i.e. Chapter 8, test example 8 – there was a bug in the AL Language extension which made me decide to not yet include the report extension in the book. Instead I out-scoped it and parked it next to a handful of other issues. Now the book is published I will pick them up in the coming weeks and share them with you in a series of addendum posts.

This addendum is about a new scenario that addresses an additional customer wish, or ATDD scenario:

[FEATURE] LookupValue Report
[SCENARIO #0032] Test that lookup value shows on standard Customer – List report
[GIVEN] 2 customers with different lookup value
[WHEN] Run standard report Customer – List
[THEN] Report dataset contains both customers with lookup value

This introduces the following report extension object:

reportextension 50000 "CustomerListExt" extends "Customer - List"
{
    RDLCLayout = './reportlayouts/CustomerListDefault.rdl';

    dataset
    {
        add(Customer)
        {
            column(Customer_Lookup_Value_Code; "Lookup Value Code")
            {
                IncludeCaption = true;
            }
        }
    }
}

And of course the implementation of the test scenario in a new test method. You can find the added code in the GitHub repo.

Telemetry in BcContainerHelper 3.0.0

BcContainerHelper 3.0.0 just released and as something new, you will see this message when importing the module: BcContainerHelper emits usage statistics telemetry to Microsoft What does that m...()

Best Practices for (Per Tenant) Extensions | Protect Yourself

Time to get back to Best Practices for Per Tenant Extensions. This time we are going to discuss something that in my opinion should also be implemented by ISV’s in their AppSource solutions. By default, AL Objects are extensible. This means that everyone can take a dependency on your extension and therefor Microsoft does not

Contributing to “ALGuidelines.Dev”

I recently blogged about this new initiative .. the revival of the “NAV Design Patterns Wiki”: ALGuidelines.Dev . Time to talk a bit more on how you can contribute. I’m documenting this while I’m writing my very first pattern 😉 (I admit, I had this blogpost laying around for a while ;-)). Disclaimer We do …

Oh, TempBlob! What did you do?

The alternative title for this blog post would have been something like… TempBlob, why did you waste my time! Or waste thousands of hours accross our community. The topics of my blogs tend to be about what happens in the freelance projects I work on, and last week this was two extensions that have a