Test example 12 – testing incoming calls: Lookup Value API
With this example, you learn how to test getting (using GET
), deleting (using DELETE
), modifying (using PATCH
), and creating (using POST
) data through an API.
Note
In this example, we focus on the structure and code of the automated tests that test an API, not on the flow of getting from a customer wish into test and application coding and also not on doing it the TDD way.
Application code
The object for our tests is a new page called Lookup Values APIV1
(50090) with PageType
set to API
and SourceTable
pointing to our Lookup Value
table. This API contains three columns:
id
based onSystemId
fieldnumber
based on theCode
fielddisplayName
based on theDescription
field
The full object can be seen in the GitHub repo: https://github.com/PacktPublishing/Automated-Testing-in-Microsoft-Dynamics-365-Business-Central-Second-Edition/blob/main/Chapter 13 (LookupValue Extension)/src/page/LookupValuesAPIV1...