Skip to main content
Version: QB14

Complicated Build Options

Situation

Set up the configuration so that it can ask user for below settings when manually triggered:

  1. User can select either Smoke Test Mode or Acceptance Test Mode.
  2. When Smoke Test Mode is selected, user can select Component A and/or Component B to test, and can select whether or not to run integration tests.
  3. When Acceptance Test Mode is selected, user can continue to select Component C and/or Component D to test.
  4. User can optionally select which test suite to run.
  5. User can optionally select which test case to run in the selected test suite.

Demonstration

  1. Open this configuration and hit the run button.
  2. A build option screen will be presented with desired settings. Make some selection and hit the OK button. Please note that when a test suite is selected, all test cases belonging to that test suite will be displayed for choice.
  3. Wait for some time for the build to finish. Check the step status screen, and you will find that the test step has been executed on the nodes you specified in the build option screen.
  4. Open build log and check output of the test step. For demonstration purpose, the specified test setting and its options are printed in the log correctly.

Resolution

  1. Create a custom plugin implementing the PromptBeanProvider extension point to provider your own build option bean. You may start with the sample plugin com.example.promptbean in directory <QuickBuild server install dir>/dev/plugin/samples , and modify various bean classes as necessary. Refer to Bean Editor on how to annotate your beans for editing purpose. This tutorial uses the sample plugin directly.
  2. Stop QuickBuild, deploy your plugin to QuickBuild, and then start QuickBuild. Refer to Plugin Tutorials on how to do this.
  3. Define a variable with prompt setting set to prompt for bean input , and choose the bean you provided in your plugin. In this tutorial, we choosed the Example Prompt Bean as demonstrated here.
  4. Please note that we also specified default value of the bean by creating the bean object with groovy, assigning default values to its fields, and convert it to a string. This default bean will be used to populate the variable when the build is not manually triggered (ie. triggered via schedule).
  5. Definition of the test step retrieves the bean via the variable and traverses the object graph to print interesting information.