You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/02/20 17:11:06 UTC

svn commit: r629519 - in /jakarta/jmeter/trunk: docs/ docs/images/screenshots/assertion/ docs/usermanual/ src/components/org/apache/jmeter/assertions/ src/components/org/apache/jmeter/assertions/gui/ src/core/org/apache/jmeter/resources/ xdocs/ xdocs/i...

Author: sebb
Date: Wed Feb 20 08:10:49 2008
New Revision: 629519

URL: http://svn.apache.org/viewvc?rev=629519&view=rev
Log:
Add "Substring" option to Response Assertion

Modified:
    jakarta/jmeter/trunk/docs/changes.html
    jakarta/jmeter/trunk/docs/images/screenshots/assertion/assertion.png
    jakarta/jmeter/trunk/docs/usermanual/component_reference.html
    jakarta/jmeter/trunk/docs/usermanual/get-started.html
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/images/screenshots/assertion/assertion.png
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/docs/changes.html
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/changes.html?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/docs/changes.html (original)
+++ jakarta/jmeter/trunk/docs/changes.html Wed Feb 20 08:10:49 2008
@@ -147,6 +147,9 @@
 CSV and XML files can now contain additional variables (define the JMeter property sample_variables).
 						</p>
 							  									 				<p	>
+								Response Assertion can now match on substrings
+						</p>
+							  									 				<p	>
 								Number of classes loaded in non-GUI mode is much reduced.
 						</p>
 							  									 				<h4	>
@@ -230,6 +233,11 @@
 						</li>
 									
 
+												<li	>
+								Bug 44314 - Not possible to add more than one SyncTimer
+						</li>
+									
+
 						</ul>
 							  									 				<h4	>
 								Improvements
@@ -301,6 +309,16 @@
 												<li	>
 								Allow most functions to be used on the Test Plan. 
 Note __split() and __regex() cannot be used on the Test Plan.
+						</li>
+									
+
+												<li	>
+								Allow Global properties to be loaded from a file, e.g. -Gglobal.properties
+						</li>
+									
+
+												<li	>
+								Add "Substring" option to Response Assertion
 						</li>
 									
 

Modified: jakarta/jmeter/trunk/docs/images/screenshots/assertion/assertion.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/assertion/assertion.png?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/docs/usermanual/component_reference.html
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/usermanual/component_reference.html?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/docs/usermanual/component_reference.html (original)
+++ jakarta/jmeter/trunk/docs/usermanual/component_reference.html Wed Feb 20 08:10:49 2008
@@ -7891,7 +7891,7 @@
 
 
 														<p><b>Control Panel</b></p>
-						<div align="center"><img width='766' height='382' src="../images/screenshots/assertion/assertion.png"></div>
+						<div align="center"><img width='762' height='374' src="../images/screenshots/assertion/assertion.png"></div>
 											  									 			 <p>
 	<b>Parameters</b>
 	<table border="1" cellspacing="0" cellpadding="2">
@@ -7933,9 +7933,35 @@
 		</tr>
 			<tr>
 			<td>Pattern Matching Rules</td>
-			<td>						Indicates whether the text being tested
-        must CONTAIN or MATCH the test patterns.  NOT may also be selected to indicate the text
-        should NOT CONTAIN or NOT MATCH the test patterns.
+			<td>						Indicates how the text being tested
+        is checked against the pattern.
+        
+												<ul	>
+								
+        
+												<li	>
+								Contains - true if the text contains the regular expression pattern
+						</li>
+									
+        
+												<li	>
+								Matches - true if the whole text matches the regular expression pattern
+						</li>
+									
+        
+												<li	>
+								Equals - true if the whole text equals the pattern string (case-sensitive)
+						</li>
+									
+        
+												<li	>
+								Substring - true if the text contains the pattern string (case-sensitive)
+						</li>
+									
+        
+						</ul>
+									
+        NOT may also be selected to invert the result of the check.
 			</td>
 			<td>
 											Yes
@@ -7943,8 +7969,11 @@
 		</tr>
 			<tr>
 			<td>Patterns to Test</td>
-			<td>						A list of regular expressions to
-        be tested.  Each pattern is tested separately.  There is no difference between setting up
+			<td>						A list of patterns to
+        be tested.  
+        Each pattern is tested separately. 
+        If a pattern fails, then further patterns are not checked.
+        There is no difference between setting up
         one Assertion with multiple patterns and setting up multiple Assertions with one
         pattern each (assuming the other options are the same).
         
