Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Home > Forums > Access Developers > Automated Tests by Mohammed Alateyah
Back to Access Developers    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
Automated Tests
Mohammed Alateyah 
     
9 hours ago
Hello,

I have been experimenting with automated tests in access however I am struggling with testing actual objects with code like forms or controls. I am trying to avoid the code making changes in the actual object but I have many functions that its job is to change state of stuff and I want to test if I can do that with automated tests or not
the add in I am using called rubber duck helped me a lot for logical tests but for testing UI and state change I find it challenging can you please help me?
Richard Rost  @Reply  
          
7 hours ago
Testing Access forms and controls is really integration testing. I wouldn't run those tests against your live front end or live data.

A good approach is to keep as much logic as possible out of the form module. Put the "change state" rules in regular procedures or class modules, test those with Rubberduck, and let the form code be a thin layer that calls them.

For the pieces that truly require a form, open the form hidden in a separate test copy of the database, set control values, call the procedure you want to test, and then check the resulting control properties or record values. For example:

DoCmd.OpenForm "CustomerF", WindowMode:=acHidden
Forms!CustomerF.Status = "Active"
Forms!CustomerF.UpdateStatus
Debug.Assert Forms!CustomerF.StatusLabel.Caption = "Active"
DoCmd.Close acForm, "CustomerF", acSaveNo


Changing a control's properties at runtime generally doesn't change the form's design. The important part is closing with acSaveNo and making sure your code isn't explicitly saving the form design. Bound controls are different, of course - changing their values can write to the underlying table, so your test database should use disposable test data.

I would make a separate test front end linked to a separate back-end copy. Then your tests are free to open forms, add records, change records, and delete records without risking production data. Think of the UI tests as a smaller set of smoke tests, while most of your detailed testing stays in ordinary VBA modules where Rubberduck shines.
Add a Reply Upload an Image
Next Unseen

 
 
What's This?

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 10/15/2026 7:37:57 PM. PLT: 1s