kcassell    2003/02/06 06:24:31

  Modified:    src/core/org/apache/jmeter/save SaveServiceConstants.java
                        SaveService.java
  Log:
  Can now capture the first failure message for CSV output.
  
  Revision  Changes    Path
  1.4       +9 -3      
jakarta-jmeter/src/core/org/apache/jmeter/save/SaveServiceConstants.java
  
  Index: SaveServiceConstants.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/save/SaveServiceConstants.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SaveServiceConstants.java 5 Feb 2003 19:45:31 -0000       1.3
  +++ SaveServiceConstants.java 6 Feb 2003 14:24:31 -0000       1.4
  @@ -2,7 +2,7 @@
    * ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -52,6 +52,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   package org.apache.jmeter.save;
   
   
  @@ -104,6 +105,11 @@
   
       /** A properties file indicator for all of a series.  **/
       public static final String ALL = "all";
  +
  +    /** The name of the property indicating which assertion results
  +     should be saved.  **/
  +    public static final String ASSERTION_RESULTS_FAILURE_MESSAGE_PROP
  +            = "jmeter.save.saveservice.assertion_results_failure_message";
   
       /** The name of the property indicating which assertion results
        should be saved.  **/
  
  
  
  1.15      +34 -4     jakarta-jmeter/src/core/org/apache/jmeter/save/SaveService.java
  
  Index: SaveService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/save/SaveService.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SaveService.java  5 Feb 2003 19:45:31 -0000       1.14
  +++ SaveService.java  6 Feb 2003 14:24:31 -0000       1.15
  @@ -123,6 +123,10 @@
        be saved to the test results.  **/
       protected static boolean saveDataType = true;
   
  +    /** A flag to indicate whether the assertion result's failure message
  +     should be saved to the test results.  **/
  +    protected static boolean saveAssertionResultsFailureMessage = false;
  +
       /** A flag to indicate whether the label should
        be saved to the test results.  **/
       protected static boolean saveLabel = true;
  @@ -241,6 +245,9 @@
   
           whichAssertionResults = props.getProperty(ASSERTION_RESULTS_PROP,
                                                     NONE);
  +        saveAssertionResultsFailureMessage =
  +            
TRUE.equalsIgnoreCase(props.getProperty(ASSERTION_RESULTS_FAILURE_MESSAGE_PROP,
  +                                                    FALSE));
   
           if (NONE.equals(whichAssertionResults))
           {
  @@ -350,8 +357,12 @@
               text.append(SaveServiceConstants.SUCCESSFUL);
               text.append(defaultDelimiter);
           }
  -        // text.append(sample.getSamplerData().toString());
  -        // text.append(getAssertionResult(sample));
  +
  +        if (saveAssertionResultsFailureMessage)
  +        {
  +            text.append(SaveServiceConstants.FAILURE_MESSAGE);
  +            text.append(defaultDelimiter);
  +        }
   
           String resultString = null;
           int size = text.length();
  @@ -627,6 +638,7 @@
           {
               String stamp = formatter.format(new Date(sample.getTimeStamp()));
               text.append(stamp);
  +            text.append(delimiter);
           }
   
           if (saveTime)
  @@ -668,6 +680,24 @@
           if (saveSuccessful)
           {
               text.append("" + sample.isSuccessful());
  +            text.append(delimiter);
  +        }
  +
  +        if (saveAssertionResultsFailureMessage)
  +        {
  +            String message = null;
  +            AssertionResult[] results = sample.getAssertionResults();
  +
  +            if (results.length > 0)
  +            {
  +                message = results[0].getFailureMessage();
  +            }
  +
  +            if (message == null)
  +            {
  +                message = "";
  +            }
  +            text.append(message);
               text.append(delimiter);
           }
           // text.append(sample.getSamplerData().toString());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to