Package org.apache.jmeter.engine.util

Examples of org.apache.jmeter.engine.util.CompoundVariable


      jmctx.setPreviousResult(result);
    }

    public void testVariableExtraction() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("$2$"));
      params.add(new CompoundVariable("2"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("5", match);
    }
View Full Code Here


    }

    // Test with output variable name
        public void testVariableExtraction1a() throws Exception {
            params = new LinkedList();
            params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
            params.add(new CompoundVariable("$2$")); // template
            params.add(new CompoundVariable("2")); // match number
            params.add(new CompoundVariable("-")); // ALL separator
            params.add(new CompoundVariable("default"));
            params.add(new CompoundVariable("OUTVAR"));
            variable.setParameters(params);
            String match = variable.execute(result, null);
            assertEquals("3", vars.getObject("OUTVAR_matchNr"));
            assertEquals("5", match);
            assertEquals("5", vars.getObject("OUTVAR"));
View Full Code Here

        }

        // Test with empty output variable name
        public void testVariableExtraction1b() throws Exception {
            params = new LinkedList();
            params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
            params.add(new CompoundVariable("$2$")); // template
            params.add(new CompoundVariable("2")); // match number
            params.add(new CompoundVariable("-")); // ALL separator
            params.add(new CompoundVariable("default"));
            params.add(new CompoundVariable(""));
            variable.setParameters(params);
            String match = variable.execute(result, null);
            assertEquals("5", match);
            assertNull(vars.getObject("OUTVAR"));
        }
View Full Code Here

            assertNull(vars.getObject("OUTVAR"));
        }

        public void testVariableExtractionFromVariable() throws Exception {
            params = new LinkedList();
            params.add(new CompoundVariable("(\\d+)\\s+(\\w+)"));
            params.add(new CompoundVariable("$2$")); // template
            params.add(new CompoundVariable("1")); // match number
            params.add(new CompoundVariable("-")); // ALL separator
            params.add(new CompoundVariable("default"));
            params.add(new CompoundVariable("OUTVAR"));
            params.add(new CompoundVariable(INPUT_VARIABLE_NAME));
            variable.setParameters(params);
            String match = variable.execute(result, null);
            assertEquals("1", vars.getObject("OUTVAR_matchNr"));
            assertEquals("times", match);
            assertEquals("times", vars.getObject("OUTVAR"));
View Full Code Here

            assertEquals("times", vars.getObject("OUTVAR_g2"));
        }

    public void testVariableExtraction2() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("$1$"));
      params.add(new CompoundVariable("3"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("pinposition3", match);
    }
View Full Code Here

      assertEquals("pinposition3", match);
    }

    public void testVariableExtraction5() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("$1$"));
      params.add(new CompoundVariable("ALL"));
      params.add(new CompoundVariable("_"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("pinposition1_pinposition2_pinposition3", match);
    }
View Full Code Here

      assertEquals("pinposition1_pinposition2_pinposition3", match);
    }

    public void testVariableExtraction6() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("$2$"));
      params.add(new CompoundVariable("4"));
      params.add(new CompoundVariable(""));
      params.add(new CompoundVariable("default"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("default", match);
    }
View Full Code Here

      assertEquals("default", match);
    }

    public void testComma() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value,? field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("$1$"));
      params.add(new CompoundVariable("3"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("pinposition3", match);
    }
View Full Code Here

      assertEquals("pinposition3", match);
    }

    public void testVariableExtraction3() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("_$1$"));
      params.add(new CompoundVariable("2"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("_pinposition2", match);
    }
View Full Code Here

      assertEquals("_pinposition2", match);
    }

    public void testVariableExtraction4() throws Exception {
      params = new LinkedList();
      params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
      params.add(new CompoundVariable("$2$, "));
      params.add(new CompoundVariable(".333"));
      variable.setParameters(params);
      String match = variable.execute(result, null);
      assertEquals("1, ", match);
    }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.engine.util.CompoundVariable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.