Use a handler method to automate the user interaction of selecting a posting option when writing an automated test codeunit
Implement semiautomated test processes, and run standard Business Central tests
AnswerCorrect answer: B - use a handler method, such as a page handler, to automate the user interaction of selecting the posting option inside the test codeunit.
You must simulate the user interaction of selecting a posting option. The options must include: • Ship • Invoice • Ship & Invoice You need to create a test codeunit to run the test. What should you use?
Normal attribute
Handler method Correct Answer
Test attribute
Community Votes
B
100%
100% of anonymous learners picked answer B.
Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The test codeunit itself is marked with the Test attribute, but the simulation of the interaction is done by a handler method referenced through the HandlerFunctions attribute. Normal methods are just helpers and do not handle UI.
Automated tests in Business Central must handle UI interactions so they run without a user. A handler method, such as a page handler or confirm handler, simulates the user's choices, for example selecting Ship, Invoice, or Ship & Invoice in a dialog.
Do not confuse the Test attribute, which marks a method as a test, with the handler method that actually simulates the user interaction. Both are used together, but the interaction simulation requires a handler.
Community Discussion (3 comments)
e3b13ec👍 3Selected: B
The Codeunit running the Test need to have [Test] But to handle Ship|Invoice|Ship&Invoice you need a [PageHandler] -> B is the right answr
z_safar👍 1
The correct answer is C) Test attribute [Test]
Rahila_Amir👍 2
C: The Test attribute (C) is used to define a test codeunit that can simulate user interactions and test specific functionality. This is the correct approach.
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Log in to comment, report an error, or add a note about this question.
Expert Analysis
Why the Answer Is Correct
Option B is correct because handler methods are specifically designed to automate UI interactions, such as selecting a posting option in a dialog, so the test runs unattended. The Test attribute marks the test, but the handler method is what simulates the user's selection. Community voting favors B (100 votes), and e3b13ec explains that while the codeunit needs the Test attribute, simulating Ship, Invoice, or Ship & Invoice requires a page handler.
Why the Other Options Are Wrong
Option A (Normal attribute) describes an ordinary method used for structuring test code, not for handling UI interactions. Option C (Test attribute) marks a method as a test method but does not by itself simulate the user interaction; a handler method is still required for that. The combination of Test plus a handler method is needed, but the specific element that simulates the interaction is the handler.
Community Comment Notes
e3b13ec clarifies that the codeunit needs the Test attribute but handling the posting options requires a PageHandler, so B is the right answer; some lower-voted comments mistakenly suggest C alone.