changeset 78:76d9b4651d7f

added generating of the output text messages
author Jana Fabrikova <jfabriko@redhat.com>
date Wed, 10 Jul 2013 18:02:48 +0200
parents b1a74b7bb453
children 192f89a34e98
files ChangeLog Makefile src/org/thermostat/qa/common/Configuration.java src/org/thermostat/qa/framework/ThermostatOutputTextsGenerator.java src/org/thermostat/qa/framework/ThermostatTest.java src/org/thermostat/qa/framework/ThermostatUtilities.java src/org/thermostat/qa/reporter/FileUtils.java src/org/thermostat/qa/testsuites/AgentTest.java src/org/thermostat/qa/testsuites/OutputMessagesTest.java test.properties
diffstat 10 files changed, 680 insertions(+), 646 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 09 18:26:44 2013 +0200
+++ b/ChangeLog	Wed Jul 10 18:02:48 2013 +0200
@@ -1,3 +1,33 @@
+2013-07-10  Jana Fabrikova  <jfabriko@redhat.com>
+	* Makefile:
+	added ThermostatUtilities and ThermostatOutputTextGenerator to
+	the ALL_CLASSES goal, 
+	added new goal generatetexts for generating thermostat outputs
+	into text files
+	* src/org/thermostat/qa/common/Configuration.java:
+	adding new attribute thermostatOutputTextsVersion, and new method
+	(getThermostatOutputTextsVersion)
+	* src/org/thermostat/qa/framework/ThermostatOutputTextsGenerator.java:
+	added class for generating the output messages from thermostat
+	* src/org/thermostat/qa/framework/ThermostatTest.java:
+	refactoring - in ThermostatTest remain methods for testing, other
+	methods for manipulating with thermostat and logging moved to
+	ThermostatUtilities
+	* src/org/thermostat/qa/framework/ThermostatUtilities.java:
+	added new class for manipulating with thermostat, ThermostatTest
+	and ThermostatOutputTextsGenerator both extend this class
+	* src/org/thermostat/qa/reporter/FileUtils.java:
+	method (readTextFile) made public, because it is used from the text
+	generator
+	* src/org/thermostat/qa/testsuites/OutputMessagesTest.java:
+	rewritten, so it uses the output messages stored in textfiles in
+	outputtexts/versionN
+	* src/org/thermostat/qa/testsuites/AgentTest.java:
+	modified import ThermostatUtilities.GuiThread, former 
+	ThermostatTest.GuiThread
+	* test.properties:
+	added thermostat_output_version property, value is version1
+
 2013-07-09  Jana Fabrikova  <jfabriko@redhat.com>
 	* Makefile:
 	adding Patterns.class to the goal all classes
--- a/Makefile	Tue Jul 09 18:26:44 2013 +0200
+++ b/Makefile	Wed Jul 10 18:02:48 2013 +0200
@@ -63,6 +63,8 @@
 	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/TestStatus.class \
 	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/ThermostatGuiTest.class \
 	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/ThermostatTest.class \
+	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/ThermostatUtilities.class \
+	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/ThermostatOutputTextsGenerator.class \
 	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/GuiRobot.class \
 	$(BUILD_DIR)/$(FRAMEWORK_PACKAGE)/Patterns.class \
 	$(BUILD_DIR)/$(TEST_PACKAGE)/AgentTest.class \
@@ -91,6 +93,14 @@
 	$(JAVA) -cp $(BUILD_DIR) org.thermostat.qa.testsuites.$$tst 2>&1 | tee $(LOGS_DIR)/$(DATE)/$$tst.log ; \
 	done
 
+#create a directory outputtexts/versionN for the current version
+#of the output_texts (can be found in the test.properties)
+#generate output help messages into files
+generatetexts:	$(ALL_CLASSES)
+	mkdir -p outputtexts
+	mkdir -p outputtexts/`cat test.properties | grep thermostat_output_version | sed -e 's/^.*=//g;s/$$//g'`
+	java -cp $(BUILD_DIR) org.thermostat.qa.framework.ThermostatOutputTextsGenerator
+
 # targets for all test suites
 TESTSUITES = $(shell ls -1 $(SOURCE_DIR)/$(TEST_PACKAGE) | sed -n -e 's/\([A-Za-z0-9]*\)\.java/\1/p')
 
--- a/src/org/thermostat/qa/common/Configuration.java	Tue Jul 09 18:26:44 2013 +0200
+++ b/src/org/thermostat/qa/common/Configuration.java	Wed Jul 10 18:02:48 2013 +0200
@@ -46,6 +46,7 @@
 
     private String thermostatExecutablePath = null;
     private String thermostatExecutableName = null;
+    private String thermostatOutputTextsVersion = null;
 
     // if true -> gfx tests would be run against pre-generated screenshots
     private static boolean dummyGfxTests = false;
@@ -100,8 +101,14 @@
         properties.load(fileInputStream);
         this.thermostatExecutablePath = properties.getProperty("thermostat_executable_path");
         this.thermostatExecutableName = properties.getProperty("thermostat_executable_name");
+        this.thermostatOutputTextsVersion = properties.getProperty("thermostat_output_version");
     }
 
