{"title":"Test pages","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-testing-pages/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-testing-pages, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-testing-pages","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"This article explains the Test pages, their purpose and use.","date":"2022-08-12","meta":{"topic":"how-to"},"outline":[{"level":2,"title":"Access fields on test pages","slug":"access-fields-on-test-pages","at":1326,"chars":811},{"level":2,"title":"Access page parts and subpages","slug":"access-page-parts-and-subpages","at":2137,"chars":539},{"level":2,"title":"Filter data on test pages","slug":"filter-data-on-test-pages","at":2676,"chars":389},{"level":2,"title":"Invoke actions on test pages","slug":"invoke-actions-on-test-pages","at":3065,"chars":689},{"level":2,"title":"Navigate among records","slug":"navigate-among-records","at":3754,"chars":614},{"level":2,"title":"Related information","slug":"related-information","at":4368,"chars":143}],"text":"You use test page objects to simulate user interactions with the application. You can:\n View or change the value of a field on a test page.\n View the data on page parts.\n View or change the value of a field on a subpage.\n Filter the data on a test page.\n Perform any actions that are available on the page.\n Navigate to different records.\nYou can create and open a test page in the following ways:\n Declare a test page variable and then write AL code to open the test page by using one of the following methods:\n   methods-auto/testpage/testpage-opennew-method\n   methods-auto/testpage/testpage-openedit-method\n   methods-auto/testpage/testpage-openview-method\n Create a PageHandler or ModalPageHandler method that has a test page parameter.\n Write AL code to trap a call to open a test page by using the methods-auto/testpage/testpage-trap-method.\n> NOTE\n> You must consider how you set the TransactionModel Property<properties/devenv-properties> to simulate the scenario that you want to test and to return the database to its initial state after the test.\n> NOTE\n> Test methods and code on test pages run on the Dynamics 365 Business Central Server instance, even though they simulate client interactions.\nFor more information about the AL methods that you use on a test page, see methods-auto/testpage/testpage-data-type.\n## Access fields on test pages\nYou can access the fields on a test page by using the dot notation. For example, if you have a test page variable named CustomerCard that represents the `Customer Card` page, then to access the Name field on the test page, you'll write CustomerCard.Name in your code.\nThese fields are instances of the methods-auto/testfield/testfield-data-type, so you can use the corresponding AL methods to work with them. For example, if you have a test page variable named CustomerCard that represents the `Customer Card` page, then to assign the value of the No. field to a variable named CustNo, you write `CustNo := CustomerCard.\"No.\".Value` in your code. To write a value in the Address field of a `Customer Card` page, you write `CustomerCard.Address.Value := '<address>'` in your code.\n## Access page parts and subpages\nYou access page parts and subpages on a test page by using the dot notation.\nThese are instances of the methods-auto/testpart/testpart-data-type, so you can use the corresponding AL methods to work with them.\nFor example, to compare the value of the No. field on a page to the value of the No. field on a FactBox on the page, you can write the following code.\n```al\nif CustomerCard.\"No.\".Value <> CustomerCard.\"Sales Hist. Sell-to FactBox\".\"No.\".Value then\n  error(\"Page part data is not updated.\");\n\n```\n## Filter data on test pages\nTo filter the data that can be accessed on a test page, you use AL methods corresponding to the methods-auto/testfilter/testfilter-data-type instances. For example, to filter the customers on the `Customer List` page based on a range of values in the No. field, you can write the following code.\n```al\nCustomerList.Filter.SetFilter(\"No.\", '20000..30000');\n```\n## Invoke actions on test pages\nAny action that is available on a page is also available on the test page that mimics the original page. You access page actions by using the dot notation and the methods-auto/testaction/testaction-invoke-method.\nThese are instances of the methods-auto/testaction/testaction-data-type, so you can use the corresponding AL methods to work with them. To access built-in actions, such as Yes, No, OK, or Cancel you can also call the methods-auto/testpage/testpage-yes-method, methods-auto/testpage/testpage-no-method, methods-auto/testpage/testpage-ok-method and Cancel Method<methods-auto/testpage/testpage-ok-method> respectively, directly in the test page.\n## Navigate among records\nTo simulate moving to different items on a list page or to different records on a card page, you can use one of the following navigation methods:\n methods-auto/testpage/testpage-next-method\n methods-auto/testpage/testpage-previous-method\n methods-auto/testpage/testpage-first-method\n methods-auto/testpage/testpage-last-method\n methods-auto/testpage/testpage-gotorecord-method\n methods-auto/testpage/testpage-gotokey-method\n methods-auto/testpage/testpage-findfirstfield-method\n methods-auto/testpage/testpage-findnextfield-method\n methods-auto/testpage/testpage-findpreviousfield-method\n## Related information\nTesting the Application<devenv-testing-pages>\nTest the advanced sample extension<devenv-extension-advanced-example-test>"}