Options

Testing function for BC.

mysamzamysamza Member Posts: 66
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.


Sign In or Register to comment.