|
MBTestBench v2.50
for MapInfo Professional®.
Mar 11, 2007
A debug, program documentation and
test utility for MapBasic Applications.
MBtestbench provides debugging and automated test monitoring
of your MapBasic applications. Test monitoring and reporting is the
primary motivation for MBTestBench, although new MapBasic users should find
the debugging facilities to be of value.
A user environment comprising a number of applications written in different
languages, potentially has the MapBasic component as the weakest link due to
inadequate test facilities in the supporting tools for the language. Of course,
a very thorough test plan can make up for this but probably requires more work
to implement than in other programming environments. The nature of
MapBasic as a scripting-style language also provides a false sense of security
- the implication that it is less complex than other languages. In
fact, MapBasic applications can be as complex in lines of code, logic, data
accessed as programs produced in any language.
White-box testing is the process of using the application procedural
design to produce test cases which exercise all independent paths,
logical decisions, loops within and outside bounds, and data structures. This
is a very onerous process which MBTestBench will assist in performing. Most
applications are never tested adequately because of the nature of the test
process.
Black-box testing is the process of testing with user requirements as
the guideline. At the end of this process, MBTestBench will reveal whether the
testing has in fact exercised all portions of code.
|
|
The installed application provides free, unrestricted use of the release,
incremental and full compile, link and run functions. The debug and
metrics functions are not available.
The application provides free, unrestricted use of all functions for personal
and educational use. Personal use is defined by
a blank registered company name on the PC.
The application must be purchased and registered for commercial use. See About
> Registration Details for pricing and procedures.
|
|
Installation
Unzip and run MBTestBench.msi .
|
|
v2.5006 (11 Mar 2007) Changes:
-
The release version contains context sensitive help for the compile-time and
debug run-time applications.
v2.50 Beta 05 (7 Dec 2006) Changes:
-
(Beta 05) See update notice for further information. This update
introduces Multi-Language Capability.
-
MapBasic keywords are now read from the file mbtestbench.key. The
released .key file is compatible with MapBasic v8.5. This file may also be used
for language syntax definition within the Crimson
text editor.
-
If you wish to extend the released mbtestbench.key, find the appropriate
section labeled…
# ---------------- Statements ----------------------
# ---------------- Flow control statements ----------------------
# ----------- Functions - not required for MBTestBench parsing ---
and add your keyword. Take a backup of the original first. Note that inserting
in alphabetic order is not necessary. Removing keywords from the file may cause
incorrect parsing and incomplete debugging.
-
The only rule for adding statements is that sufficient keywords to define a
unique statement must be entered on the one line, without optional clauses.
(eg. Objects is incomplete; Objects Combine is
complete and correct; Objects Combine Into Target
is restrictive).
-
Previously long lines were truncated by MBTestBench. Corrected.
-
An MBP entry of “Application=..\appname.mbx” was compiled correctly
but was not found at execute time. This has been corrected for the release
build.
It is now
supported for the debug build. The name may be a simple filename (output
to the project file directory), a relative or complete path.
-
Previously, the call mapping
was limited in the number of links that could be found between procedures (sub,
function, dialog etc. references). This limit has been removed.
-
Call mapping progress is now indicated in the message window and on the status
bar.
-
(Beta 03) Previous beta was not generating debug code. Corrected.
-
Data validity checking improved (on MBP, KEY files).
-
Previous versions produced debug compile errors if ‘mapbasic.def’ was not
included.
-
Single .mb file projects were generating unnecessary error messages and not
detecting the mbx created at compile time. Note that an mbp file is required
for MBTestBench debug even though the project consists of just a single file.
v2.28 (15 Sep 2006) Changes:
-
"TextPad as code editor"
instructions provided on preferences dialogue.
-
Multiple compile errors followed by a link error would cause Next Error
to cycle on the first compile error only. Fixed.
-
Trailing comment on 'Sub ...' line was parsed incorrectly.
-
Full path to a module name in the MBP file now supported.
-
Run Release would sometimes not run the correct program if frequent
MBP project file switches. Fixed.
v2.26 (6 Apr 2006) Changes:
-
Optional MBX revision patch following link.
-
Select MBP project from recently-used list or by browse.
-
Registration dialogue upgraded.
v2.24 (29 Apr 2005) Changes:
-
Button pad reinstated at last user position.
-
Correction at startup to fix a MapInfo crash on some
configurations.
-
Registration dialogue provides Update Notification Service.
v2.23 (21 Mar 2005) Changes:
-
On first running MBTestBench, Run Release Application
sometimes couldnt find a previous linked MBX. Corrected.
-
Force Exit before recompile, link run preference option extended to
exit release and debug versions. Previously, only the current compile mode type
was checked and terminated.
v2.22 (05 Nov 2004) Changes:
-
Improvements to executing mapbasic.exe and
checking compile and link results.
v2.20 (17 Jun 2004) Changes:
-
Code block counts added to metrics. Click on module
name to see full breakdown for a particular procedure.
-
Some corrections to parsing.
-
Free for personal use. See registration dialogue for commercial use.
v2.00 (6 Oct 2003) Changes:
-
Parsing of source code 3 times faster through the use of a ‘c’ DLL
for this task. Call Mapping included as standard function in debug
build. (Call mapping buttons removed).
-
MapBasic ‘Stop’ option now supports a stop on every
subsequent line, with the ability to view local variables using the
MapBasic window. No need to add STOP statement to your code. Clear this check
box to continue normal debug operation. A warning is given if other Mapbasic
applications are running as STOP will not function. Exit all other apps and run
yourapp.deb.mbx
to enable this function.
-
Dialog handlers now
included in procedure map (calling sub
syntax supported).
-
Don’t delete debug source
option added. The default for version 2 is for debug source to be removed after
parsing and mbo creation.
-
Watch variable value change added. Pick from the global
variable list and add to watch list. Add and clear buttons
available. MBTestBench will break on any variable value change in the watch
list. This option is compute intensive and the watch check box
should be used to turn the option off when not required. Watch variables are
retained between sessions.
-
Procedure call map now
distinguishes subs, functions and handlers using font style. Style coding key
improved.
See MBtestbench.doc for earlier version details and documentation.
|
Release Version Compile and Link with a single button click.
Debug version, compile and link with single button click.
File time stamp check highlights include or source files which
are more recent than the executable. 
|
 |
