It has become difficult for me to manually maintain the Smart Office Mashups of my customer – there are about 50 files, 1,000 controls, and 10,000 lines of XAML – so I am developing a software verification tool that does automatic quality control for me.
How?
I defined a set of predicate rules, and I use XPath to validate the Mashup against those rules. I am using Python for now because of its expressiveness and interactivity, but I will port it to JScript.NET or C# soon to benefit from the Smart Office API.
Sample rule
As a sample rule, I want all the <m3:ListPanel> controls to have the property IsListHeaderVisible=”True” such that users have the ability to expand the list header and change the sorting order, view, and apply filters. If one of the list panels does not have that property I want to know about it and correct it. Note this is my own preference, and other developers may have the opposite preference.
Here is the property in Mashup Designer:
The following XPath expression will return the list panels not validating the rule:
//m3:ListPanel[not(@IsListHeaderVisible="True")]
Here is a Python code to validate that rule:
import os import glob import lxml.etree as etree for f in glob.glob(os.path.join(r'C:\RentalCounterMashup', '*.xaml')): tree = etree.parse(f) r = tree.xpath('//m3:ListPanel[not(@IsListHeaderVisible="True")]', namespaces={'m3': 'clr-namespace:MForms.Mashup;assembly=MForms'}) for element in r: print(f, element.attrib['Name'])
The result is the following, a list of XAML filenames and <m3:ListPanel> names that fail the rule:
Result
In my example, out of 63 list panels, 46 had the property, and 17 were missing the property, that’s 27% of list panels not passing the quality control. In other words, I was able to quickly identify a third of the list panels to correct.
Future work
I have many more ideas to implement, for example:
- Ensure there are no hard-coded values in the MForms Bookmarks, Links, and MForms Automation, such as hard-coded CONO or DIVI
- Automatically correct the Mashup, e.g. set IsListHeaderVisible=”True” if missing, and save
That’s it!
Let me know in the comments below if you have other rules to control the quality of Mashups.
Please click Like, share this post with your colleagues, click Follow to subscribe, come write the next blog post with us, and send some love to the other M3 blogs as well. This is a volunteer-based community, and your participation keeps the community alive and growing. Thank you.
Related posts
- Mashup quality control #1 – <m3:ListPanel IsListHeaderVisible=”True”>
- Mashup quality control #2 – icon buttons
- Mashup quality control #3 – Mashups
- Mashup quality control #4 – XAML
- Mashup quality control #5 – MForms Bookmark URIs
- Mashup quality control #6 – MForms Automation URIs
7 thoughts on “Mashup quality control #1”