@@ -9254,7 +9283,6 @@
 			</td></tr>
 	</table></p>
 									
-
 
 										  		</td></tr>
 		<tr><td><br></td></tr>

Modified: jakarta/jmeter/trunk/docs/usermanual/get-started.html
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/usermanual/get-started.html?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/docs/usermanual/get-started.html (original)
+++ jakarta/jmeter/trunk/docs/usermanual/get-started.html Wed Feb 20 08:10:49 2008
@@ -1145,8 +1145,10 @@
                 Set password for proxy server that JMeter is to use
         -J, --jmeterproperty {argument}={value}
                 Define additional JMeter properties
-        -G, --globalproperty (argument)=(value)
+        -G, --globalproperty (argument)[=(value)]
                 Define Global properties (sent to servers)
+                e.g. -Gport=123
+                 or -Gglobal.properties
         -D, --systemproperty {argument}={value}
                 Define additional System properties
         -S, --systemPropertyFile {filename}

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java Wed Feb 20 08:10:49 2008
@@ -77,6 +77,11 @@
 
 	private final static int EQUALS = 1 << 3;
 
+    private final static int SUBSTRING = 1 << 4;
+
+    // Mask should contain all types (but not NOT)
+    private final static int TYPE_MASK = CONTAINS | EQUALS | MATCH | SUBSTRING;
+    
     private static final int  EQUALS_SECTION_DIFF_LEN
             = JMeterUtils.getPropDefault("assertion.equals_section_diff_len", 100);
 
@@ -147,6 +152,11 @@
 		setProperty(new IntegerProperty(TEST_TYPE, testType));
 	}
 
+    private void setTestTypeMasked(int testType) {
+        int value = getTestType() & ~(TYPE_MASK) | testType;
+        setProperty(new IntegerProperty(TEST_TYPE, value));
+    }
+
 	public void addTestString(String testString) {
 		getTestStrings().addProperty(new StringProperty(String.valueOf(testString.hashCode()), testString));
 	}
@@ -211,6 +221,10 @@
 		return (getTestType() & EQUALS) > 0;
 	}
 
+    public boolean isSubstringType() {
+        return (getTestType() & SUBSTRING) > 0;
+    }
+
 	public boolean isContainsType() {
 		return (getTestType() & CONTAINS) > 0;
 	}
@@ -224,17 +238,21 @@
 	}
 
 	public void setToContainsType() {
-		setTestType((getTestType() | CONTAINS) & ~(MATCH | EQUALS));
+		setTestTypeMasked(CONTAINS);
 	}
 
 	public void setToMatchType() {
-		setTestType((getTestType() | MATCH) & ~(CONTAINS | EQUALS));
+	    setTestTypeMasked(MATCH);
 	}
 
 	public void setToEqualsType() {
-		setTestType((getTestType() | EQUALS) & ~(MATCH | CONTAINS));
+	    setTestTypeMasked(EQUALS);
 	}
 
+    public void setToSubstringType() {
+        setTestTypeMasked(SUBSTRING);
+    }
+
 	public void setToNotType() {
 		setTestType((getTestType() | NOT));
 	}
@@ -292,6 +310,7 @@
 
 		boolean contains = isContainsType(); // do it once outside loop
 		boolean equals = isEqualsType();
+        boolean substring = isSubstringType();
 		boolean debugEnabled = log.isDebugEnabled();
 		if (debugEnabled){
 			log.debug("Type:" + (contains?"Contains":"Match") + (not? "(not)": ""));
@@ -309,6 +328,8 @@
 					found = localMatcher.contains(toCheck, pattern);
                 } else if (equals) {
                     found = toCheck.equals(stringPattern);
+                } else if (substring) {
+                    found = toCheck.indexOf(stringPattern) != -1;
 				} else {
 					found = localMatcher.matches(toCheck, pattern);
 				}
@@ -356,9 +377,11 @@
 
 		switch (getTestType()) {
 		case CONTAINS:
+        case SUBSTRING:
 			sb.append(" expected to contain ");
 			break;
 		case NOT | CONTAINS:
+        case NOT | SUBSTRING:
 			sb.append(" expected not to contain ");
 			break;
 		case MATCH:

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java Wed Feb 20 08:10:49 2008
@@ -83,11 +83,16 @@
 	private JRadioButton matchesBox;
 
 	/**
-	 * Radio button indicating if the field equals the first pattern.
+	 * Radio button indicating if the field equals the string.
 	 */
 	private JRadioButton equalsBox;
 
     /**
+     * Radio button indicating if the field contains the string.
+     */
+    private JRadioButton substringBox;
+
+    /**
 	 * Checkbox indicating to test that the field does NOT contain/match the
 	 * patterns.
 	 */
@@ -153,6 +158,8 @@
 				ra.setToContainsType();
 			} else if (equalsBox.isSelected()) {
                 ra.setToEqualsType();
+            } else if (substringBox.isSelected()) {
+                ra.setToSubstringType();
 			} else {
 				ra.setToMatchType();
 			}
@@ -181,8 +188,6 @@
         assumeSuccess.setSelected(false);
         
         containsBox.setSelected(true);
-        matchesBox.setSelected(false);
-        equalsBox.setSelected(false);
         notBox.setSelected(false);
     }    
 
@@ -201,23 +206,15 @@
 
 		if (model.isContainsType()) {
 			containsBox.setSelected(true);
-			matchesBox.setSelected(false);
-            equalsBox.setSelected(false);
         } else if (model.isEqualsType()) {
-			containsBox.setSelected(false);
-			matchesBox.setSelected(false);
             equalsBox.setSelected(true);
+        } else if (model.isSubstringType()) {
+            substringBox.setSelected(true);
 		} else {
-			containsBox.setSelected(false);
 			matchesBox.setSelected(true);
-            equalsBox.setSelected(false);
 		}
 
-		if (model.isNotType()) {
-			notBox.setSelected(true);
-		} else {
-			notBox.setSelected(false);
-		}
+		notBox.setSelected(model.isNotType());
 
 		if (model.isTestFieldResponseData()) {
 			responseStringButton.setSelected(true);
@@ -325,6 +322,10 @@
 		equalsBox = new JRadioButton(JMeterUtils.getResString("assertion_equals")); //$NON-NLS-1$
 		group.add(equalsBox);
 		panel.add(equalsBox);
+
+        substringBox = new JRadioButton(JMeterUtils.getResString("assertion_substring")); //$NON-NLS-1$
+        group.add(substringBox);
+        panel.add(substringBox);
 
 		notBox = new JCheckBox(JMeterUtils.getResString("assertion_not")); //$NON-NLS-1$
 		panel.add(notBox);

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Wed Feb 20 08:10:49 2008
@@ -55,6 +55,7 @@
 assertion_pattern_match_rules=Pattern Matching Rules
 assertion_patterns_to_test=Patterns to Test
 assertion_resp_field=Response Field to Test
+assertion_substring=Substring
 assertion_text_resp=Text Response
 assertion_textarea_label=Assertions\:
 assertion_title=Response Assertion

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Wed Feb 20 08:10:49 2008
@@ -40,6 +40,8 @@
 <p>CSV fields can now contain delimiters. 
 CSV and XML files can now contain additional variables (define the JMeter property sample_variables).</p>
 
+<p>Response Assertion can now match on substrings</p>
+
 <p>Number of classes loaded in non-GUI mode is much reduced.</p>
 
 <h4>Known bugs</h4>
@@ -91,6 +93,7 @@
 <li>Allow most functions to be used on the Test Plan. 
 Note __split() and __regex() cannot be used on the Test Plan.</li>
 <li>Allow Global properties to be loaded from a file, e.g. -Gglobal.properties</li>
+<li>Add "Substring" option to Response Assertion</li>
 </ul>
 
 <h4>Non-functional changes</h4>

Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/assertion/assertion.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/assertion/assertion.png?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=629519&r1=629518&r2=629519&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Wed Feb 20 08:10:49 2008
@@ -2441,7 +2441,7 @@
 	"true" or "false" after all assertions for a sampler have been run.
 	 </note>
 </description>
-<component name="Response Assertion" index="&sect-num;.5.1" anchor="basic_assertion"  width="766" height="382" screenshot="assertion/assertion.png">
+<component name="Response Assertion" index="&sect-num;.5.1" anchor="basic_assertion"  width="762" height="374" screenshot="assertion/assertion.png">
 
 <description><p>The response assertion control panel lets you add pattern strings to be compared against various
 	fields of the response.
@@ -2496,6 +2496,7 @@
         <li>Contains - true if the text contains the regular expression pattern</li>
         <li>Matches - true if the whole text matches the regular expression pattern</li>
         <li>Equals - true if the whole text equals the pattern string (case-sensitive)</li>
+        <li>Substring - true if the text contains the pattern string (case-sensitive)</li>
         </ul>
         NOT may also be selected to invert the result of the check.</property>
         <property name="Patterns to Test" required="Yes">A list of patterns to



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org