Unable to create automated testing codeunits (handler functions not working)
it looks like it's not possible to properly create test codeunits as handler functions aren't supported:
[HandlerFunctions(MessageHandlerItem)]
local procedure CreateItem(var Item2 : Record Item);
begin
Item2.Init;
item2.Insert(true);
Message('Item %1 created',item2."No.");
end;
[MessageHandler]
local procedure MessageHandlerItem(Msg : Text[1024]);
begin
end;
The code above generates error message: error AL0242: Invalid attribute argument syntax: 'MessageHandlerItem'
The HandlerFunctions argument is a string literal. You need to single quote it.
We have a task on our backlog to change the textual reference to a symbolic reference, but for now it is just a string.
thank you for the answer - that helps. But in that case maybe txt2al should convert it correctly? This code was generated by txt2al.
It should;-) We will fix that.