CPIA Script
CPIA Script is a scripting system for Chandler's 0.6 release. CPIA Script allows rudimentary automation of Chandler's functionality. For the 0.6 release, the main goal of CPIA Script is providing a foundation for automatic testing, and secondarily as a developer productivity tool. The CATS automated testing system is built on top of CPIA Script.
User Perspective
See the
CpiaScriptUserGuide for the latest information on what you can do with CPIA Script.
There is a scripting module in Chandler that implements CPIA Script. It has a simple user interface, and a Script Kind so we can store scripts as Items in the repository.
Scripts are written in Python. This gives us the richness and flexibility to do almost anything in a script that you can do with parcels, etc. It also opens the door to security risks. For this reason Scripts are are never automatically executed. Chandler only executes scripts when you hit a function key, use a test menu item, or use a command-line parameter to explicity run a script.
Since scripts are just Python, what is there to CPIA Script? CPIA Script does a few things to make scripting easier:
- Script UI and infrastructure makes it easy to create, run, and store scripts. The script development is fully interactive, so it can be a convenient place to experiment with developing code against a running Chandler environment.
- Convenience objects are available to hide some of the complexity of our implementation of Chandler. Increasingly we're trying to make Chandler simpler rather than add more conveniences. We can view the current set of conveniences as a proposal for making Chandler more accessible for all python code.
- There is a User object that simulates a user and can produce some low-level events for testing.
See the
CPIA Script User Guide for the latest information on how to write scripts.
Under the Hood
Currently, the functionality of Chandler is only available through user actions. To get Chandler to do something, like read new email, you must press a key or select a menu item. Internally, many user events get translated into logical operations, and often there's some CPIA Event that drives the resulting activity inside Chandler. Hence CPIA Events are a primary focus for script execution.
Here's what happens inside Chandler when you are interacting with it and a CPIA Event is posted:
USER ACTION --> wx Widgets Event --> CPIA Event --> Subsystem Operation
The essence of CPIA Script is to provide a
programmatic way to post CPIA Events. The new picture looks like this:
USER ACTION --> wx Widgets Event --> CPIA Event --> Subsystem Operation
^
|
CPIA Script
CPIA Script allows us a way to jump past the USER ACTION to get to some Subsystem Operations. This has been handy for automating testing.
Future Directions
Here's a proposal for a simple Kind Builder to enhance Scripting to allow users to make simple parcels.
Projects.KindBuilder
Summary
In the short term CPIA Script has given us some nice testing capabilities and it was pretty easy to build. In the medium term, it could be a useful developer productivity tool, and a fun way to see what's going on inside of Chandler. In the longer term, CPIA Script could become a full scripting language that really enhances user interaction with Chandler.
This is along the same lines of what I was thinking of trying to do more than a year ago, but back then CPIA wasn't around
The first thing that popped into my head is that if you have the script insert at the CPIA event level then you will not be able to test the UI widget set? There may be multiple widgets that trigger a single CPIA event - or is this not a concern?
--
MikeT - 03 May 2005
Mike, I've updated the plan to include the UI widget testing capabilities you've mentioned. I think this will be useful. In general I'm not concerned that multiple UI elements are connected to single events - we may not get full coverage, but we'll still cover a lot.