View Javadoc

1   /*
2       Jameleon - An automation testing tool..
3       Copyright (C) 2003 Christian W. Hargraves (engrean@hotmail.com)
4       
5       This library is free software; you can redistribute it and/or
6       modify it under the terms of the GNU Lesser General Public
7       License as published by the Free Software Foundation; either
8       version 2.1 of the License, or (at your option) any later version.
9   
10      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13      Lesser General Public License for more details.
14  
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19  package net.sf.jameleon.function;
20  
21  import java.io.File;
22  
23  import org.apache.commons.jelly.JellyTagException;
24  import org.apache.commons.jelly.MissingAttributeException;
25  import org.apache.commons.jelly.XMLOutput;
26  
27  /***
28   * Documents a single step of a test case.
29   * This tag can be used to document manual test cases. 
30   * Also, sometimes it is too difficult to fit everything 
31   * in the functionId attribute of a tag because there is more 
32   * than one thing happening.
33   * 
34   * @jameleon.function name="function-doc"
35   */
36  public class FunctionDocTag extends FunctionTag {
37  
38  
39      public void testBlock(XMLOutput out) throws MissingAttributeException{
40          //Do nothing since this functional point is used for documentation only.
41      }
42  
43      public void doTag(XMLOutput out) throws MissingAttributeException{
44          setupManualFunction();
45          super.doTag(out);
46      }
47  
48      public void store(File f, int event){
49          //Nothing to do here
50      }
51  
52      protected void setupManualFunction(){
53          String tmpFunctionId = null;
54          try{
55              tmpFunctionId = (String)getBodyText();
56          }catch (JellyTagException jte){
57              //Do nothing. I guess this means there is no text in the body.
58          }
59          if (tmpFunctionId != null && tmpFunctionId.length() > 0) {
60              setAttribute("functionId",tmpFunctionId);
61          }
62      }
63  
64  }