@Test public void testExecute() throws Exception { System.out.println("execute 1"); SampleResult previousResult = null; Sampler currentSampler = null; Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>(); parameters.add(new CompoundVariable("test string")); StrLen instance = new StrLen(); instance.setParameters(parameters); String expResult = "11"; String result = instance.execute(previousResult, currentSampler); Assert.assertEquals(expResult, result); }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); }
StrLen extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); } }
StrLen extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); } StrLen(); }
StrLen extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); } StrLen(); @Override synchronized String execute(SampleResult previousResult, Sampler currentSampler); @Override synchronized void setParameters(Collection<CompoundVariable> parameters); @Override String getReferenceKey(); List<String> getArgumentDesc(); }
StrLen extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); } StrLen(); @Override synchronized String execute(SampleResult previousResult, Sampler currentSampler); @Override synchronized void setParameters(Collection<CompoundVariable> parameters); @Override String getReferenceKey(); List<String> getArgumentDesc();  }