UnitTestHarness
1.0
Unit Testing Tool
|
#README #Quickstart Guide - How to execute your Unit Tests on your component
This document is a summary of the steps required to incorporate your Unit Tests into the EN-ICE-SCD Test Harness and run them. The steps apply to installation on Windows or Linux. A longer detailed description is contained in the original Test Harness design document, see: Doc/unitTestingDesign.docx
This document covers:
The harness source and documentation (including this Quickstart document) is all kept in SVN at https://svn.cern.ch/reps/en-ice-svn/trunk/tools/JCOP/Projects/Framework/Test/UnitTestingHarnessAndComponent File references in this current document are also valid relative to this root.
By the phrase "Unit Test Harness" we mean all of the following bullet points:
By default (or if you are not sure!) then install both of the above; however:
Install the component in the usual way, using the FwInstallation Tool.
The [ExampleOfAComponentToBeTested](ExampleOfAComponentToBeTested) folder contains the files of a typical, trivial JCOP-Framework-style software component. Below this folder are also included examples of Unit Test code for the trivial component itself. You should create files following this same structure in your component. A detailed description of the format and meaning of the individual files is given in the Doc/unitTestingDesign.docx
Especially, don't forget to provide a Unit Test configuration file (see Config\README.html) !!
Finally, (at risk of sounding recursive!) don't forget to TEST your Unit Test sources! Be sure to check your test*.ctl file(s) for syntax errors (and even execution errors?) before you invoke them with the harness. Your sources get invoked by the harness using "eval" and any error messages that come from your source can be a bit cryptic... A trivial panel with a simple button to execute and debug your test routine before you give it to the harness might well save you a lot of time :-)
Open the panel to run your tests. See also the help in the panel. As always, keep an eye on the PVSS_II.log file when running what is, after all, a WinCC-OA application.
The following commands may be typed directly into a command line or even executed from within a Jenkins job. The examples below assume that you have first cd'd to the *.*.
The basic command to run the unit testing harness is :
python runUnitTests.py
Available options can be viewed with -h as follows :
python runUnitTests.py -h
The Jenkins job must issue the appropriate command line command. An example of a Jenkins job configuration, that does this can be found at : https://svn.cern.ch/reps/en-ice-svn/trunk/tools/JCOP/Projects/Framework/Test/Hudson/jobs/UnitTestHarnessStart.
The SVN contains the master version. This job within Jenkins can be found at : https://icejenkins.cern.ch/view/SCD-Testing/job/UnitTestHarnessStart/.
Within the Unit Testing Harness SVN tree, you will find the following files and folders:
ExampleOfAComponentToBeTested : A very simple example "Framework" software component. These files follow the layout rules common to all JCOP Framework components, as expected by the JCOP Framework Installation tool. The folders within this ExampleOfAComponentToBeTested show where test files should be located and the naming conventions to follow. The example illustrates using :
The example files in folder *.* also show how to provide mock routines specifically for use during your tests.
The following files contain Magic Strings that must be set appropriately for your installation!
Is specified in Sources\Config\fwInstallationToolLocation.config
When pvssdev's password changes, you must update the file Sources\emuSvn.py
On Windows, we use Putty to access files on AFS. *Sources.py* specifies the hostname of any Linux machine that pvssdev can use to access files on AFS. Any handy machine will do. The current linux machine being used happens to be cvpc103.cern.ch but if this should ever change, you must specify the new machine in puttyGet.py
The following assert() routines have already been implemented for you in FwUnitTestComponent\scripts\libs\fwUnitTestComponentAsserts.ctl
END