jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1749223 - in /jmeter/trunk: test/src/org/apache/jmeter/save/TestCSVSaveService.java xdocs/changes.xml
Date Sun, 19 Jun 2016 22:42:13 GMT
Author: sebb
Date: Sun Jun 19 22:42:13 2016
New Revision: 1749223

URL: http://svn.apache.org/viewvc?rev=1749223&view=rev
Log:
Unit test to check that CSV header text and sample format don't change unexpectedly
Bugzilla Id: 59726

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java?rev=1749223&r1=1749222&r2=1749223&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java Sun Jun 19 22:42:13
2016
@@ -26,6 +26,10 @@ import java.io.IOException;
 import java.io.StringReader;
 
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.samplers.SampleEvent;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.samplers.SampleSaveConfiguration;
+import org.apache.jmeter.util.JMeterUtils;
 import org.junit.Test;
 
 public class TestCSVSaveService extends JMeterTestCase {
@@ -147,4 +151,36 @@ public class TestCSVSaveService extends
         checkStrings(new String[]{"a"}, out);
         assertEquals("Expected to be at EOF",-1,br.read());
     }
+
+    @Test
+    // header text should not change unexpectedly
+    // if this test fails, check whether the default was intentionally changed or not
+    public void testHeader() {
+        final String HDR = "timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,grpThreads,allThreads,Latency,IdleTime";
+        assertEquals("Header text has changed", HDR, CSVSaveService.printableFieldNamesToString());
+    }
+
+    @Test
+    // sample format should not change unexpectedly
+    // if this test fails, check whether the default was intentionally changed or not
+    public void testSample() {
+        System.out.println(JMeterUtils.getProperty("jmeter.save.saveservice.timestamp_format"));
+        final String RESULT = "1,2,3,4,5,6,7,true,,8,9,10,11,12";
+        SampleResult result = new SampleResult();
+        result.setSaveConfig(new SampleSaveConfiguration());
+        result.setStampAndTime(1, 2);
+        result.setSampleLabel("3");
+        result.setResponseCode("4");
+        result.setResponseMessage("5");
+        result.setThreadName("6");
+        result.setDataType("7");
+        result.setSuccessful(true);
+        result.setBytes(8);
+        result.setGroupThreads(9);
+        result.setAllThreads(10);
+        result.setLatency(11);
+        result.setIdleTime(12);
+//        result.setConnectTime(13);
+        assertEquals("Result text has changed", RESULT, CSVSaveService.resultToDelimitedString(new
SampleEvent(result,"")));
+    }
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1749223&r1=1749222&r2=1749223&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Jun 19 22:42:13 2016
@@ -160,6 +160,7 @@ Summary
     <li>Code cleanups. Patches by Graham Russell (graham at ham1.co.uk)</li>
     <li><bug>59722</bug>Use StandardCharsets to reduce the possibility
of misspelling Charset names.</li>
     <li><bug>59723</bug>Use jmeter.properties for testing whenever possible</li>
+    <li><bug>59726</bug>Unit test to check that CSV header text and sample
format don't change unexpectedly</li>
 </ul>
 
  <!--  =================== Thanks =================== -->



Mime
View raw message