/**
  * Method is called by the JMeterEngine class when a test run is started. Zeroes
  * numberOfActiveThreads. Saves current time in a field and in the JMeter property "TESTSTART.MS"
  */
 public static synchronized void startTest() {
   if (testStart == 0) {
     numberOfActiveThreads = 0;
     testStart = System.currentTimeMillis();
     JMeterUtils.setProperty("TESTSTART.MS", Long.toString(testStart)); // $NON-NLS-1$
   }
 }
예제 #2
0
  /** {@inheritDoc} */
  @Override
  public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
      throws InvalidVariableException {
    String propertyName = ((CompoundVariable) values[0]).execute();

    String propertyValue = ((CompoundVariable) values[1]).execute();

    boolean returnValue = false; // should we return original value?
    if (values.length > 2) {
      returnValue =
          ((CompoundVariable) values[2]).execute().equalsIgnoreCase("true"); // $NON-NLS-1$
    }

    if (returnValue) { // Only obtain and cast the return if needed
      return (String) JMeterUtils.setProperty(propertyName, propertyValue);
    } else {
      JMeterUtils.setProperty(propertyName, propertyValue);
      return "";
    }
  }