Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Automate page testing attach files

Posted on by 25

I want to automate the testing of attaching file purchase order.

The process of attaching file to purchase order as follow:

1. Click action File attachment from purchase order list

pastedimage1588425099899v1.png

2. It will open file attachment fact box. In file attachment fact box click import:

pastedimage1588425099902v2.png

3. When clicks on import, it will open file dialog box to select the file as below:

pastedimage1588425099907v3.png

I have written the code as below:

PurchaseOrderList.OPENEDIT;
PurchaseOrderList.FINDFIRSTFIELD("No.",'PO004312');
FileAttachment.TRAP;
PurchaseOrderList."File Attachments".INVOKE;
FileAttachment.NEW;
FileAttachment."<Action6>".INVOKE;
PurchaseOrderList.CLOSE;

Can you please suggest how to handle the opened file dialog box?

  • Suggested answer
    THE Italian Profile Picture
    THE Italian on at
    RE: Automate page testing attach files

    This is not possible since automated tests does not allow for an appropriate UI.

    See this hint

    simplanova.com/.../

    Your Dynamics 365 Business Central AL automated tests should be independent of any exterior programs or files. If it is not possible to avoid using an external file, try to find a way to create a dummy file inside the test and feed it as a real file to your solution. If your solution need’s to call for exterior services, create dummy services inside your test.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans