Skip to content

RequestPageHandler Not Executing When Running Tests from VS Code #8233

Description

1. Describe the bug

When running AL tests directly from Visual Studio Code RequestPageHandler procedures are not being executed. However, the same tests run correctly and the RequestPageHandler executes as expected when using the Test Runner Framework in the Business Central client.

2. To Reproduce

Steps to reproduce the behavior:

  1. Create a test codeunit with a test procedure that calls a report with RunModal()
  2. Declare a RequestPageHandler in the test's HandlerFunctions attribute
  3. Use the VS Code "Run Test" or "Debug Test" to execute the test directly from the editor
  4. The RequestPageHandler procedure does not execute

Minimal code snippet demonstrating the issue:

codeunit 60060 MyTestCodeunit
{
    Subtype = Test;

    [Test]
    [HandlerFunctions('RequestPageHandler')]
    procedure RequestPageHandlerTest()
    var
        Customer: Record Customer;
        CustomerDetailTrialBal: Report "Customer - Detail Trial Bal.";
    begin
        Customer.FindFirst();
        CustomerDetailTrialBal.SetTableView(Customer);
        Commit();
        CustomerDetailTrialBal.RunModal(); // Trigger RequestPageHandler
        Error('Unreachable!');
    end;

    [RequestPageHandler]
    procedure RequestPageHandler(var CustomerDetailTrialBal: TestRequestPage "Customer - Detail Trial Bal.")
    begin
        // Do Stuff
        Error('Test Error from Request Page Handler');
    end;
}

3. Expected behavior

When running the test from VS Code, the RequestPageHandler should be invoked when CustomerDetailTrialBal.RunModal() is called. The test should fail with the error message "Test Error from Request Page Handler" from the handler procedure.

4. Actual behavior

The RequestPageHandler is not executed at all. Instead, the test continues past the RunModal() call and fails with the error "Unreachable!" from the test procedure itself.

The same test works correctly when run through the Test Runner Framework in the Business Central web client - the RequestPageHandler executes as expected.

Image Image

5. Versions:

  • AL Language: 18.0.2293710
  • Visual Studio Code: 1.115.0
  • Business Central: Version: DE Business Central 28.0 (Platform 28.0.48678.0 + Application 28.0.46665.48767)
  • Operating System:
    • Windows
    • Linux
    • MacOS

Final Checklist

Please remember to do the following:

  • Search the issue repository to ensure you are reporting a new issue
  • Reproduce the issue after disabling all extensions except the AL Language extension
  • Simplify your code around the issue to better isolate the problem

Activity

  1. BB97GER commented on Apr 14, 2026

    @BB97GER
    Author

    Familar with #8217

  2. aacnsilva commented on May 28, 2026

    @aacnsilva

    I'm facing the same issue. I have tests that set up some data in the Request Page via the RequestHandler that are not populated when running from vscode test tool, but work correctly when running the same test from the Business Central AL Tool.

  3. thpeder commented on Jul 28, 2026

    @thpeder
    Member

    Hi Bastian Benicke (@BB97GER)

    We have made a couple of changes since the issue was raised, and I believe this is fixed.
    Can you please have a try with the last preview build of the platform and AL Language extension.

  4. aacnsilva commented on Jul 29, 2026

    @aacnsilva

    Hi Thomas Pedersen (@thpeder), this is still not running from the vscode test runner.
    The tests fail running from vscode but run correctly from the BC AL Test Tool.
    They fail because the values are not being set/retrieved from the RequestPageHandler

  5. thpeder commented on Jul 29, 2026

    @thpeder
    Member

    What versions of the platform and tools are you using?

  6. aacnsilva commented on Jul 29, 2026

    @aacnsilva

    I'm using the following:
    Env:

    "platform": "28.0.0.0",
    "application": "28.0.0.0",
    "runtime": "17.0"
    

    Version: W1 28.0 (Platform 28.0.48460.0 + Application 28.0.46665.48549)

    Tools:

    Image
  7. thpeder commented on Aug 5, 2026

    @thpeder
    Member

    Thanks for the reply.

    I have made the change in version 28, so one option is for you to wait for it to get rolled out, another option is to try out version 29 by provisioning a new preview Sandbox environment or getting a docker image for version 29.

  8. thpeder commented on Aug 12, 2026

    @thpeder
    Member

    I'll close the issue, Please open a new one if you still encounter the issue in a version 29 or a recent build of 28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions