commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/xdocs jellyunit.xml navigation.xml
Date Mon, 22 Jul 2002 08:00:36 GMT
jstrachan    2002/07/22 01:00:36

  Modified:    jelly/xdocs navigation.xml
  Added:       jelly/xdocs jellyunit.xml
  Log:
  Added some initial documentation of the JellyUnit features and the JUnit library in Jelly
  
  Revision  Changes    Path
  1.8       +1 -0      jakarta-commons-sandbox/jelly/xdocs/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/xdocs/navigation.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- navigation.xml	18 Jul 2002 14:15:13 -0000	1.7
  +++ navigation.xml	22 Jul 2002 08:00:36 -0000	1.8
  @@ -9,6 +9,7 @@
         <item name="Overview"                href="/index.html"/>
         <item name="FAQ"                     href="/faq.html"/>
         <item name="Detail"                  href="/overview.html"/>
  +      <item name="JellyUnit"               href="/jellyunit.html"/>
         <item name="Tag Reference"           href="/tags.html"/>
         <item name="Download"                href="/dist/"/>
         <item name="To Do List"              href="/todo.html"/>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/xdocs/jellyunit.xml
  
  Index: jellyunit.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <document>
    <properties>
      <title>JellyUnit</title>
      <author email="jstrachan@apache.org">James Strachan</author>
    </properties>
  
    <body>
      <section name="JellyUnit"> 
        <p>
          JellyUnit is a Jelly based JUnit testing mechanism. 
          This allows Jelly scripts to be used to perform unit testing which can be particularly
useful
          if you wish to test XML, XPath, SQL, HTTP, JMS or SOAP interactions.
        </p>
        <p>
          JellyUnit works by using the <a href="tags.html#jelly:junit">JUnit library
</a> in a Jelly script
          to create JUnit TestSuite and TestCase objects. 
          There are all the usual JUnit assertion tests available such as &lt;assert&gt;

          &lt;assertEquals&gt; and &lt;fail&gt;. You can use both Jexl and
XPath expressions in the 
          &lt;assert&gt; tag via either the <i>test</i> or the <i>xpath</i>
attributes.
        </p>
        <p>
          Inside these test scripts you can use the full range of Jelly tags such as navigating
over
          XML test data creating multiple test cases based on sample data, performing SQL
operations, SOAP calls, 
          HTTP or JMS requests etc. 
        </p>
        <p>
          You can also use Ant FileSets and the &lt;fileScanner&gt; tag to iterate
over collections of 
          Jelly scripts or XML data files and use this data to define new test cases.
        </p>
      </section>
      <section name="Integration with TestRunners"> 
        <p>
          To integrate cleanly inside JUnit TestRunner frameworks there is a helper class,
          <a href="apidocs/org/apache/commons/jelly/tags/junit/JellyTestSuite.html">JellyTestSuite</a>
          which you can derive from
          to produce a single Java class which has a static <i>suite()</i> method
to create a TestSuite object 
          containing all the test cases created by the JellyUnit files.
  		There is an 
          <a href="http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/junit/TestJUnit.java?rev=HEAD&amp;content-type=text/vnd.viewcvs-markup">example</a>
          of this in action.
        </p>
        <p>So if you had a test suite defined in a jelly script <a>suite.jelly</a>
in a package com.acme.foo
        	then you could create a class, capable of being ran inside any JUnit test runner
framework as follows
        </p>
  <pre>
  package com.acme.foo;
        
  import junit.framework.TestSuite;
  
  import org.apache.commons.jelly.tags.junit.JellyTestSuite;
  
  /** 
   * A helper class to run jelly test cases in a JUnit TestRunner
   */
  public class TestFoo extends JellyTestSuite {
  
      public static TestSuite suite() throws Exception {
          return createTestSuite(TestFoo.class, "suite.jelly");        
      }
  }
  </pre>
      </section>
    </body>
  </document>
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message