Open Forum

Automated Testing - Testing Validation Error Messages

  • 1.  Automated Testing - Testing Validation Error Messages

    TOP CONTRIBUTOR
    Posted 5 days ago
    Hi All

    I'm writing automated tests for one of our extensions (BC2020 wave 1) and I need to confirm that the validation message is correct as part of the test.

    Let's take a simple (made up) case

    Record.Field1 cannot be more than 2x it's current value.

    The extension would have an Subscription to the OnAfterValidateEvent and raise an error such as this:

    Error(StrSubstNo(QtyTooHighMsg, Format(MaxQty)));

    In the UI, I get the red X, and when I hover over it I see a message that is something like this "The number entered is too high. The max value is 20"

    So My test would create a record with value 10 and then do record.Validate(Field1, 25). My asserterror catches the error and the test continues,.but I want an assertion that the validation message did, in fact say "The number entered is too high. The max value is 20"

    I don't see any kind of HandlerFunction Attribute that I can use to test this. Did I miss something?

    If not, is there another way?

    Finally is here a way in the test to "click" revert?

    Thanks

    Mark

    ------------------------------
    Mark Anderson
    Director of ERP Systems
    Clesen Wholesale
    Evanston, IL
    ------------------------------


If you've found this thread useful, dive deeper into User Group community content by role