Integrated Testing Helper

Overview

This is a Open Tools API plugin for Delphi and RAD Studio that allows you to run command-line application before and after the compilation of you projects. It also provides the ability to zip you projects files into an archive on each compile/build and manage the application's version information.

Supported IDEs

The supported IDEs are as follows:

  • Borland Delphi 7
  • Borland Developer Studio 2005*
  • Borland Developer Studio 2006
  • CodeGear RAD Studio 2007
  • CodeGear RAD Studio 2009
  • Embarcadero RAD Studio 2010
  • Embarcadero RAD Studio XE
  • Embarcadero RAD Studio XE2

*I do not have an installation or compiler for this version so can only assume there are no problems based on functional version higher and low than this version. Additionally this add-in does work in XE7 however they have changes some of the behaviour of the IDE which prevents dependant build EXEs from being run (i.e. a DUnit project as a dependant project which is run after compilation fails as some aspect of the IDE immediately deletes the EXE before compiling the main project.

This files for the Integrated Testing Help can be download from this link.

For information on installing this expert please refer to my post Compiling and Installing my experts and wizards….

Compilation Tool Behaviour

The tool detects error codes being returned from the command-line programs and will stop with a failure messages IF the ERRORLEVEL is greater than 0 (zero).

Output

Output from the command-line applications is captured and placed in the Build Message window along with all the compiler messages. Green messages are successful runs and red messages are failures (These colours can be re-configured in the Message Fonts dialogue).

Note: The zipping functionality requires a base directory from which all files are zipped if you are using relative paths. The default WinZip settings use relative paths so you must specify a directory sufficiently towards the root of the drive to avoid WinZip complaining about “..” relative paths when you open the archive.

Enable Options

This dialogue allows you to enabled or disabled various parts of the Integrated Testing Helpers functionality for the whole of the project group (all projects in the group).

EnabledOptions

  • Enable: This enables or disables ALL options for ALL projects in the project group;
  • Before Compilation Tools: This enables or disables the running of tools before a project is compiled for ALL projects in the project group;
  • After Compilation Tools: This enables or disables the running of tools after a project is compiled for ALL projects in the project group;
  • Zipping of Project Files: This enables or disables the zipping of the project files for ALL projects in the project group;
  • Increment Build on Successful Compilation: This enables or disables the incrementation of the projects build number after a successful compilation ALL projects in the project group;
  • Build Project Version Information Resource: This enables or disables the building of the projects version information resource for ALL projects in the project group;
  • Copy Project Version Information: This enables or disables the copying of build number information from one project to another for ALL projects in the project group.

Global Options

This dialogue allows you to configure the global options that affect the way the application is configured and is applicable to all projects.

GlobalOptions

  • Group Messages into their own tab – This places the messages that are output by the add-in and the external tools, to be output into a dedicated message tab rather than among the standard compiler messages;
  • Auto Scroll Messages – This option scrolls the message view to the last message automatically as they are added;
  • Zip Executable – Here you can now specify the command line archiving executable you wish to use to “Zip” the project information;
  • Zip Parameters – Here you can now specify the the archiving parameters to be passed to the above executable. There are three macros which are expanded by the system and they are as follows:
    • $REPSONSEFILE$ This is the file name containing a list of all the files to be zipped which is created by the Integrated Testing Helper. Used in combination with the @ switch of WinZip or 7Zip;
    • $ZIPFILE$ This is the name of the zip file specified for the current compiling project's archive (see Zip Options);
    • $FILELIST$ This inserts a space separated list of double quoted files names into the command line for zipping.
  • Switch to Messages after a Successful Compile – This option switches to the helper messages if the last compile was successful;
  • Clear Messages After Period of Time (seconds) – This allows the message list to be cleared if the last compile was more than the specified period of time ago. If you do not want the messages cleared set this to 0 (zero).
  • Shortcuts

    This list view allows you to assign IDE shortcuts to all the actions that the Integrated Testing Helper defines in the IDE.

    To assign a shortcut, select the action in the list, enter the shortcut in the shortcut edit control below by pressing the shortcut combination you want to use and then pressing the Assign button.

    Configure Check for Updates

    This option allows you to configure the Check for Updates on application startup by enabling this option (disabled by default) and specifying the interval between checks in days.

    CheckForUpdates

    The next time the application is started (if Check for Updates has never been run before) the application will check the internet for updates.

    Note

    These settings are stored in a single INI file named ITHelper#### Settings for USERNAME on COMPUTER.ini in your Application Data directory under your profile.

Project Options

This dialogue allows you to specify various optiosn for the specifiy project you are compiling.

ProjectOptions

  • Extension Warning Exclusions – This option allow you to define a semi-colon (;) separated list of file wildcard (only the * is supported but in multiple positions) extensions for resource files you DO NOT want warnings about where they are not bound to the project using an RC file. NOTE: Even with these warning disabled these resource files are still zipped to the archive.
  • Increment Build On Compile – This increments the build number of the compiled project after a successful compilation.
  • Copy Version Information From – This has been updated to reference an executable file rather than the target of another project in the project group. This then allow you to get the version number from another project executable even if its compiled with another version of the compiler.

Version Information

Due to problems with the Open Tools API in Delphi XE2 I have been forced to manage version information for the project manually. The reaso for this is that although you can get the version information for a project in XE2 and change the value, these values do not end up in the compiled project UNLESS you open the project's options dialogue and press OK. If you don't do this, the changes are even lost of closing and saving the project.

  • Enable ITHelper Version Control – This option enables the creation of a resource file managed by ITHelper. You need to ensure that the IDE does not include version information in the project's main resource as you will get duplicate version resource messages;
  • The Major, Minor, Release and Build numbers refer to the version information and if this is enabled it is these numbers that are incremented or changes through the increment on compile and copy version inforamtion items above.

The table below allow you to specify additional version information. Note: The FileVersion items is automatically updated when the numbers above are changed.

  • Include Resource In Project – This make ITHelper add the resource files (RC), which it builds, to be included in the project and therefore managed by the project;
  • Compile the Resource with BRC32 – This pre-compiles the RC file into a RES file. You only need to use this on early compilers where the IDE does not do this for you or where you want to manage the RES file manually;
  • Resource Path Name (exc Ext) – This is the name of the resource (RC) file that ITHelper will create which will contain the version information and optionally be included in the project. You MUST not include the extension and you can specify relative paths (not full paths). The relativity is with respect to the main project file.

Note

These project settings are stored in a ProjectName.ITHelper ini file in the same directory as the project.

Compilation Tools

The same dialogue is used for both the before and after tools. In this dialogue you can configure command line tools to be run before or after each project compilation.

For instance, you might want to run a set of unit tests before compiling the code (if you use project dependencies, this works well) and run deployment code after, say building a setup programme for installation, after compilation.

CompilationTools

If you press the Add button or select an existing item and press Edit you will be presented with the below dialogue for editing the information associated with a tool.

ProgrammeInfo

  • Title – This is a descriptive title you can enter to help you understand what the tool does, especially if you run the same executable / batch files multiple times but for different reasons;
  • Programme – This is the executable or batch file you want to run. It does not need double quotes if the file name has spaces;
  • Parameters – These should the any parameters your executable or batch file requires to run. You do need to place double quotes around parameters that have spaces in them;
  • Working Directory – This is the directory where the application should be run from and act as the applications current directory. This also does not need double quotes for paths with spaces;
  • Starting Window State – This is not applicable to this application.

The above dialogue allows the use of a number of macros that are expanded by the system. These have been implemented to allow the information to be more portable in line with moving all the project information into their own INI files along side the project file. The available macros as as follows:

  • {$PROJDRIVE$}: This is expanded to be the drive letter and colon of the project file;
  • {$PROJPATH$}: This is expanded to be the drive and path of the project file with a trailing backslash.

This dialogue remembers its size and position separately for both the before and after tools.

Like the Project Options this information is stored in an INI file with the extension .ITHelper along side the project file.

Zip Options

This dialogue allows you to configure the zipping of all the project's files into a ZIP file using an external command line ZIP utility like WinZip or 7Zip. The command line ZIP utility is configured in the Global Options dialogue.

ZipOptions

  • Enable Zipping – This enables the zipping of the project's files after a successful compilation;
  • Zip Path – This is a base path from which all relative path in the zip file will be referenced;
  • Zip Filename – This is the path to the zip file where you want the information to be archived;
  • Additional Files – This is a list of file names or patterns that can be used by the ZIP utility to add additional files to the zip archive that are not part of the project;
  • Patterns to Exclude – This is a list if wildcard patterns that will be passed to the zipping utility and will be excluded from the zipping process.

This dialogue can accept the same macros that are defined in the Project Options dialogue.

This dialogue remembers its size and position.

Like the Project Options this information is stored in an INI file with the extension .ITHelper along side the project file.

Message Fonts

This dialogue allows you to configure the fonts that are used for the messages that are output by the add-in during the various phases of the compilation process.

MessageFonts