Automatic smoke testing of software, supporting:
- Key events
- Listening to log files, waiting for regexp
- Screen shots
$ java -jar defold-robot.jar -s [script] -o [output-dir]
A simple script in JSON:
{
"logs": {
"editor-log": {
"pattern": "editor2.*.log",
"dir" : "."
},
"engine-log": {
"pattern": "log.txt",
"dir" : "."
}
},
"steps": [
["await-log" "editor-log" 5000 "Project loaded"],
["press" "Shortcut+Shift+R"],
["type" ".coll"],
["press" "Down"],
["press" "Enter"],
["wait" 1000],
["screen-capture" "collection"],
["press" "Shortcut+Shift+R"],
["type" ".script"],
["press" "Down"],
["press" "Enter"],
["wait" 1000],
["screen-capture" "script"],
["press" "Shortcut+B"],
["wait" 10000],
["screen-capture" "build"],
["switch-focus" 1],
["type" "print('Now reloading')"],
["press" "Enter"],
["press" "Shortcut+R"],
["await-log" "engine-log" 5000 "Now reloading"],
["press" "Shortcut+Q"],
]
}
In brief, this script:
- Waits for the editor to say "Project loaded"
- Open a collection
- Open a script
- Run the game
- Hot-reload the opened script
- Wait for the engine to confirm it
Basically, the only complex part is listening for logging. There is a python script to aid in this, which writes to a log file based on user input:
$ python scripts/test_logging.py
- Edit the source
- Change the version in project.clj
- Release:
$ lein release