Automated Testing: Check Validation Message

markcle
Member Posts: 65
Hi All
I'm writing automated tests for one of our extensions 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
I'm writing automated tests for one of our extensions 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
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions