update: Olivier improved upon the proposal and implemented it:
test data tool proposal
Requirements
- Aparna and others should be able to create test/example data by hand, so that particular cases can be covered
- Facilitate creating relatively large amounts of data
- Create content items (with OOTB schemas) and item collections
Non-requirements
- We don't need the tool to support the creation of blocks, kinds, or items generally
- We don't need the tool to be able to support references to other existing data, it can create a self-contained data set that depends on the OOTB schema.
- No need to round-trip through the tool, just used for one-time creation of test data.
- Tool does not need to generically support creation of instances of any content item, but can support a well defined list of OOTB Kinds.
Proposal
- Use a spreadsheet tool for data entry
- Generate csv data file from the spreadsheet tool
- Write a python script to populate a repository with the items (from the csv data file)
File Format
- Row of Kind, expected attributes, followed by rows of data
- First column for data row contains # to refer to that item
- Values can contain links to other items using reference #
- Values can contain literal data, data is interpreted as the expected type of the attribute
- For attributes that accept multiple values, list multiple values separated by commas (listed in quotes in a generated csv file)
Example files
- TestData.csv
- TestData.txt
- TestData.xls
- The example isn't complete -- will need to handle mail and stamped variations, for example
- The python script could parse either csv or txt file, whatever is easiest
| Collection | displayName | | | | | | | | |
| 1 | Home | | | | | | | | |
| 2 | Work | | | | | | | | |
| |
| Note | displayName | collection | createdOn | | | | | | |
| 3 | reading list | 1, 2 | 1/11/2005 | | | | | | |
| 4 | restauraunt recommendations | 1 | 5/5/2005 | | | | | | |
| |
| Task | displayName | collection | dueDate | | | | | | |
| 5 | read paper | 1 | 6/25/2005 | | | | | | |
| |
| CalendarEvent | displayName | collection | startTime | anyTime | allDay | duration | reminderTime | location | importance |
| 6 | party | | 7/4/2005 | | | 5 | | | |
| |
| EventTask | displayName | collection | startTime | anyTime | allDay | duration | reminderTime | | |
| 7 | meeting | 2 | 6/30/2005 | TRUE | | | | | |
Notes on implementation of python script
- Look at osaf/contentmodel/tests as examples (including GenerateItems)
- Look at import/export code as example
- Result of script should be the creation of a test repository that can be checked in and re-used over and over again
Possible improvements
- Make use of spreadsheet features to format spreadsheet for easier reading/data entry
- Spreadsheet features to automatically generate the reference #s
- Some token (e.g. "*") could indicate that the python program should generate appropriate semi-random data for the field
- Shortcuts for usability: e.g. make collection column accept name of collection instead of reference #
I'm sure the implementor of this tool can/will think of other improvements and variations of this proposal, and should feel free to implement them if they are in the spirit of the requirements.