This documentation relates to an earlier version of Bamboo.
View

Unknown macro: {spacejump}

or visit the current documentation home.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

This page describes how to configure a PHPUnit builder for a Job.

When creating a new Job or configuring an existing one, you need to specify which builder should be used for executing the Job's builds. If you specify an Ant, Grails or Maven builder, you will also need to choose a JDK.

When creating a new Plan, you must specify a builder, which will used for the Plan's Default Job.

A builder is a 'build tool' external to Bamboo. Build tools are difficult to define, since the range of features can differ significantly from one build tool to the next. In essence though, a build tool is a source code compiling utility that generates compiled executable files (referred to as artifacts in Bamboo). Build tools typically have their own form of scripting language and an ability to manage dependencies correctly. Bamboo supports multiple builders. Once a builder is defined in the Bamboo system, it can then be specified in Plans and Jobs by a Bamboo administrator.

On this page:

Configuring a PHPUnit Builder for a Job

Before you begin:

  • To use this builder, you will need to install PHPUnit and reference the path to your PHP command-line interpreter, (e.g. /usr/bin/phpunit on Ubuntu).

To configure a PHPUnit builder for a Job:
(info) If you are creating a new Plan, start at step 2.

  1. Navigate to the Job's configuration pages, as described on Editing a Job.
  2. In the 'Builder' dropdown, select the PHPUnit/PHPUnit 3.3.x builder that you wish to configure for this Job (e.g. "PHPUnit 3"). The builder that you select will become one of the Job's capability requirements. For details please see Configuring a Job's Requirements.
    (tick) Tip: If you want to configure a new shared local builder capability in Bamboo, you can do so by clicking the 'Add New Builder' link and entering the builder details in the window that displays. Once you have added the new builder, it will be available for you to select from the 'Builder' dropdown.
  3. The screen will refresh to display the builder settings specific to PHPUnit:
    • 'Arguments' — Type the name of the directory/files that will be analysed recursively by PHPUnit. The default value is "." (i.e. the working subdirectory, if specified). You must specify at least one argument.
  4. If required, update the system environment variables and working directory settings:
    • 'System Environment Variables' (Optional) — Specify any additional* operating system environment variables you want to pass to your build; Please note, multiple variables must be separated with spaces, and parameters with spaces must be quoted (e.g 'ANT_OPTS=-Xms200m -Xmx700m'). You can also include Bamboo global or build-specific variables (see Using Global or Build-specific Variables).
      * i.e. additional to the existing environment variables (see Viewing Bamboo's System Information for a list). Note that existing environment variables are automatically available to the builder, thus you don't need to specify them in the 'System Environment Variables' field.
    • 'Working Sub Directory' (Optional) — A subdirectory relative to the Job build's root directory where Bamboo will execute your specified builder's commands. The Job build's root directory contains everything checked out from your Job's configured source repository. If you leave this field blank, Bamboo will look for the build files in the build root directory (which is assumed to be the Job build's Working Directory, as described in Locating Important Directories and Files). This option is useful, if your Job has a build script in a subdirectory and the builder needs to be run from within that subdirectory, in which case, you would type the name of that subdirectory in this field.
  5. Update the following build parameters:
    • 'Log test execution to XML file' — Select this check box if you want PHPUnit to record test results in JUnit format. (info) This format is also used by TestNG. If you select this check box, the following field is displayed:
      • 'Test Result File' — Enter the location of the file to record JUnit test results.
    • 'Generate code coverage report in HTML format' — Select this check box if you want PHPUnit to generate code coverage data in HTML format (e.g. for PHPUnit HTML Code Coverage reports). If you select this check box, the following field is displayed:
      • 'HTML Code Coverage Directory' — Enter the location of the directory to record HTML coverage data.
  6. Have you been creating a new Plan or new Job until now?
    • 'Override default build hanging detection' — Select this check box if you want to override the default build hanging detection settings. These settings determine when a build hung event is thrown (e.g. you can configure your notifications to trigger from this event). If selected, the following options will appear:
      • 'Build Time Multiplier' — This setting is used to calculate the 'Expected Build Time' for the build (i.e. 'Expected Build Time' = 'Build Time Multiplier' multiplied by 'Average Build Time').
        (info) The 'Average Build Time' is calculated by Bamboo by using an average of previous build times.
      • 'Log Quiet Time' — This is the amount of time since Bamboo last recorded an entry in the build log for a build.
        (info) The 'Expected Build Time' and 'Log Quiet Time' must both be exceeded for Bamboo to throw the build hung event.
      • 'Build Queue Timeout' — This is the amount of time that a build will wait in a build queue before an timeout event is thrown. Setting this value will override the global build queue timeout setting (see Configuring the Job Build Queue Timeout Event).
    • 'NCover output will be produced' — Do not select this option. NCover is a code coverage tool that supports .NET projects.
    • 'Use Clover to collect Code Coverage for this build' — Select this check box if you are running Atlassian Clover and want to collect code coverage data to view from within Bamboo (see Viewing the Clover Code-Coverage for a Build Result).
      If you select this check box, you can specify one of the following Clover 'Integration Options':
      • 'Automatically integrate Clover into this build' — For this option, you have two sub options — 'Generate a Clover Historical Report' and 'Generate a JSON report'. The Clover Historical Report shows the current coverage results compared with previous Clover code coverage reports. The JSON report gives the Clover results in a format ready for embedding into applications or external report views.
        You will also need to insert a Clover license (evaluation licenses are available) into the field provided.
        (info) Please see Enabling the Clover Plugin for more information.
      • 'Clover is already integrated into this build and a clover.xml file will be produced' — Use this option when you already have Clover configured to generate a report. You will also need to specify where the Clover XML report is being generated, under 'Clover XML Location'. For this, specify the name of the directory (including path) where PHPUnit will look for the XML report output file from Clover. Please specify a file path relative to your Job build's root directory, for example:
        target/site/clover/clover.xml
        (warning) Do not specify an absolute path.
  7. Click the 'Save' button to save your changes.

Notes

Related Topics

Specifying a Builder
Editing a Job

  • No labels