How to test an action in a test codeunit ?

Hey guys,

I have created an action in a page extensions and now I want to test its functionality.

trigger OnAction()
                var
                    Resource: Record Resource;
                    Handled: Boolean;
                begin
                    OnBeforePrint(Handled);
                    if not handled then begin
                        Resource.SetRange("No.", "No.");
                        ResourceLabel.SetTableView(Item);
                        ResourceLabel.RunModal();
                    end;
                end;

Do you have an idea?

Do I have to test all actions, which I have created for my extension?

Parents
  • Basically your extension tests have to show that your extensions is doing what it should do. From that the answer to your question is: yes. You can test actions using a test page object. But you could also embed the implementation of your action (and I reckon this to be best practice) in a method on the page (or preferably in a codeunit). Then you can test the method separate from a UI.

Reply Children
Related
Recommended