Program Control

|
Current function and program step location are displayed in a
window. Use this display to add breakpoints and control execution. |
Global variable display
|
See global variable values at a glance with a single click.
Local variables may be displayed for any procedure by adding the
MBtestbench statement 'debug procedure to the source prior to
compile.
|
Add breakpoints

|
Add breakpoints by opening source modules and clicking on a function
and line of code.
Because of frequent breaks in MapBasic system handlers, these
procedure breaks may be skipped with the ignore handlers option.
|
Runtime trace of progress

|
To track progress of your application, display the current function
on the MapInfo status bar.
|

11:18:55 - CartoControl: 203: If CommandInfo(CMD_INFO_DLG_OK)
<> True THen
11:18:57 - CartoControl: 222: Call SavePref
11:19:09 - SavePref: 814: Dim tstr as String*100
11:19:09 - SavePref: 815: Dim i as Smallint
11:19:09 - SavePref: 816: Dim stprefs as String
11:19:09 - SavePref: 817: Dim sfilnum as Smallint
11:19:09 - SavePref: 821: OnError goto nodata
11:19:09 - SavePref: 822: open file ApplicationDirectory$()+"spCarto.prf"
for RANDOM as #1 len=100
|
Ever had that nagging application or MapInfo crash ? – probably due
to a coding error, but could be unexpected or corrupt data or a MapInfo fault.
Crash Tackle will write every executed line of code to a log file.
The time column gives you an additional reference. Yes, it slows execution, but
it is a method of isolating that piece of code. Check the box near your point
of failure or at the start of the application. |
Browse your source by function


|
Open a source module, pick a function and a line of code to set a
breakpoint. |
Call Stack

|
See the current procedure call stack with a single click. |
Automated testing


|
How thorough has your testing been?
Automated test functions allow a quick display of the number of
calls to each function in your program. Use this in support of
your application test plan. Print a report using the Map button.
Function timer shows millisec accurate counter for
each procedure and a total for the application.
|
Examine Table Contents

|
Want to examine the contents of that table you've just updated in
your code?
Dont fuss with browse statements in your code, try
LayMan - view the table and modify it in the middle of
your debug session!
|
Source Editor Link

|
During a debug session or whilst browsing the function list, jump to your
editor of choice with a single click. |
Tags for global variables, constants and procedures


|
Tag files are produced allowing quick reference to definitions. |
Program control
Step Into, Over, Out and Continue provide
basic functions to step through
your code. Click on a line in the source window and and step function
to achieve a Step to Cursor.
|
Standard debug program control. |
Usage Notes (v2.28) |
|
-
To minimise the impact of the debug code on your application at runtime, the
-.deb.mbx is 100% Mapbasic except for one system call to getsystemtime. The
parse and compile is written in ‘c’ and MapBasic. If your program does not
include a remotemsghandler
, one is added to the end of the last module. This is a sub reference only to
allow global variables to be displayed at runtime.
-
The MapBasic syntax parsing has been tested on many applications but is not
guaranteed to support all statement variations and the latest versions of
MapBasic. If a compile error results, you can edit the debug
source and comment out the offending line. Then continue with your debugging.
-
The FIND .... COMMANDINFO(CMD_INFO_FIND_RC) sequence of statements requires
that no other commandinfo triggering statements happen between the 2
statements. MBtestbench in line step mode, displays a dialogue at each
executable statement and thus will impact the use of COMMANDINFO. To avoid this
issue, do not break
between a trigger statement and the last relevant COMMANDINFO.
-
The Tools > Mbtestbench > Break at Next Line is an
equivalent to the Break
in VB but will only function with the last built application. It also requires
the program to continue to the next execute code line before the break occurs
(not sitting on a menu). A neater solution may be produced in a future version.
-
If your program contains code for menus, you must step into
the statements that add the menu to allow a break within the menu called
procedures (or add a breakpoint explicitly).
-
If you have a SELECT or UPDATE statement with an embedded user function, step
into will not step into the user function unless you have put an explicit
breakpoint in the function.
-
Step Over
in a loop (eg. On the Next statement in a For ... Next) will skip back to the
same statement.
-
MBtestbench has shown how some MapInfo handlers trigger multiple times and how
important it is to be aware of this in coding the contents. See other quirks of
your application that you may not have been aware of!
-
If you are a newcomer to MapBasic, you will find that Mbtestbench provides an
ideal learning tool to really understand the behaviour of your program in
detail.
Enjoy MBtestbench version 2!
|
|
|
|