# StrMenuHandler attribute
> Version: _Available or changed with runtime version 1.0._
Specifies that the method is a StrMenuHandler method, which handles StrMenu statements.
## Applies to
 Method
> NOTE
> The StrMenuHandler attribute can only be set inside codeunits with the SubType property set to Test.
## Syntax
> Version: _Available or changed with runtime version 1.0._
```al
[StrMenuHandler]
procedure StrMenuHandler(Options: Text[1024]; var Choice: Integer; Instruction: Text[1024])
```
> IMPORTANT
> The above signature requires the StrMenuHandler method to be global. See https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/devenv-al-methods.md%23local-and-global-scope.
> Version: _Available or changed with runtime version 2.1._
```al
[StrMenuHandler]
procedure StrMenuHandler(Options: Text; var Choice: Integer; Instruction: Text)
```
> IMPORTANT
> The above signature requires the StrMenuHandler method to be global. See https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/devenv-al-methods.md%23local-and-global-scope.
### Arguments
Choice
Type: ../methods-auto/integer/integer-data-type
The option chosen in the StrMenu.
Instruction
Type: Text[1024]<../methods-auto/text/text-data-type>
The leading text.
Instruction
Type: ../methods-auto/text/text-data-type
The leading text.
Options
Type: Text[1024]<../methods-auto/text/text-data-type>
The list of the different option values.
Options
Type: ../methods-auto/text/text-data-type
The list of the different option values.
## Remarks
The StrMenuHandler method is called when a StrMenu method is invoked in code.
You use handler methods to automate tests by handling instances when user interaction is required by the code that is being tested by the test method. In these instances, the handler method is run instead of the requested user interface. The handler method should simulate the user interaction for the test case, such as validating messages, making selections, or entering values. You declare a handler type attribute on the method. Learn more about handler methods in Create Handler Methods<../devenv-creating-handler-methods>.
## Related information
AL Method Reference<../methods-auto/library>
devenv-method-attributes
Test Codeunits and Test Functions<../devenv-test-codeunits-and-test-methods>

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/attributes/devenv-strmenuhandler-attribute, 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. https://jonas-paprotka.de/docs/dev-itpro/developer/attributes/devenv-strmenuhandler-attribute/
