1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon;
20
21 import org.apache.log4j.Logger;
22 /***
23 * Iterates over all nested tags one time per row of a CSV file.
24 * The name of the CSV file is based on the <code>testEnvironment</code>, <code>organization</code>, and the
25 * <code>name</code> attributes. The directory structure, then follows the <code>testEnvironment</code>
26 * then inside that directory the <code>organization</code> if set. The file name matches the name set in
27 * the csv attribute.
28 *
29 * For example, to execute the opening of an application and doing something <b>n</b> number of times:
30 * <pre><source>
31 * <testcase xmlns="jelly:jameleon">
32 * <csv name="some_file_name_without_extension">
33 * <some-session application="someApp" beginSession="true">
34 * <some-tag-that-uses-context-variables
35 * functionId="Verify successful navigation, using a different variable."/>
36 * </some-session>
37 * </csv>
38 * </testcase>
39 * </source></pre>
40 *
41 * Maybe opening the application <b>n</b> number of times takes too long, but
42 * each of the scenarios still need to be executed. Try putting the csv tag inside
43 * the session tag:
44 * <pre><source>
45 * <testcase xmlns="jelly:jameleon">
46 * <some-session application="someApp" beginSession="true">
47 * <csv name="some_file_name_without_extension">
48 * <some-tag-that-uses-context-variables
49 * functionId="Verify successful navigation, using a different variable."/>
50 * </csv>
51 * </some-session>
52 * </testcase>
53 * </source></pre>
54 *
55 *
56 * All values that are not defined in a CSV file will be considered 'null'. To define an empty String,
57 * simply define the value as <b>""</b>.
58 * For example:
59 * <pre><source>
60 * var1,var2,var3
61 * one,"",</source></pre>
62 * In the above example, var2 will be an empty string and var3 will be null.
63 * @jameleon.function name="csv"
64 */
65 public class CsvTag extends AbstractCsvTag {
66
67 /***
68 * Gets the logger used for this tag
69 * @return the logger used for this tag.
70 */
71 protected Logger getLogger(){
72 return Logger.getLogger(CsvTag.class.getName());
73 }
74
75 /***
76 * Gets the trace message when the execution is beginning and ending.
77 * The message displayed will already start with BEGIN: or END:
78 * @return the trace message when the execution is just beginning and ending.
79 */
80 protected String getTagTraceMsg(){
81 return "parsing " + getCsvFile();
82 }
83
84 /***
85 * Describe the tag when error messages occur.
86 * The most appropriate message might be the tag name itself.
87 * @return A brief description of the tag or the tag name itself.
88 */
89 public String getTagDescription(){
90 return "csv tag";
91 }
92
93 }