Menu

Multithreading: Please help

Help
beuveda
2007-03-23
2013-04-25
  • beuveda

    beuveda - 2007-03-23

    Let’s say I have 3 test cases TC1, TC2 and TC3. As far as I understood Jameleon will launch the 3 test cases one after the other. But is it possible for Jameleon to launch TC1, TC2 and TC3 in parallel and having at the end of the test run the success/failure  report on TC1, TC and TC3.

    If yes how can I achieve it

    Thank You in advance

     
    • Christian Hargraves

      This can be done via Ant. Take a look at it here:

      http://jameleon.sourceforge.net/antTasks.html (look for <parallel>)

      I might look at the Jelly Thread tag libraries to see how to implement this in Jelly.

      http://jakarta.apache.org/commons/jelly/libs/threads/tags.html

       
    • beuveda

      beuveda - 2007-03-23

      Below you'll find my ant script parallel.xml launching in parallell 2 tasks T1 and T2. When I launch the script, I can see the tasks running in parallel. But when the tasks are over, I can not find the TestResults.html. What am I missing ? Can you please add to the script below what I must add for getting the TestResults.html ?

      I launch the script with the command: ant -lib C:\MyPrograms\jameleon-test-suite\lib -f parallel.xml

      <project name="Run parallel" default="parallel" basedir=".">

        <property file="build.properties" />

          <path id="base.classpath">
              <fileset dir="${lib.dir}">
                <include name="*.jar"/>
              </fileset>
              <pathelement location="${lib.dir}"/>
            </path>

            <path id="classpath">
              <path refid="base.classpath"/>
              <pathelement location="${build.dir}"/>
              <pathelement location="${res.dir}"/>
            </path>

            <taskdef resource="ant/JameleonAntTasks.properties" format="properties" classpathref="classpath"/>
         
          <target name="T1" description="">
              <jmln-test printTestSuiteSummary="true" >
                  <fileset dir="scripts/thread">
                      <include name="T1.xml"/>
                  </fileset>
              </jmln-test>
          </target>

          <target name="T2" description="">
              <jmln-test printTestSuiteSummary="true" >
                  <fileset dir="scripts/thread">
                      <include name="T2.xml"/>
                  </fileset>
              </jmln-test>
          </target>

         <target name="parallel">
            <parallel>
              <antcall target="T1"/>
              <antcall target="T2"/>
          </parallel>
         </target>

      </project>

      Thank you in advance

       
      • Christian Hargraves

        Try doing this same test in the jameleon-test-suite package first. Once it works there, then try whatever other way you are trying in this example.

         
    • beuveda

      beuveda - 2007-03-23

      I don't know velocity but errors are mentionned in the velocity log below

      Fri Mar 23 15:24:18 CET 2007  [debug] AvalonLogSystem initialized using logfile 'velocity.log'
      Fri Mar 23 15:24:18 CET 2007   [info] **************************************************************
      Fri Mar 23 15:24:18 CET 2007   [info] Starting Jakarta Velocity v1.4
      Fri Mar 23 15:24:18 CET 2007   [info] RuntimeInstance initializing.
      Fri Mar 23 15:24:18 CET 2007   [info] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
      Fri Mar 23 15:24:18 CET 2007   [info] Trying to use logger class org.apache.velocity.runtime.log.AvalonLogSystem
      Fri Mar 23 15:24:18 CET 2007   [info] Using logger class org.apache.velocity.runtime.log.AvalonLogSystem
      Fri Mar 23 15:24:18 CET 2007   [info] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
      Fri Mar 23 15:24:18 CET 2007   [info] Resource Loader Instantiated: net.sf.jameleon.util.VelocityClasspathResourceLoader
      Fri Mar 23 15:24:18 CET 2007   [info] VelocityClasspathResourceLoader : initialization starting.
      Fri Mar 23 15:24:18 CET 2007   [info] VelocityClasspathResourceLoader : initialization complete.
      Fri Mar 23 15:24:18 CET 2007   [info] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
      Fri Mar 23 15:24:18 CET 2007   [info] Default ResourceManager initialization complete.
      Fri Mar 23 15:24:18 CET 2007   [info] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
      Fri Mar 23 15:24:18 CET 2007   [info] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
      Fri Mar 23 15:24:18 CET 2007   [info] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
      Fri Mar 23 15:24:18 CET 2007   [info] Loaded System Directive: org.apache.velocity.runtime.directive.Include
      Fri Mar 23 15:24:18 CET 2007   [info] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
      Fri Mar 23 15:24:18 CET 2007   [info] Created: 20 parsers.
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : initialization starting.
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : adding VMs from VM library template : VM_global_library.vm
      Fri Mar 23 15:24:18 CET 2007  [error] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : error using  VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro :  VM library template macro registration complete.
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : allowInline = true : VMs can be defined inline in templates
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : allowInlineLocal = false : VMs defined inline will be  global in scope if allowed.
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : messages on  : VM system will output logging messages
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : autoload off  : VM system will not automatically reload global library macros
      Fri Mar 23 15:24:18 CET 2007   [info] Velocimacro : initialization complete.
      Fri Mar 23 15:24:18 CET 2007   [info] Velocity successfully started.
      Fri Mar 23 15:24:18 CET 2007   [info] ResourceManager : found TestCaseDocsTemplate.txt with loader net.sf.jameleon.util.VelocityClasspathResourceLoader
      Fri Mar 23 15:24:18 CET 2007   [info] ResourceManager : found TestCaseDocsTemplate.txt with loader net.sf.jameleon.util.VelocityClasspathResourceLoader
      Fri Mar 23 15:24:18 CET 2007  [error] Left side ($session.application.length()) of '>' operation has null value. Operation not possible. TestCaseDocsTemplate.txt [line 60, column 54]
      Fri Mar 23 15:24:18 CET 2007  [error] Left side ($session.organization.length()) of '>' operation has null value. Operation not possible. TestCaseDocsTemplate.txt [line 63, column 55]
      Fri Mar 23 15:24:18 CET 2007  [error] Left side ($session.application.length()) of '>' operation has null value. Operation not possible. TestCaseDocsTemplate.txt [line 60, column 54]
      Fri Mar 23 15:24:18 CET 2007  [error] Left side ($session.organization.length()) of '>' operation has null value. Operation not possible. TestCaseDocsTemplate.txt [line 63, column 55]

      Again thank you for your help

       
    • beuveda

      beuveda - 2007-03-26

      Now it's working only if there is no error during the execution of the parallel task. If a script failed then the printsummary is not added to the TestResults.html. How come ?

       
      • Christian Hargraves

        I don't know. You are treading new ground here and right now, I don't have the time to help you figure this out in a timely manner w/o a reproducible test case that I can use to try and figure it out. What plug-in are you trying to use to thread?

         
    • beuveda

      beuveda - 2007-03-26

      My configuration is the following. I just unzipped the jameleon-test-suite-3.3-M4.zip in a directory called jam_final. In jam_final\jameleon-test-suite\scripts I have created 4 scripts called T1.xml, T2.xml, T3.xml and
      T4.xml. All like the following

      <jmln:testcase xmlns:jmln="jelly:jameleon"
                     xmlns:j="jelly:core"
                     xmlns:junit="jelly:junit"
                                 xmlns:ant="jelly:ant">

        <jmln:test-case-summary>
            UPLOAD A DEPOSITREQUEST FILE OF TYPE .XML
        </jmln:test-case-summary>

        <jmln:test-case-author>Daniel Beuve-Mery</jmln:test-case-author>
        <jmln:test-case-level>ACCEPTANCE</jmln:test-case-level>
        <jmln:test-case-level>FTP</jmln:test-case-level>
        <jmln:test-case-requirement>UATSC083</jmln:test-case-requirement>
        <jmln:application-tested>MID</jmln:application-tested>

        <jmln:ju-session application="MID">
          <ant:echo message="AAAAA 1"/>
          <ant:echo message="AAAAA 2"/>
          <ant:echo message="AAAAA 3"/>
                         .
                         .
          <ant:echo message="AAAAA 9"/>
          <ant:echo message="AAAAA 80"/>
        </jmln:ju-session>
      </jmln:testcase>

      T1 echoes AAAA stuff, T2 echoes BBB stuff, T3 echoes CCC stuff and T4 echoes DDD stuff. 

      As shown on http://jameleon.sourceforge.net/antTasks.html, I have added the following tasks at the end of jam_final\jameleon-test-suite\build.xml

      <target name="T1" description="T1">
      <jmln-test printTestSuiteSummary="false" throwExceptionOnFailure="false">
      <fileset dir="scripts">
      <include name="T1.xml"/>
      </fileset>
      </jmln-test>
      </target>

      <target name="T2" description="T2">
      <jmln-test waitTimeBetweenScripts="2000" printTestSuiteSummary="false" throwExceptionOnFailure="false">
      <fileset dir="scripts">
      <include name="T2.xml"/>
      </fileset>
      </jmln-test>
      </target>

      <target name="T3" description="T3">
      <jmln-test waitTimeBetweenScripts="2000" printTestSuiteSummary="false" throwExceptionOnFailure="false">
      <fileset dir="scripts">
      <include name="T3.xml"/>
      </fileset>
      </jmln-test>
      </target>

      <target name="T4" description="T4">
      <jmln-test waitTimeBetweenScripts="2000" printTestSuiteSummary="false" throwExceptionOnFailure="false">
      <fileset dir="scripts">
      <include name="T4.xml"/>
      </fileset>
      </jmln-test>
      </target>

      <target name="print.test.summary" description="Prints the test case execution summary at the end of the HTML results">
          <jmln-test printTestSuiteSummary="true">
              <fileset dir="scripts">
                  <exclude name="*.*"/>
              </fileset>
          </jmln-test>
      </target>

      <target name="parallel">
      <parallel failonany="false">
      <antcall target="T1"/>
      <antcall target="T2"/>
      <antcall target="T3"/>
      <antcall target="T4"/>
      </parallel>
      <antcall target="print.test.summary"/>
      </target>

      </project>

      I run it by launching: ant parallel

      If none of the tasks are throwing an error, then I can see the correct report with the summary. If all the tasks throws an error with <junit:fail message="TX failed"> then I got a report with a summary but one task is missing and for each run it is a different one. Any idea ?

       
    • beuveda

      beuveda - 2007-03-26

      My apologize for my last post. It's working now. There was an error in 1 script.

      Thank you for all your quick replies.

      For the ones who are interested in this matter, the attribute throwExceptionOnFailure in jmln-test must be set to false. Otherwise if there is an error, the TestSummary will not be printed in TestResults.html.

      Cheers

       
      • Christian Hargraves

        I think you're other problem is that you are using the Jelly JUnit tags and not the Jameleon Junit tags. The jameleon JUnit tags behave a little differently.

         

Log in to post a comment.