如何在文件中获取Summarizer输出

时间:2016-04-28 13:41:17

标签: jmeter

我是JMeter的新手。我想得到Summarizer输出以获得测试进度而不是stdout。

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true"
  android:orientation="vertical">

  <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/abc_action_bar_default_height_material"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

  <android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Real content goes here -->
    <FrameLayout
      android:id="@+id/content"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

    <!-- The navigation drawer -->
    <android.support.design.widget.NavigationView
      android:id="@+id/navigation"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      app:menu="@menu/drawer"/>

  </android.support.v4.widget.DrawerLayout>
</LinearLayout>

例如,列表包含这些值

(summary =      4 in   3,5s =    1,2/s Avg:  1012 Min:   999 Max:  1044 Err:     4 (100,00%))

1 个答案:

答案 0 :(得分:0)

首先使用下面的3个变量初始化列表

vars.put("a","NA");
vars.put("b","NA");
vars.put("c","NA");

获取这些变量的值时,请输入如下变量。

vars.put("a","1/2S");

最后将值写入文件,如下所示:

FileWriter fstream;
BufferedWriter out;
fstream = new FileWriter(vars.get("summaryReportFile.csv"),true);
out = new BufferedWriter(fstream);
String summary = "+vars.get("a")+","+vars.get("b")+","+vars.get("c")+"\n";
out.write(summary);
out.close();
fstream.close();