Package org.apache.jmeter.assertions

Examples of org.apache.jmeter.assertions.ResponseAssertion


    }
   
    public void testLoadAssertion() throws Exception
    {
      Configuration config = new DefaultConfigurationBuilder().buildFromFile(assertionFile);
      ResponseAssertion testEl = (ResponseAssertion)createTestElement(config.getChild("testelement"));
      assertEquals("save this string \\d+",testEl.getTestStrings().get(0));
    }
View Full Code Here


    }

    /* Implements JMeterGUIComponent.createTestElement() */
    public TestElement createTestElement()
    {
        ResponseAssertion el = new ResponseAssertion();
        modifyTestElement(el);
        return el;
    }
View Full Code Here

    public void modifyTestElement(TestElement el)
    {
        configureTestElement(el);
        if (el instanceof ResponseAssertion)
        {
            ResponseAssertion ra = (ResponseAssertion) el;

            ra.clearTestStrings();
            String[] testStrings = tableModel.getData().getColumn(COL_NAME);
            for (int i = 0; i < testStrings.length; i++)
            {
                ra.addTestString(testStrings[i]);
            }

            if (labelButton.isSelected())
            {
                ra.setTestField(ResponseAssertion.SAMPLE_LABEL);
            }
            else if (responseCodeButton.isSelected())
            {
        ra.setTestField(ResponseAssertion.RESPONSE_CODE);
            }
      else if (responseMessageButton.isSelected())
      {
        ra.setTestField(ResponseAssertion.RESPONSE_MESSAGE);
      }
            else
            {
                ra.setTestField(ResponseAssertion.RESPONSE_DATA);
            }

            if (containsBox.isSelected())
            {
                ra.setToContainsType();
            }
            else
            {
                ra.setToMatchType();
            }

            if (notBox.isSelected())
            {
                ra.setToNotType();
            }
            else
            {
                ra.unsetNotType();
            }
        }
    }
View Full Code Here

     * @param el the TestElement to configure
     */
    public void configure(TestElement el)
    {
        super.configure(el);
        ResponseAssertion model = (ResponseAssertion) el;

        if (model.isContainsType())
        {
            containsBox.setSelected(true);
            matchesBox.setSelected(false);
        }
        else
        {
            containsBox.setSelected(false);
            matchesBox.setSelected(true);
        }

        if (model.isNotType())
        {
            notBox.setSelected(true);
        }
        else
        {
            notBox.setSelected(false);
        }

        if (ResponseAssertion.RESPONSE_DATA.equals(model.getTestField()))
        {
            responseStringButton.setSelected(true);
        }
    else if (ResponseAssertion.RESPONSE_CODE.equals(model.getTestField()))
    {
      responseCodeButton.setSelected(true);
    }
    else if (ResponseAssertion.RESPONSE_MESSAGE.equals(model.getTestField()))
    {
      responseMessageButton.setSelected(true);
    }
        else // Assume it is the URL
        {
            labelButton.setSelected(true);
        }

        tableModel.clearData();
        PropertyIterator tests = model.getTestStrings().iterator();
        while (tests.hasNext())
        {
            tableModel.addRow(new Object[] { tests.next().getStringValue()});
        }

        if(model.getTestStrings().size() == 0)
        {
            deletePattern.setEnabled(false);
        }
        else
        {
View Full Code Here

TOP

Related Classes of org.apache.jmeter.assertions.ResponseAssertion

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.