Skip to content

Run and Summary Properties

itaiag edited this page Aug 9, 2016 · 1 revision

Run and Summary Properties

RunProperties

Run properties are required in order to enable tests to communicate with each other during a JSystem run. These run properties exist in the context of the test run and are automatically cleared when the test run finishes. In a typical operating setup of the RunProperties service, one test can set a property and another test can read the property and verify its value simultaneously. Setting the Run Property Code Example

/**
* Run properties are properties which
* purpose is to help tests to share information.
* When running in run.mode 1 (1 jvm for all tests) , this is not a problem since
* tests can share data in JVM's memory, but when running in run.mode 2,4
* (jvm for each test and jvm for each internal scenario), tests can't
* share data in JVM's memory, this is when the run properties can be used.
*/
public void testRunProperties() throws Exception {
      RunProperties.getInstance().setRunProperty("myProp", "val1");
}

Reading Property Value Code Example

/**
* When running this test after {@link #testRunProperties()},
* the value of val will be 'val1'
*/
public void testRunPropertiesSecondTest() throws Exception {
         String val = RunProperties.getInstance().getRunProperty("myProp");
         assertEquals(val,"val1");
}

Summary Properties

Summary properties are run properties that are not deleted between test runs. These summary properties are set by tests and not read by other tests, they are used by two other JSystem services:

  • The HTML Reporter
  • The JRunner publisher

The summary properties service has four pre defined properties that are created by the framework:

  • Date – Scenario execution start date and time.
  • Station – Machine IP.
  • User – User name taken from local machine.
  • Version – Version of a tested product. The default setting is set to “unknown”.

Summary Properties Code Example

The values of all built-in summary properties can be overridden by the programmer. In order to set the summary properties write the following code:

/**
*/
public void testSummaryProperty() throws Exception {
        Summary.getInstance().setProperty("permanentProperty", "propValue");
}

Summary Properties in the HTML Reporter

All summary properties are added to the main page of the HTML JReport.

Clone this wiki locally