mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gary_williams
28.08.2007 bd333cd4becce1bfc0cad6123233af5603163f0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
 
The purpose of the parsing tool is to parse comments from the functional test xml files.
The comments must have preset tags in order for the them to be properly captured by the 
parsing tool. This README files will describe what is needed in the comments of
the functional test xml files, and how to build and run the parsing tool.
 
***Function Test XML Files - Test Group Tags***
 
Each directory will be assumed to contain the tests within a test group. 
Each test group needs to have the following tags.......
 
#@TestGroupName
#@TestGroupPurpose
#@TestSubgroupName  [only necessary for some test groups, like Security]
 
It is not critical in which xml file or where in the xml file these tags are located,
as long as the xml file is in the proper directory for the test group. For convenience,
the tags for the test group should be near the top of the xml file which is used
for setting up for the test group test cases.
 
The following is an example for the test group, functional-tests/testcases/security/pwd_storage,
and is located in file, security_setup_pwd_storage.xml
 
      <!---
            Place group-specific test information here.
            #@TestGroupName             Security
            #@TestGroupPurpose          To test the security functionality.
            #@TestSubgroupName          Password Storage Schemes
      -->
 
Some test groups will not have the tag, #@TestSubgroupName. 
 
For instance, the test group tags for the Backend group are
 
     <!--
            Place group-specific test information here.
            #@TestGroupName             Backends
            #@TestGroupPurpose          To test the backend functionality.
     -->
 
***Function Test XML Files - Test Suite Tags***
 
Each xml file will be treated as a test suite. Each file should contain the following tags......
 
#@TestSuiteName
#@TestSuitePurpose
#@TestSuiteGroup
#@TestScript
 
The tags should be located near the top of each file. The exact location is not critical.
 
The following example is from the test suite, MD5 Tests, which is located in 
functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml.
 
      <!---
            Place suite-specific test information here.
            #@TestSuiteName             MD5 Tests
            #@TestSuitePurpose          Test the MD5 storage scheme.
            #@TestSuiteGroup            MD5 Storage Scheme Tests
            #@TestScript                security_pwd_MD5.xml
      -->
 
***Function Test XML Files - Test Case Tags***
 
Each functional test xml file will have multiple test cases. 
Each test case should have the following tags........
 
#@TestMarker
#@TestName
#@TestIssue
#@TestPurpose
#@TestPreamble
#@TestStep
#@TestPostamble
#@TestResult
 
The tags should be located near the beginning of each test case. 
 
The #@TestMarker should match the value of #@TestSuiteName. The parsing tool needs this
correlation to match each test case with the proper test suite.
 
The #@TestIssue should be the number in IssueTracker that corresponds to the feature or defect
which this test case is testing. Do not add the hyperlink to the issue web page.
The parsing tool adds the hyperlink when it runs.
 
As many #@TestStep tags may used to define the steps that are involved in each test case.
There should be one #@TestStep tag for each step. There is no limit to the number of test
steps which may be defined. Each test step may have multiple lines.
 
The #@TestResult may have multiple lines.
 
The following example is from the file, 
functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml
 
       <!---
            Place test-specific test information here.
            The tag, TestMarker, must be the same as the tag, TestSuiteName.
            #@TestMarker                MD5 Tests
            #@TestName                  MD5 Preamble
            #@TestIssue                 312
            #@TestPurpose               Change password storage scheme to MD5.
            #@TestPreamble              none
            #@TestStep                  Client calls ldapmodify 
                                        with the filename to the appropriate file.
            #@TestPostamble             none
            #@TestResult                Success if OpenDS returns 0
        -->
 
The following is another example from the file,
functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml
Note that this example contains three test steps.
 
       <!---
            Place test-specific test information here.
            The tag, TestMarker, must be the same as the tag, TestSuiteName.
            #@TestMarker                MD5 Tests
            #@TestName                  MD5 Test 1
            #@TestIssue                 312
            #@TestPurpose               Test MD5 password storage scheme.
            #@TestPreamble              none
            #@TestStep                  Admin changes a user's password to convert 
                                        so it is stored as MD5 scheme. 
            #@TestStep                  The user binds with the new password.
            #@TestStep                  Admin retrieves the user's password and 
                                        checks for the required {MD5} prefix.
            #@TestPostamble             none
            #@TestResult                Success if OpenDS returns 0 for the ldap
                                        operations and the password has the {MD5} prefix.
        -->
 
***Building the Parser Tool***
 
No other packages are necessary for building the java files other than those 
that come with the jvm. Java version 1.5.0 was used to build the java files.
 
Command line build while in the directory containing the java files.....
javac *.java
 
***Running the Parser Tool***
 
Three parameters are required to run the parsing tool from the command line, directory-to-testcase-files,
directory-for-output-files, and file format.
 
Command line execution.....
java -cp [path-to-class-files] GenerateOpenDSTestSpecs [directory-to-testcase-files] [directory-for-output-files] [file format]
 
The directory-to-testcase-files is the directory from where the parsing tool will begin searching
for functional test files to parse. The parsing tool will only search one or two levels below
the value for this parameter.
 
The directory-for-output-files is where the parsing tool will place the output xml files.
 
The file format is necessary because the same code is used for the unit-integration tests where
java files are parsed for test specifications rather than xml files. The file format must be
"xml" for the functional tests.
 
An example command line execution of the parsing tool would be
java -cp /export/ParseTestCode GenerateOpenDSTestSpecs /export/src/opends/tests/functional-tests/testcases /export/testspecs xml
 
where
the class files for the parsing tool are in /export/ParseTestCode
the directory-to-testcase-files is /export/src/opends/tests/functional-tests/testcases 
the directory-for-output-files is /export/testspecs
the file format is xml.