From 632cc1e2c31e59b6df9b7d816d6c02350c73e07b Mon Sep 17 00:00:00 2001
From: MJB <mjb@it-innovation.soton.ac.uk>
Date: Thu, 15 Feb 2018 11:18:10 +0000
Subject: [PATCH] added jmeter streaming test

---
 test/streaming/run.sh       | 17 +++++-----
 test/streaming/stop.sh      |  3 ++
 test/streaming/testplan.jmx | 67 +++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 8 deletions(-)
 create mode 100644 test/streaming/stop.sh
 create mode 100644 test/streaming/testplan.jmx

diff --git a/test/streaming/run.sh b/test/streaming/run.sh
index b9f4999..9627697 100644
--- a/test/streaming/run.sh
+++ b/test/streaming/run.sh
@@ -19,7 +19,7 @@
 #// the software.
 #//
 #//      Created By :            Michael Boniface
-#//      Created Date :          13/12/2017
+#//      Created Date :          15/02/2017
 #//      Created for Project :   FLAME
 #//
 #/////////////////////////////////////////////////////////////////////////
@@ -34,14 +34,15 @@ mkdir -p  "$testdir"
 # run testplan
 cd $testdir
 
-# jmeter -n -LDEBUG -t /vagrant/test/streaming/testplan.jmx -l results.jtx -j jmeter.log
+jmeter -n -LDEBUG -t /vagrant/test/streaming/testplan.jmx -l results.jtx -j jmeter.log
 
-COUNTER=0
-while [  $COUNTER -lt 20 ]; do
-  cvlc -Vdummy --no-audio http://192.168.50.11/test_video/stream.mpd &
-  sleep 1
-  let COUNTER=COUNTER+1 
-done
+# quick bash equivalent in case Jmeter fails
+#COUNTER=0
+#while [  $COUNTER -lt 1 ]; do
+#  cvlc -Vdummy --no-audio http://192.168.50.11/test_video/stream.mpd &
+#  sleep 1
+#  let COUNTER=COUNTER+1 
+#done
 
 
 
diff --git a/test/streaming/stop.sh b/test/streaming/stop.sh
new file mode 100644
index 0000000..b995389
--- /dev/null
+++ b/test/streaming/stop.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+for pid in $(ps -ef | grep "/usr/bin/vlc" | awk '{print $2}'); do kill -9 $pid; done
\ No newline at end of file
diff --git a/test/streaming/testplan.jmx b/test/streaming/testplan.jmx
new file mode 100644
index 0000000..1999b4c
--- /dev/null
+++ b/test/streaming/testplan.jmx
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jmeterTestPlan version="1.2" properties="3.2" jmeter="3.3 r1808647">
+  <hashTree>
+    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
+      <stringProp name="TestPlan.comments"></stringProp>
+      <boolProp name="TestPlan.functional_mode">false</boolProp>
+      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
+      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+        <collectionProp name="Arguments.arguments"/>
+      </elementProp>
+      <stringProp name="TestPlan.user_define_classpath"></stringProp>
+    </TestPlan>
+    <hashTree>
+      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="StreamingGroupApache1" enabled="true">
+        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+          <boolProp name="LoopController.continue_forever">false</boolProp>
+          <intProp name="LoopController.loops">-1</intProp>
+        </elementProp>
+        <stringProp name="ThreadGroup.num_threads">5</stringProp>
+        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+        <longProp name="ThreadGroup.start_time">1518691643000</longProp>
+        <longProp name="ThreadGroup.end_time">1518691643000</longProp>
+        <boolProp name="ThreadGroup.scheduler">true</boolProp>
+        <stringProp name="ThreadGroup.duration">10</stringProp>
+        <stringProp name="ThreadGroup.delay">0</stringProp>
+      </ThreadGroup>
+      <hashTree>
+        <SystemSampler guiclass="SystemSamplerGui" testclass="SystemSampler" testname="VLC Client" enabled="true">
+          <boolProp name="SystemSampler.checkReturnCode">false</boolProp>
+          <stringProp name="SystemSampler.expectedReturnCode">0</stringProp>
+          <stringProp name="SystemSampler.command">cvlc</stringProp>
+          <elementProp name="SystemSampler.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+            <collectionProp name="Arguments.arguments">
+              <elementProp name="" elementType="Argument">
+                <stringProp name="Argument.name"></stringProp>
+                <stringProp name="Argument.value">-Vdummy</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+              </elementProp>
+              <elementProp name="" elementType="Argument">
+                <stringProp name="Argument.name"></stringProp>
+                <stringProp name="Argument.value">--no-audio</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+              </elementProp>
+              <elementProp name="" elementType="Argument">
+                <stringProp name="Argument.name"></stringProp>
+                <stringProp name="Argument.value">http://192.168.50.11/test_video/stream.mpd</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+              </elementProp>
+            </collectionProp>
+          </elementProp>
+          <elementProp name="SystemSampler.environment" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+            <collectionProp name="Arguments.arguments"/>
+          </elementProp>
+          <stringProp name="SystemSampler.directory"></stringProp>
+          <stringProp name="SystemSampler.stdout">stdout${__threadNum}</stringProp>
+          <longProp name="SystemSampler.timeout">10000</longProp>
+        </SystemSampler>
+        <hashTree/>
+      </hashTree>
+    </hashTree>
+    <WorkBench guiclass="WorkBenchGui" testclass="WorkBench" testname="WorkBench" enabled="true">
+      <boolProp name="WorkBench.save">true</boolProp>
+    </WorkBench>
+    <hashTree/>
+  </hashTree>
+</jmeterTestPlan>
-- 
GitLab