@Test public void testExecute() throws Exception { System.out.println("execute 1"); Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>(); parameters.add(new CompoundVariable("test string")); parameters.add(new CompoundVariable("5")); parameters.add(new CompoundVariable("8")); parameters.add(new CompoundVariable("var")); Substring instance = new Substring(); instance.setParameters(parameters); String expResult = "str"; String result = instance.execute(null, null); Assert.assertEquals(expResult, result); }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String str = getParameter(0); int begin = Integer.parseInt(getParameter(1).trim()); int len = Integer.parseInt(getParameter(2).trim()); String totalString = str.substring(begin, len); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) { vars.put(varName, totalString); } } return totalString; }
Substring extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String str = getParameter(0); int begin = Integer.parseInt(getParameter(1).trim()); int len = Integer.parseInt(getParameter(2).trim()); String totalString = str.substring(begin, len); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) { vars.put(varName, totalString); } } return totalString; } }
Substring extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String str = getParameter(0); int begin = Integer.parseInt(getParameter(1).trim()); int len = Integer.parseInt(getParameter(2).trim()); String totalString = str.substring(begin, len); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) { vars.put(varName, totalString); } } return totalString; } Substring(); }
Substring extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String str = getParameter(0); int begin = Integer.parseInt(getParameter(1).trim()); int len = Integer.parseInt(getParameter(2).trim()); String totalString = str.substring(begin, len); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) { vars.put(varName, totalString); } } return totalString; } Substring(); @Override synchronized String execute(SampleResult previousResult, Sampler currentSampler); @Override synchronized void setParameters(Collection<CompoundVariable> parameters); @Override String getReferenceKey(); @Override List<String> getArgumentDesc(); }
Substring extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String str = getParameter(0); int begin = Integer.parseInt(getParameter(1).trim()); int len = Integer.parseInt(getParameter(2).trim()); String totalString = str.substring(begin, len); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) { vars.put(varName, totalString); } } return totalString; } Substring(); @Override synchronized String execute(SampleResult previousResult, Sampler currentSampler); @Override synchronized void setParameters(Collection<CompoundVariable> parameters); @Override String getReferenceKey(); @Override List<String> getArgumentDesc();  }