To test the functions of MapWindow it is possible to create a
These test scripts are also used to confirm a reported issue.
Also test scripts are being generated to test all properties and methods of certain classes.
Like the Shapefile, Shape, Image and Grid classes.
Use SVN and download the folder: http://svn.mapwindow.org/svnroot/TestingScripts/
Use TestingScriptTemplate.cs.txt as your base test script.
The naming convention of the test scripts is:
Classname_Method_Property for testing
For example: Shapefile_CacheExtents or MapWinGeoProc_DataManagement_CopyShapefile
Naming a script to confirm a bug is: Bug-bugnumber-shortdescription, like Bug-1211-StopEditingTable
The name of a script to test a function is TestShortdescription, like TestImageFormats
In the mwGeoProc a new class called TestMethods is
It holds a set of methods that are very handy and easy to use in the test scripts.
If you create your test script using the template you'll have direct access to this class.
Scripts can be written in C# and VB.NET, but C# is
C# scripts need to be StyleCop compliant.
You can run the scripts manually by opening the script in
MapWindows script editor.
Start MapWindow, go to Plug-ins --> Scripts
You can also run the script in a more automated manner.
Copy System.Data.SQLite.dll and TestingTool.exe from http://svn.mapwindow.org/svnroot/TestingScripts/TestingTool/bin/Debug/ to the folder with MapWindow.exe.
Start the testing tool, change the location at the top to the
Hit the 'Refresh scripts' button and the scripts are loaded.
Scripts that start with '_' in the name are skipped.
Now you can check the scripts you want to run and hit the 'Run'
For every script an new instance of MapWindow is loaded and closed when the script has finished.
At the end a webpage will be shown with the test results.
Failed means the script was not successful, the reason can be the test failed or the script was not yet completed. Generated scripts fail by default because no test has been implemented.
OldScript means the script was not yet converted to the new test template or the script threw a compile error. Either way the script needs to be modified.
Successful means the test passed.
The testing tool is still in Beta and will be modified in the
next months. So make sure you grab the latest version now and
The tool is creating a new folder called _TestResults. In this folder will the test results files (xml) be saved and the SQLite database and the testresults.xsl.
The tool will check for the last two files and create them if they don't exist. So it is wise to delete testresults.xsl when you grabbed a new version of the tool to get the latest one. The database will no longer be changed.
How to create a test script
In the TestingScripts folder is a Solution file called
Open it and you'll get several projects:
The last project is to modify the TestingTool.
You can add your script to the two scripts project. Then you'll get code completion and can even build the project to check for compile errors.
Next you can copy and paste the code in MapWindows Script editor and run the script.
How to debug a test script
Using the DebuggingPlugin project you can debug your
Include your script in this project.
Open DebuggingPlugin.cs and change the call to ScriptMain in the method ItemClicked()
Set this project as startup project and run it. MapWindow will start and the plug-in will be loaded.
A new menu is added, select "Run test script" and your script will be executed and the debugger will stop at your breaking points.
Paulmeems 12:12, 29 September 2010 (UTC)