+    public String getThermostatOutputTextsVersion()
+    {
+        return this.thermostatOutputTextsVersion;
+    }
+    
     public String getThermostatExecutable()
     {
         return this.thermostatExecutablePath + this.thermostatExecutableName;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa/framework/ThermostatOutputTextsGenerator.java	Wed Jul 10 18:02:48 2013 +0200
@@ -0,0 +1,140 @@
+/*
+
+    ThermostatQA - test framework for Thermostat Monitoring Tool
+
+    Copyright 2013 Red Hat, Inc.
+
+This file is part of ThermostatQA
+
+ThermostatQA is distributed under the GNU General Public License,
+version 2 or any later version (with a special exception described
+below, commonly known as the "Classpath Exception").
+
+A copy of GNU General Public License (GPL) is included in this
+distribution, in the file COPYING.
+
+Linking ThermostatQA code with other modules is making a combined work
+based on ThermostatQA.  Thus, the terms and conditions of the GPL
+cover the whole combination.
+
+As a special exception, the copyright holders of ThermostatQA give you
+permission to link this code with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on ThermostatQA code.  If you modify ThermostatQA, you may
+extend this exception to your version of the software, but you are
+not obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+
+
+package org.thermostat.qa.framework;
+
+import java.io.IOException;
+import java.util.List;
+
+
+import org.thermostat.qa.reporter.FileUtils;
+import org.thermostat.qa.testsuites.OutputMessagesTest;
+
+
+/**
+ * Class ThermostatOutputTextGenerator
+ * contains methods for generating the output texts needed for
+ * OutputMessagesTest testsuite automatically.
+ */
+public class ThermostatOutputTextsGenerator extends ThermostatUtilities
+{
+
+   /**
+    * Method getThermostatOutputForParams
+    * runs thermostat with given parameters in a new process
+    * returns the process output.
+    * 
+    * @param flags
+    * @return
+    * @throws IOException
+    */
+    public List<String> getThermostatOutputForParams(String... flags) throws IOException
+    {
+        Process process = runThermostatInNewProcess(flags);
+        return readProcessOutput(process);
+    }
+
+    /**
+     * Method writeTextsForOutputMessagesTest
+     * gets output for all the possible commands that appear
+     * in OutputMessagesTest and writes the output into text
+     * files in the <code>outputtext/version?</code> directory
+     * for current version of the thermostat outputs.
+     * 
+     * @throws IOException
+     */
+    public void writeTextsForOutputMessagesTest() throws IOException
+    {
+        List<String> output = null;
+        String fileName = null;
+        String[][] allflags = OutputMessagesTest.allflags;        
+        
+        int i=0;
+        for(String[] flags : allflags)
+        {
+            i++;
+            output = getThermostatOutputForParams(flags);
+            fileName = getFileNameFromCommand(flags);
+            if(output != null)
+            {
+                FileUtils.writeTextFile(fileName, output);
+                System.out.println(fileName+" written (file "+i+" from "+allflags.length+")");
+            }else{
+                System.out.println(fileName+" NULL OUTPUT, NOT WRITTEN (file "+i+" from "+allflags.length+")");
+            }
+        }
+    }
+    
+    /**
+     * Method getFileNameFromCommand transforms
+     * given parameters into txt file name, e.g.:
+     * thermostat help agent ... thermostat_help_agent.txt
+     * 
+     * @param flags
+     * @return
+     */
+    public String getFileNameFromCommand(String... flags)
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append("outputtexts/");
+        sb.append(this.configuration.getThermostatOutputTextsVersion());
+        sb.append("/thermostat");
+        if(flags != null)
+        {
+            for(String s : flags)
+            {
+                sb.append("_");
+                sb.append(s);
+            }
+        }
+        String str = sb.toString() + ".txt";
+        
+        return str;
+    }
+    
+    /**
+     * Method main
+     * reads current configuration from test.properties, and
+     * generates the texts used in OutputMessagesTest.
+     * 
+     * @param args
+     * @throws IOException
+     */
+    public static void main(String[] args) throws IOException
+    {
+        ThermostatOutputTextsGenerator totg = new ThermostatOutputTextsGenerator();
+        totg.setConfigurationFromProperties(null);
+        totg.writeTextsForOutputMessagesTest();
+    }
+}
--- a/src/org/thermostat/qa/framework/ThermostatTest.java	Tue Jul 09 18:26:44 2013 +0200
+++ b/src/org/thermostat/qa/framework/ThermostatTest.java	Wed Jul 10 18:02:48 2013 +0200
@@ -34,18 +34,12 @@
 
 package org.thermostat.qa.framework;
 
-import java.awt.event.KeyEvent;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
+
+
 
 import org.thermostat.qa.common.Configuration;
-import org.thermostat.qa.reporter.FileUtils;
 
 
 
@@ -56,17 +50,9 @@
  *
  * @author Pavel Tisnovsky
  */
