Annotation Interface LocalData


Runs a test case with a data set local to test method or the test class.

This recipe allows your test case to start with the preset JENKINS_HOME data loaded either from your test method or from the test class.

For example, if the test method is org.acme.FooTest.testBar(), then you can have your test data in one of the following places in resources folder (typically src/test/resources):

  1. Under org/acme/FooTest/testBar directory; that is, you could have files such as org/acme/FooTest/testBar/config.xml or org/acme/FooTest/testBar/jobs/p/config.xml, in the same layout as in the real JENKINS_HOME directory.
  2. In org/acme/FooTest/testBar.zip as a zip file.
  3. Under org/acme/FooTest directory; that is, you could have files such as org/acme/FooTest/config.xml or org/acme/FooTest/jobs/p/config.xml, in the same layout as in the real JENKINS_HOME directory.
  4. In org/acme/FooTest.zip as a zip file.
You can specify a value to use instead of the method name with the parameter of annotation. Should be a valid java identifier. E.g. @LocalData("commonData") results using org/acme/FooTest/commonData(.zip).

Search is performed in this specific order. The fall back mechanism allows you to write one test class that interacts with different aspects of the same data set, by associating the dataset with a test class, or have a data set local to a specific test method.

The choice of zip and directory depends on the nature of the test data, as well as the size of it.

Author:
Kohsuke Kawaguchi
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
     
  • Field Details

    • LOGGER

      static final Logger LOGGER
  • Element Details

    • value

      String value
      Default:
      ""