
I have an Action called 'Submit' on my card page. If this button is pressed without having line items it throws an error.
I am writing a test to test this functionality in the following way but failed.
[Test]
[Scope('OnPrem')]
procedure MyTest()
var
MyCardPage: TestPage "MyCardPage";
begin
MyCardPage.OpenEdit();
Asserterror MyCardPage.Submit.Invoke();
Assert.AreEqual(GETLASTERRORTEXT, 'There is nothing to release for the document of type %1 with the number %2.', 'Invalid error message.');
end;
What is happening is, once the MyCardPage.Submit.Invoke(); is getting executed, it takes me to code where the actual error is being thrown. I expected it to pass the test since it is an AssertError.
Any guidance as to how can I write this test will be highly appreciated.
Hi Mesam,
Assert Error is use where you know there is going to be an error and the execution doesn't stop on the error but moves to the next step.
As far as what it looks is that there is something missing because of which AssertError is not working to block the error and continue execution.
Thus, you are taken originally to where the error is occurring.
Refer docs.microsoft.com/.../devenv-extension-advanced-example-test
Let me know if you need help.