-public abstract class ThermostatTest
+public abstract class ThermostatTest extends ThermostatUtilities
 {
     /**
-     * Expected exit value of all thermostat processes.
-     */
-    protected static final int EXPECTED_EXIT_VALUE = 0;
-
-    protected static final int ONE_SEC = 1000;
-    protected static final int FIVE_SEC = 5 * ONE_SEC;
-
-    /**
      * Number of tests that passed.
      */
     private int passed = 0;
@@ -82,11 +68,6 @@
     private int error = 0;
 
     /**
-     * Current test configuration.
-     */
-    protected Configuration configuration = null;
-
-    /**
      * Set up the test suite. To be implemented by specific test cases.
      */
     protected abstract void setUp();
@@ -96,104 +77,6 @@
      */
     protected abstract void tearDown();
 
-    public class ServiceStarter implements Runnable
-    {
-        @Override
-        public void run()
-        {
-            Process process;
-            try
-            {
-                process = runThermostatInNewProcess("service", "");
-                List<String> processOutput = readProcessOutput(process);
-                for (String s : processOutput)
-                {
-                    logInfo("run", "Service starter: " +  s);
-                }
-                Assert.assertNotNull(processOutput, "error getting standard output");
-            }
-            catch (IOException e)
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public class StorageStarter implements Runnable
-    {
-        @Override
-        public void run()
-        {
-            Process process;
-            try
-            {
-                process = runThermostatInNewProcess("storage", "--start");
-                List<String> processOutput = readProcessOutput(process);
-                for (String s : processOutput)
-                {
-                    logInfo("run", "Storage starter: " +  s);
-                }
-                Assert.assertNotNull(processOutput, "error getting standard output");
-            }
-            catch (IOException e)
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public class GuiThread extends Thread
-    {
-        @Override
-        public void run()
-        {
-            Process process;
-            try
-            {
-                process = runThermostatInNewProcess("gui");
-                List<String> processOutput = readProcessOutput(process);
-                sleep(ONE_SEC);
-                Assert.assertNotNull(processOutput, "no output from process");
-                int exitValue = process.exitValue();
-                Assert.assertEquals(exitValue, EXPECTED_EXIT_VALUE, "Bad thermostat exit value " + exitValue);
-            }
-            catch (IOException e)
-            {
-                e.printStackTrace();
-            }
-            catch (InterruptedException e)
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-    
-    public class AgentThread extends Thread
-    {
-        @Override
-        public void run()
-        {
-         Process process;
-         try
-         {
-             process = runThermostatInNewProcess("agent");
-             List<String> processOutput = readProcessOutput(process);
-             sleep(ONE_SEC);
-             Assert.assertNotNull(processOutput, "no output from process");
-//             int exitValue = process.exitValue();
-//             Assert.assertEquals(exitValue, EXPECTED_EXIT_VALUE, "Bad thermostat exit value " + exitValue);
-         }
-         catch (IOException e)
-         {
-             e.printStackTrace();
-         }
-         catch (InterruptedException e)
-         {
-             e.printStackTrace();
-         }
-        }        
-    }
-
     /**
      * Run all tests found in the current test suite.
      * 
@@ -379,87 +262,6 @@
     }
 
     /**
-     * Log into a standard output.
-     * 
-     * @param prefix
-     *            string printed before class name.
-     * @param delimiter
-     *            delimiter between prefix and the class name.
-     * @param methodName
-     *            name of method implementing the test.
-     */
-    protected void log(String prefix, char delimiter, String methodName) {
-        System.out.println(prefix + ": " + this.getClass().getName() + delimiter + methodName);
-    }
-
-    protected void logInfo(String methodName, String message)
-    {
-        log("INFO", '.', methodName + ": " + message);
-    }
-
-    /**
-     * Log into a standard output.
-     * 
-     * @param prefix
-     *            string printed before class name.
-     * @param delimiter
-     *            delimiter between prefix and the class name.
-     * @param methodName
-     *            name of method implementing the test.
-     * @param exception
-     *            message generated from exception
-     */
-    protected void log(String prefix, char delimiter, String methodName, String exception) {
-        System.out.println(prefix + ": " + this.getClass().getName() + delimiter + methodName + " " + exception);
-    }
-
-    /**
-     * Returns version of Java. The input could have the following form: "1.7.0_06"
-     * and we are interested only in "7" in this case.
-     * 
-     * @return Java version
-     */
-    protected int getJavaVersion() {
-        String javaVersionStr = System.getProperty("java.version");
-        String[] parts = javaVersionStr.split("\\.");
-        return Integer.parseInt(parts[1]);
-    }
-
-    /**
-     * 
-     * @param process
-     * @throws IOException
-     */
-    protected void waitForExternalProcess(Process process) throws IOException
-    {
-        InputStreamReader processStdOut = new InputStreamReader(process.getInputStream());
-        while (processStdOut.read() != -1)
-        {
-            // should be empty ;-)
-        }
-        processStdOut.close();
-    }
-
-    /**
-     * 
-     * @param process
-     * @return
-     * @throws IOException
-     */
-    public List<String> readProcessOutput(Process process) throws IOException
-    {
-        List<String> out = new ArrayList<String>();
-        BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream()));
-        String line;
-        while ((line = bufferedReader.readLine()) != null)
-        {
-            out.add(line);
-        }
-        bufferedReader.close();
-        return out;
-    }
-  
-    /**
      * 
      * @param line1
      * @param line2
@@ -470,137 +272,4 @@
         Assert.assertEquals(line1, line2, line1 + " != " + line2);
     }
 
-
-    /**
-     * 
-     * @param cmd
-     * @return
-     * @throws IOException
-     */
-    protected Process runProcess(String... cmd) throws IOException
-    {
-        return Runtime.getRuntime().exec(cmd);
-    }
-
-    /**
-     * 
-     * @return
-     * @throws IOException
-     */
-    protected Process runThermostatInNewProcess() throws IOException
-    {
-        return Runtime.getRuntime().exec(this.configuration.getThermostatExecutable());
-    }
-
-    /**
-     * 
-     * @param flags
-     * @return
-     * @throws IOException
-     */
-    public Process runThermostatInNewProcess(String... flags) throws IOException
-    {
-        if (!useFlags(flags))
-        {
-            return runThermostatInNewProcess();
-        }
-        String[] cmdArray = new String[flags.length + 1];
-        cmdArray[0] = this.configuration.getThermostatExecutable();
-        System.arraycopy(flags, 0, cmdArray, 1, flags.length);
-        return Runtime.getRuntime().exec(cmdArray);
-    }
-
-    /**
-     * 
-     * @param flags
-     * @return
-     */
-    private boolean useFlags(String... flags)
-    {
-        return !(flags == null || flags.length == 0 || flags[0] == null);
-    }
-
-    /**
-     * 
-     * @param scriptName
-     * @return
-     * @throws IOException
-     */
-    protected List<String> runHelperBashScript(String scriptName, String... params) throws IOException
-    {
-        String readScriptName = "./scripts/" + scriptName;
-
-        if (!useFlags(params))
-        {
-            Process process = runProcess("bash", readScriptName);
-            return readProcessOutput(process);
-        }
-        String[] cmdArray = new String[params.length + 2];
-        cmdArray[0] = "bash";
-        cmdArray[1] = readScriptName;
-        System.arraycopy(params, 0, cmdArray, 2, params.length);
-        Process process = runProcess(cmdArray);
-        return readProcessOutput(process);
-    }
-
-    protected void sleep(int ms)
-    {
-        try
-        {
-            Thread.sleep(ms);
-        }
-        catch (InterruptedException e)
-        {
-            e.printStackTrace();
-        }
-    }
-
-    protected void printOutput(List<String> out)
-    {
-        for (String s : out)
-        {
-            System.out.println(s);
-        }
-    }
-
-    protected void startStorage()
-    {
-        new Thread(new StorageStarter()).start();
-        // let the storage to setup and warm-up
-        sleep(2 * ONE_SEC);
-    }
-
-    protected void stopStorage() throws IOException
-    {
-        Process process = runThermostatInNewProcess("storage", "--stop");
-        List<String> processOutput = readProcessOutput(process);
-        for (String s : processOutput)
-        {
-            logInfo("run", "Storage stopper: " +  s);
-        }
-        Assert.assertNotNull(processOutput, "error getting standard output");
-    }
-    
-    public List<String> runCommandsInThermostatShell(String commandsFileName) throws IOException
-    {
-        String scriptFileName = "run_thermostat_shell_with_commands.sh";
-        //write the script specific to our test.properties
-        //thermostat bin shell + commands for thermostat shell
-        List<String> lines = new LinkedList<String>();
-        lines.add(this.configuration.getThermostatExecutable() + " shell < ./scripts/" + commandsFileName);
-        FileUtils.writeTextFile("./scripts/"+scriptFileName, lines);
-        
-        //chmod - make the script executable
-        String[] cmdArray = new String[]{"chmod","+x","./scripts/"+scriptFileName};
-        Runtime.getRuntime().exec(cmdArray);
-        
-        //run the new script
-        return runHelperBashScript(scriptFileName);
-    }
-    
-    protected void stopGUI(GuiRobot robot)
-    {
-        robot.pressCtrlPlusKey(KeyEvent.VK_Q);
-    }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/thermostat/qa/framework/ThermostatUtilities.java	Wed Jul 10 18:02:48 2013 +0200
@@ -0,0 +1,389 @@
+/*
+
+    ThermostatQA - test framework for Thermostat Monitoring Tool
+
+    Copyright 2013 Red Hat, Inc.
+
+This file is part of ThermostatQA
+
+ThermostatQA is distributed under the GNU General Public License,
+version 2 or any later version (with a special exception described
+below, commonly known as the "Classpath Exception").
+
+A copy of GNU General Public License (GPL) is included in this
+distribution, in the file COPYING.
+
+Linking ThermostatQA code with other modules is making a combined work
+based on ThermostatQA.  Thus, the terms and conditions of the GPL
+cover the whole combination.
+
+As a special exception, the copyright holders of ThermostatQA give you
+permission to link this code with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on ThermostatQA code.  If you modify ThermostatQA, you may
+extend this exception to your version of the software, but you are
+not obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+
+
+package org.thermostat.qa.framework;
+
+import java.awt.event.KeyEvent;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+
+import org.thermostat.qa.common.Configuration;
+import org.thermostat.qa.reporter.FileUtils;
+
+
+
+/**
+ * Class ThermostatUtilities
+ * contains the helper methods for running thermostat commands in processes,
+ * running auxiliary scripts, and getting output from the processes.
+ *
+ */
+
+public abstract class ThermostatUtilities
+{
+    /**
+     * Expected exit value of all thermostat processes.
+     */
+    protected static final int EXPECTED_EXIT_VALUE = 0;
+
+    protected static final int ONE_SEC = 1000;
+    protected static final int FIVE_SEC = 5 * ONE_SEC;
+
+    /**
+     * Current configuration of thermostat tests.
+     */
+    protected Configuration configuration = null;
+    
+    public void setConfigurationFromProperties(String[] args)
+    {
+        this.configuration = new Configuration(args);
+    }
+
+    public class ServiceStarter implements Runnable
+    {
+        @Override
+        public void run()
+        {
+            Process process;
+            try
+            {
+                process = runThermostatInNewProcess("service", "");
+                List<String> processOutput = readProcessOutput(process);
+                for (String s : processOutput)
+                {
+                    logInfo("run", "Service starter: " +  s);
+                }
+                Assert.assertNotNull(processOutput, "error getting standard output");
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public class StorageStarter implements Runnable
+    {
+        @Override
+        public void run()
+        {
+            Process process;
+            try
+            {
+                process = runThermostatInNewProcess("storage", "--start");
+                List<String> processOutput = readProcessOutput(process);
+                for (String s : processOutput)
+                {
+                    logInfo("run", "Storage starter: " +  s);
+                }
+                Assert.assertNotNull(processOutput, "error getting standard output");
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public class GuiThread extends Thread
+    {
+        @Override
+        public void run()
+        {
+            Process process;
+            try
+            {
+                process = runThermostatInNewProcess("gui");
+                List<String> processOutput = readProcessOutput(process);
+                sleep(ONE_SEC);
+                Assert.assertNotNull(processOutput, "no output from process");
+                int exitValue = process.exitValue();
+                Assert.assertEquals(exitValue, EXPECTED_EXIT_VALUE, "Bad thermostat exit value " + exitValue);
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
+            }
+            catch (InterruptedException e)
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public class AgentThread extends Thread
+    {
+        @Override
+        public void run()
+        {
+         Process process;
+         try
+         {
+             process = runThermostatInNewProcess("agent");
+             List<String> processOutput = readProcessOutput(process);
+             sleep(ONE_SEC);
+             Assert.assertNotNull(processOutput, "no output from process");
+//             int exitValue = process.exitValue();
+//             Assert.assertEquals(exitValue, EXPECTED_EXIT_VALUE, "Bad thermostat exit value " + exitValue);
+         }
+         catch (IOException e)
+         {
+             e.printStackTrace();
+         }
+         catch (InterruptedException e)
+         {
+             e.printStackTrace();
+         }
+        }        
+    }
+
+    /**
+     * Log into a standard output.
+     * 
+     * @param prefix
+     *            string printed before class name.
+     * @param delimiter
+     *            delimiter between prefix and the class name.
+     * @param methodName
+     *            name of method implementing the test.
+     */
+    protected void log(String prefix, char delimiter, String methodName) {
+        System.out.println(prefix + ": " + this.getClass().getName() + delimiter + methodName);
+    }
+
+    protected void logInfo(String methodName, String message)
+    {
+        log("INFO", '.', methodName + ": " + message);
+    }
+
+    /**
+     * Log into a standard output.
+     * 
+     * @param prefix
+     *            string printed before class name.
+     * @param delimiter
+     *            delimiter between prefix and the class name.
+     * @param methodName
+     *            name of method implementing the test.
+     * @param exception
+     *            message generated from exception
+     */
+    protected void log(String prefix, char delimiter, String methodName, String exception) {
+        System.out.println(prefix + ": " + this.getClass().getName() + delimiter + methodName + " " + exception);
+    }
+
+    /**
+     * Returns version of Java. The input could have the following form: "1.7.0_06"
+     * and we are interested only in "7" in this case.
+     * 
+     * @return Java version
+     */
+    protected int getJavaVersion() {
+        String javaVersionStr = System.getProperty("java.version");
+        String[] parts = javaVersionStr.split("\\.");
+        return Integer.parseInt(parts[1]);
+    }
+
+    /**
+     * 
+     * @param process
+     * @throws IOException
+     */
+    protected void waitForExternalProcess(Process process) throws IOException
+    {
+        InputStreamReader processStdOut = new InputStreamReader(process.getInputStream());
+        while (processStdOut.read() != -1)
+        {
+            // should be empty ;-)
+        }
+        processStdOut.close();
+    }
+
+    /**
+     * 
+     * @param process
+     * @return
+     * @throws IOException
+     */
+    public List<String> readProcessOutput(Process process) throws IOException
+    {
+        List<String> out = new ArrayList<String>();
+        BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream()));
+        String line;
+        while ((line = bufferedReader.readLine()) != null)
+        {
+            out.add(line);
+        }
+        bufferedReader.close();
+        return out;
+    }
+  
+    /**
+     * 
+     * @param cmd
+     * @return
+     * @throws IOException
+     */
+    protected Process runProcess(String... cmd) throws IOException
+    {
+        return Runtime.getRuntime().exec(cmd);
+    }
+
+    /**
+     * 
+     * @return
+     * @throws IOException
+     */
+    protected Process runThermostatInNewProcess() throws IOException
+    {
+        return Runtime.getRuntime().exec(this.configuration.getThermostatExecutable());
+    }
+
+    /**
+     * 
+     * @param flags
+     * @return
+     * @throws IOException
+     */
+    public Process runThermostatInNewProcess(String... flags) throws IOException
+    {
+        if (!useFlags(flags))
+        {
+            return runThermostatInNewProcess();
+        }
+        String[] cmdArray = new String[flags.length + 1];
+        cmdArray[0] = this.configuration.getThermostatExecutable();
+        System.arraycopy(flags, 0, cmdArray, 1, flags.length);
+        return Runtime.getRuntime().exec(cmdArray);
+    }
+
+    /**
+     * 
+     * @param flags
+     * @return
+     */
+    private boolean useFlags(String... flags)
+    {
+        return !(flags == null || flags.length == 0 || flags[0] == null);
+    }
+
+    /**
+     * 
+     * @param scriptName
+     * @return
+     * @throws IOException
+     */
+    protected List<String> runHelperBashScript(String scriptName, String... params) throws IOException
+    {
+        String readScriptName = "./scripts/" + scriptName;
+
+        if (!useFlags(params))
+        {
+            Process process = runProcess("bash", readScriptName);
+            return readProcessOutput(process);
+        }
+        String[] cmdArray = new String[params.length + 2];
+        cmdArray[0] = "bash";
+        cmdArray[1] = readScriptName;
+        System.arraycopy(params, 0, cmdArray, 2, params.length);
+        Process process = runProcess(cmdArray);
+        return readProcessOutput(process);
+    }
+
+    protected void sleep(int ms)
+    {
+        try
+        {
+            Thread.sleep(ms);
+        }
+        catch (InterruptedException e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    protected void printOutput(List<String> out)
+    {
+        for (String s : out)
+        {
+            System.out.println(s);
+        }
+    }
+
+    protected void startStorage()
+    {
+        new Thread(new StorageStarter()).start();
+        // let the storage to setup and warm-up
+        sleep(2 * ONE_SEC);
+    }
+
+    protected void stopStorage() throws IOException
+    {
+        Process process = runThermostatInNewProcess("storage", "--stop");
+        List<String> processOutput = readProcessOutput(process);
+        for (String s : processOutput)
+        {
+            logInfo("run", "Storage stopper: " +  s);
+        }
+        Assert.assertNotNull(processOutput, "error getting standard output");
+    }
+    
+    public List<String> runCommandsInThermostatShell(String commandsFileName) throws IOException
+    {
+        String scriptFileName = "run_thermostat_shell_with_commands.sh";
+        //write the script specific to our test.properties
+        //thermostat bin shell + commands for thermostat shell
+        List<String> lines = new LinkedList<String>();
+        lines.add(this.configuration.getThermostatExecutable() + " shell < ./scripts/" + commandsFileName);
+        FileUtils.writeTextFile("./scripts/"+scriptFileName, lines);
+        
+        //chmod - make the script executable
+        String[] cmdArray = new String[]{"chmod","+x","./scripts/"+scriptFileName};
+        Runtime.getRuntime().exec(cmdArray);
+        
+        //run the new script
+        return runHelperBashScript(scriptFileName);
+    }
+    
+    protected void stopGUI(GuiRobot robot)
+    {
+        robot.pressCtrlPlusKey(KeyEvent.VK_Q);
+    }
+
+}
--- a/src/org/thermostat/qa/reporter/FileUtils.java	Tue Jul 09 18:26:44 2013 +0200
+++ b/src/org/thermostat/qa/reporter/FileUtils.java	Wed Jul 10 18:02:48 2013 +0200
@@ -70,7 +70,7 @@
      * @return list of string containing content of text file or empty list in
      *            case of any exception
      */
-    protected static List<String> readTextFile(String fileName)
+    public static List<String> readTextFile(String fileName)
     {
         BufferedReader reader = null;
         List<String> out = new LinkedList<String>();
--- a/src/org/thermostat/qa/testsuites/AgentTest.java	Tue Jul 09 18:26:44 2013 +0200
+++ b/src/org/thermostat/qa/testsuites/AgentTest.java	Wed Jul 10 18:02:48 2013 +0200
@@ -39,7 +39,7 @@
 
 import org.thermostat.qa.framework.Assert;
 import org.thermostat.qa.framework.ThermostatTest;
-import org.thermostat.qa.framework.ThermostatTest.GuiThread;
+import org.thermostat.qa.framework.ThermostatUtilities.GuiThread;
 
 /**
  * Class AgentTest
--- a/src/org/thermostat/qa/testsuites/OutputMessagesTest.java	Tue Jul 09 18:26:44 2013 +0200
+++ b/src/org/thermostat/qa/testsuites/OutputMessagesTest.java	Wed Jul 10 18:02:48 2013 +0200
@@ -43,6 +43,7 @@
 import org.thermostat.qa.annotations.TestTypes;
 import org.thermostat.qa.framework.Assert;
 import org.thermostat.qa.framework.ThermostatTest;
+import org.thermostat.qa.reporter.FileUtils;
 
 /**
  * Class OutputMessagesTest 
@@ -55,298 +56,80 @@
 @TestType(TestTypes.CLI_TEST)
 public class OutputMessagesTest extends ThermostatTest
 {
-    private static final String[] THERMOSTAT_STANDARD_MESSAGE = new String[] {
-        "list of commands:",
-        "",
-        " help                   show help for a given command or help overview",
-        " agent                  starts and stops the thermostat agent",
-        " connect                persistently connect to storage",
-        " disconnect             disconnect from the currently used storage",
-        " dump-heap              trigger a heap dump on the VM",
-        " find-objects           finds objects in a heapdump",
-        " find-root              finds the shortest path from an object to a GC root",
-        " gui                    launches the GUI client",
-        " list-heap-dumps        list all heap dumps",
-        " list-vms               lists all currently monitored VMs",
-        " object-info            prints information about an object in a heap dump",
-        " ping                   using the Command Channel, send a ping to a running agent",
-        " save-heap-dump-to-file saves a heap dump to a local file",
-        " service                starts and stops the thermostat storage and agent",
-        " shell                  launches the Thermostat interactive shell",
-        " show-heap-histogram    show the heap histogram",
-        " storage                starts and stops the thermostat storage",
-        " vm-info                shows basic information about a VM",
-        " vm-stat                show various statistics about a VM",
-        " webservice             starts and stops the thermostat web service"
-    };
-
-    private static final String[] THERMOSTAT_HELP_MESSAGE = new String[] {
-        "list of commands:",
-        "",
-        " help                   show help for a given command or help overview",
-        " agent                  starts and stops the thermostat agent",
-        " connect                persistently connect to storage",
-        " disconnect             disconnect from the currently used storage",
-        " dump-heap              trigger a heap dump on the VM",
-        " find-objects           finds objects in a heapdump",
-        " find-root              finds the shortest path from an object to a GC root",
-        " gui                    launches the GUI client",
-        " list-heap-dumps        list all heap dumps",
-        " list-vms               lists all currently monitored VMs",
-        " object-info            prints information about an object in a heap dump",
-        " ping                   using the Command Channel, send a ping to a running agent",
-        " save-heap-dump-to-file saves a heap dump to a local file",
-        " service                starts and stops the thermostat storage and agent",
-        " shell                  launches the Thermostat interactive shell",
-        " show-heap-histogram    show the heap histogram",
-        " storage                starts and stops the thermostat storage",
-        " vm-info                shows basic information about a VM",
-        " vm-stat                show various statistics about a VM",
-        " webservice             starts and stops the thermostat web service"
-    };
-
-    private static final String[] THERMOSTAT_HELP_AGENT_MESSAGE = new String[] {
-        "usage: thermostat agent [-d <url>] [-s] [-l <level>]",
-        "                  starts and stops the thermostat agent",
-        "thermostat agent",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -s,--saveOnExit             save the data on exit"
-    };
-
-    private static final String[] THERMOSTAT_HELP_CONNECT_MESSAGE = new String[] {
-        "usage: thermostat connect -d <url> [-l <level>]",
-        "                  persistently connect to storage",
-        "thermostat connect",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF"
-    };
-
-    private static final String[] THERMOSTAT_HELP_DISCONNECT_MESSAGE = new String[] {
-        "usage: thermostat disconnect [-l <level>]",
-        "                  disconnect from the currently used storage",
-        "thermostat disconnect",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-    };
-
-    private static final String[] THERMOSTAT_HELP_DUMP_HEAP_MESSAGE = new String[] {
-        "usage: thermostat dump-heap --vmId <vm> --hostId <host> [--dbUrl <dbUrl>]",
-        "                  [--logLevel <logLevel>]",
-        "                  trigger a heap dump on the VM",
-        "thermostat dump-heap",
-        "  -a,--hostId <host>          the ID of the host to monitor",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -v,--vmId <vm>              the ID of the VM to monitor"
-    };
-
-    private static final String[] THERMOSTAT_HELP_FIND_OBJECTS_MESSAGE = new String[] {
-        "usage: thermostat find-objects --heapId <heap> [--dbUrl <dbUrl>] [--limit",
-        "                  <limit>] [--logLevel <logLevel>] pattern",
-        "                  finds objects in a heapdump",
-        "thermostat find-objects",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -h,--heapId <heap>          the ID of the heapdump to analyze",
-        "  -L,--limit <limit>          limit search to top N results, defaults to 10",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF"       
-    };
-
-    private static final String[] THERMOSTAT_HELP_FIND_ROOT_MESSAGE = new String[] {
-        "usage: thermostat find-root --objectId <heap> --heapId <heap> [--dbUrl <dbUrl>]",
-        "                  [--all] [--logLevel <logLevel>]",
-        "                  finds the shortest path from an object to a GC root",
-        "thermostat find-root",
-        "  -a,--all                    finds all paths to GC roots",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -h,--heapId <heap>          the ID of the heapdump to analyze",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -o,--objectId <heap>        the ID of the object to query"
-    };
-
-    private static final String[] THERMOSTAT_HELP_GUI_MESSAGE = new String[] {
-        "usage: thermostat gui [-l <level>]",
-        "                  launches the GUI client",
-        "thermostat gui",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-    };
-
-    private static final String[] THERMOSTAT_HELP_LIST_HEAP_DUMPS_MESSAGE = new String[] {
-        "usage: thermostat list-heap-dumps [--vmId <vm>] [--dbUrl <dbUrl>] [--hostId",
-        "                  <host>] [--logLevel <logLevel>]",
-        "                  list all heap dumps",
-        "thermostat list-heap-dumps",
-        "  -a,--hostId <host>          the ID of the host to monitor",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -v,--vmId <vm>              the ID of the VM to monitor"
-    };
-
-    private static final String[] THERMOSTAT_HELP_LIST_VMS_MESSAGE = new String[] {
-        "usage: thermostat list-vms [-d <url>] [-l <level>]",
-        "                  lists all currently monitored VMs",
-        "thermostat list-vms",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF"
-    };
-
-    private static final String[] THERMOSTAT_HELP_OBJECT_INFO_MESSAGE = new String[] {
-        "usage: thermostat object-info --objectId <object> --heapId <heap> [--dbUrl",
-        "                  <dbUrl>] [--logLevel <logLevel>]",
-        "                  prints information about an object in a heap dump",
-        "thermostat object-info",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -h,--heapId <heap>          the ID of the heapdump to analyze",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -o,--objectId <object>      the ID of the object to query"
-    };
-
-    private static final String[] THERMOSTAT_HELP_PING_MESSAGE = new String[] {
-        "usage: thermostat ping <agentId> [-d <url>] [-l <level>]",
-        "                  using the Command Channel, send a ping to a running agent",
-        "thermostat ping",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF"
-    };
-
-    private static final String[] THERMOSTAT_HELP_SAVE_HEAP_DUMP_TO_FILE_MESSAGE = new String[] {
-        "usage: thermostat save-heap-dump-to-file --file <filename> --heapId <heap>",
-        "                  [--dbUrl <dbUrl>] [--logLevel <logLevel>]",
-        "                  saves a heap dump to a local file",
-        "thermostat save-heap-dump-to-file",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -f,--file <filename>        the file name to save to",
-        "  -h,--heapId <heap>          the ID of the heapdump to analyze",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF"
-    };
-
-    private static final String[] THERMOSTAT_HELP_SERVICE_MESSAGE = new String[] {
-        "usage: thermostat service [-l <level>]",
-        "                  starts and stops the thermostat storage and agent",
-        "thermostat service",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-    };
-
-    private static final String[] THERMOSTAT_HELP_SHELL_MESSAGE = new String[] {
-        "usage: thermostat shell",
-        "                  launches the Thermostat interactive shell",
-        "thermostat shell",
-        "",
-    };
-
-    private static final String[] THERMOSTAT_HELP_SHOW_HEAP_HISTOGRAM_MESSAGE = new String[] {
-        "usage: thermostat show-heap-histogram --heapId <heap> [--dbUrl <dbUrl>]",
-        "                  [--logLevel <logLevel>]",
-        "                  show the heap histogram",
-        "thermostat show-heap-histogram",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -h,--heapId <heap>          the ID of the heapdump to analyze",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF"
-    };
-
-    private static final String[] THERMOSTAT_HELP_STORAGE_MESSAGE = new String[] {
-        "usage: thermostat storage <--start|--stop|--status> [--dryRun] [-q] [-l <level>]",
-        "                  starts and stops the thermostat storage",
-        "thermostat storage",
-        "  -d,--dryRun                 run the service in dry run mode",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -q,--quiet                  don't produce any output",
-        "     --start                  start the database",
-        "     --status                 check if the database is running",
-        "     --stop                   stop the database"
-    };
-
-    private static final String[] THERMOSTAT_HELP_VM_INFO_MESSAGE = new String[] {
-        "usage: thermostat vm-info [--vmId <vm>] [--hostId <host>] [-d <url>] [-l",
-        "                  <level>]",
-        "                  shows basic information about a VM",
-        "thermostat vm-info",
-        "  -a,--hostId <hostId>        the ID of the host to monitor",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -v,--vmId <vmId>            the ID of the VM to monitor"
-    };
-
-    private static final String[] THERMOSTAT_HELP_VM_STAT_MESSAGE = new String[] {
-        "usage: thermostat vm-stat --hostId <host> --vmId <vm> [-d <url>] [-l <level>]",
-        "                  show various statistics about a VM",
-        "thermostat vm-stat",
-        "  -a,--hostId <hostId>        the ID of the host to monitor",
-        "  -c,--continuous             print data continuously",
-        "  -d,--dbUrl <dbUrl>          connect to the given URL",
-        "  -l,--logLevel <logLevel>    sets the log level for this invocation. Possible",
-        "                              values for <logLevel> in decreasing severity are:",
-        "                              SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST",
-        "                              and OFF",
-        "  -v,--vmId <vmId>            the ID of the VM to monitor"
-    };
-
-    private static final String[] THERMOSTAT_HELP_WEBSERVICE_MESSAGE = new String[] {
-        "usage: thermostat webservice -d <url> -b <addrs> [-l <level>]",
-        "                  starts and stops the thermostat web service",
-        "thermostat webservice",
-        "  -b,--bindAddrs <bindAddrs>    A comma separated list of IP address, port pairs",
-        "                                used for binding (e.g.",
-        "                                127.0.0.1:8888,127.0.0.1:8889)",
-        "  -d,--dbUrl <dbUrl>            connect to the given URL",
-        "  -l,--logLevel <logLevel>      sets the log level for this invocation. Possible",
-        "                                values for <logLevel> in decreasing severity",
-        "                                are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER,",
-        "                                FINEST and OFF",
-    };
+    /**
+     * The field allflags should be changed whenever the called flags change
+     * because output text generator uses this commands for thermostat.
+     */
+    public static final String[][] allflags = new String[][]{ (String[])null,
+        {"help"},
+        {"help","agent"},
+        {"help", "connect"},
+        {"help", "disconnect"},
+        {"help", "dump-heap"},
+        {"help", "find-objects"},
+        {"help", "find-root"},
+        {"help", "gui"},
+        {"help", "list-heap-dumps"},
+        {"help", "list-vms"},
+        {"help", "object-info"},
+        {"help", "ping"},
+        {"help", "save-heap-dump-to-file"},
+        {"help", "show-heap-histogram"},
+        {"help", "service"},
+        {"help", "shell"},
+        {"help", "storage"},
+        {"help", "vm-info"},
+        {"help", "vm-stat"},
+        {"help", "webservice"} };
+    
+    private String pathToOutputTexts;
+    private String[] THERMOSTAT_STANDARD_MESSAGE, 
+    THERMOSTAT_HELP_MESSAGE, 
+    THERMOSTAT_HELP_AGENT_MESSAGE, 
+    THERMOSTAT_HELP_CONNECT_MESSAGE, 
+    THERMOSTAT_HELP_DISCONNECT_MESSAGE, 
+    THERMOSTAT_HELP_DUMP_HEAP_MESSAGE,
+    THERMOSTAT_HELP_FIND_OBJECTS_MESSAGE,
+    THERMOSTAT_HELP_FIND_ROOT_MESSAGE,
+    THERMOSTAT_HELP_GUI_MESSAGE,
+    THERMOSTAT_HELP_LIST_HEAP_DUMPS_MESSAGE,
+    THERMOSTAT_HELP_LIST_VMS_MESSAGE,
+    THERMOSTAT_HELP_OBJECT_INFO_MESSAGE,
+    THERMOSTAT_HELP_PING_MESSAGE,
+    THERMOSTAT_HELP_SAVE_HEAP_DUMP_TO_FILE_MESSAGE,
+    THERMOSTAT_HELP_SERVICE_MESSAGE,
+    THERMOSTAT_HELP_SHELL_MESSAGE,
+    THERMOSTAT_HELP_SHOW_HEAP_HISTOGRAM_MESSAGE,
+    THERMOSTAT_HELP_STORAGE_MESSAGE,
+    THERMOSTAT_HELP_VM_INFO_MESSAGE,
+    THERMOSTAT_HELP_VM_STAT_MESSAGE,
+    THERMOSTAT_HELP_WEBSERVICE_MESSAGE;
 
     @Override
     protected void setUp()
     {
-        // TODO Auto-generated method stub
-        
+        pathToOutputTexts = "outputtexts/"+this.configuration.getThermostatOutputTextsVersion()+"/";
+        THERMOSTAT_STANDARD_MESSAGE = getStringArrayFromOutputTextFile("thermostat.txt");
+        THERMOSTAT_HELP_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help.txt");
+        THERMOSTAT_HELP_AGENT_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_agent.txt");
+        THERMOSTAT_HELP_CONNECT_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_connect.txt");
+        THERMOSTAT_HELP_DISCONNECT_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_disconnect.txt"); 
+        THERMOSTAT_HELP_DUMP_HEAP_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_dump-heap.txt");
+        THERMOSTAT_HELP_FIND_OBJECTS_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_find-objects.txt");
+        THERMOSTAT_HELP_FIND_ROOT_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_find-root.txt");
+        THERMOSTAT_HELP_GUI_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_gui.txt");
+        THERMOSTAT_HELP_LIST_HEAP_DUMPS_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_list-heap-dumps.txt");
+        THERMOSTAT_HELP_LIST_VMS_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_list-vms.txt");
+        THERMOSTAT_HELP_OBJECT_INFO_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_object-info.txt");
+        THERMOSTAT_HELP_PING_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_ping.txt");
+        THERMOSTAT_HELP_SAVE_HEAP_DUMP_TO_FILE_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_save-heap-dump-to-file.txt");
+        THERMOSTAT_HELP_SERVICE_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_service.txt");
+        THERMOSTAT_HELP_SHELL_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_shell.txt");
+        THERMOSTAT_HELP_SHOW_HEAP_HISTOGRAM_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_show-heap-histogram.txt");
+        THERMOSTAT_HELP_STORAGE_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_storage.txt");
+        THERMOSTAT_HELP_VM_INFO_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_vm-info.txt");
+        THERMOSTAT_HELP_VM_STAT_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_vm-stat.txt");
+        THERMOSTAT_HELP_WEBSERVICE_MESSAGE = getStringArrayFromOutputTextFile("thermostat_help_webservice.txt");
     }
 
     @Override
@@ -380,6 +163,12 @@
         Assert.assertNotNull(processOutput, "error getting standard output");
         compareMessages(template, processOutput);
     }
+    
+    private String[] getStringArrayFromOutputTextFile(String fileName)
+    {
+        String[] strs = FileUtils.readTextFile(pathToOutputTexts+fileName).toArray(new String[0]);
+        return strs;
+    }
 
     /**
      * Method testCheckStandardMessage
@@ -389,7 +178,7 @@
      */
     public void testCheckStandardMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_STANDARD_MESSAGE, (String[])null);
+        readAndCheckThermostatMessage(THERMOSTAT_STANDARD_MESSAGE, allflags[0]);
     }
 
     /**
@@ -400,7 +189,7 @@
      */
     public void testCheckHelpMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_MESSAGE, "help");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_MESSAGE, allflags[1]);
     }
 
     /**
@@ -411,7 +200,7 @@
      */
     public void testCheckHelpAgentMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_AGENT_MESSAGE, "help", "agent");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_AGENT_MESSAGE, allflags[2]);
     }
 
     /**
@@ -422,7 +211,7 @@
      */
     public void testCheckHelpConnectMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_CONNECT_MESSAGE, "help", "connect");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_CONNECT_MESSAGE, allflags[3]);
     }
 
     /**
@@ -433,7 +222,7 @@
      */
     public void testCheckHelpDisconnectMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_DISCONNECT_MESSAGE, "help", "disconnect");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_DISCONNECT_MESSAGE, allflags[4]);
     }
 
     /**
@@ -444,7 +233,7 @@
      */
     public void testCheckHelpDumpHeapMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_DUMP_HEAP_MESSAGE, "help", "dump-heap");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_DUMP_HEAP_MESSAGE, allflags[5]);
     }
 
     /**
@@ -455,7 +244,7 @@
      */
     public void testCheckHelpFindObjectsMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_FIND_OBJECTS_MESSAGE, "help", "find-objects");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_FIND_OBJECTS_MESSAGE, allflags[6]);
     }
 
     /**
@@ -466,7 +255,7 @@
      */
     public void testCheckHelpFindRootMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_FIND_ROOT_MESSAGE, "help", "find-root");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_FIND_ROOT_MESSAGE, allflags[7]);
     }
 
     /**
@@ -477,7 +266,7 @@
      */
     public void testCheckHelpGuiMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_GUI_MESSAGE, "help", "gui");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_GUI_MESSAGE, allflags[8]);
     }
 
     /**
@@ -488,7 +277,7 @@
      */
     public void testCheckHelpListHeapDumpsMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_LIST_HEAP_DUMPS_MESSAGE, "help", "list-heap-dumps");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_LIST_HEAP_DUMPS_MESSAGE, allflags[9]);
     }
 
     /**
@@ -499,7 +288,7 @@
      */
     public void testCheckHelpListVmsMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_LIST_VMS_MESSAGE, "help", "list-vms");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_LIST_VMS_MESSAGE, allflags[10]);
     }
 
     /**
@@ -510,7 +299,7 @@
      */
     public void testCheckHelpObjectInfoMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_OBJECT_INFO_MESSAGE, "help", "object-info");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_OBJECT_INFO_MESSAGE, allflags[11]);
     }
 
     /**
@@ -521,7 +310,7 @@
      */
     public void testCheckHelpPingMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_PING_MESSAGE, "help", "ping");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_PING_MESSAGE, allflags[12]);
     }
 
     /**
@@ -532,7 +321,7 @@
      */
     public void testCheckHelpSaveHeapDumpToFileMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_SAVE_HEAP_DUMP_TO_FILE_MESSAGE, "help", "save-heap-dump-to-file");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_SAVE_HEAP_DUMP_TO_FILE_MESSAGE, allflags[13]);
     }
 
     /**
@@ -543,7 +332,7 @@
      */
     public void testCheckHelpShowHeapHistogramMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_SHOW_HEAP_HISTOGRAM_MESSAGE, "help", "show-heap-histogram");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_SHOW_HEAP_HISTOGRAM_MESSAGE, allflags[14]);
     }
 
     /**
@@ -554,7 +343,7 @@
      */
     public void testCheckHelpServiceMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_SERVICE_MESSAGE, "help", "service");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_SERVICE_MESSAGE, allflags[15]);
     }
 
     /**
@@ -565,7 +354,7 @@
      */
     public void testCheckHelpShellMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_SHELL_MESSAGE, "help", "shell");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_SHELL_MESSAGE, allflags[16]);
     }
 
     /**
@@ -576,7 +365,7 @@
      */
     public void testCheckHelpStorageMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_STORAGE_MESSAGE, "help", "storage");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_STORAGE_MESSAGE, allflags[17]);
     }
 
     /**
@@ -587,7 +376,7 @@
      */
     public void testCheckHelpVmInfoMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_VM_INFO_MESSAGE, "help", "vm-info");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_VM_INFO_MESSAGE, allflags[18]);
     }
 
     /**
@@ -598,7 +387,7 @@
      */
     public void testCheckHelpVmStatMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_VM_STAT_MESSAGE, "help", "vm-stat");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_VM_STAT_MESSAGE, allflags[19]);
     }
     
     /**
@@ -609,7 +398,7 @@
      */
     public void testCheckHelpWebserviceMessage() throws IOException
     {
-        readAndCheckThermostatMessage(THERMOSTAT_HELP_WEBSERVICE_MESSAGE, "help", "webservice");
+        readAndCheckThermostatMessage(THERMOSTAT_HELP_WEBSERVICE_MESSAGE, allflags[20]);
     }
 
     public static void main(String[] args)
--- a/test.properties	Tue Jul 09 18:26:44 2013 +0200
+++ b/test.properties	Wed Jul 10 18:02:48 2013 +0200
@@ -1,3 +1,3 @@
 thermostat_executable_path=/home/jfabriko/thermostaty/testing_thermostat/thermostat/distribution/target/bin/
 thermostat_executable_name=thermostat
-
+thermostat_output_version=version1