Changeset 1340 for trunk/autoquest-plugin-html-test/src
- Timestamp:
- 01/28/14 16:08:31 (11 years ago)
- Location:
- trunk/autoquest-plugin-html-test/src/test
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-html-test/src/test/java/de/ugoe/cs/autoquest/plugin/html/HTMLLogParserTest.java
r1279 r1340 19 19 import java.io.File; 20 20 import java.util.Collection; 21 import java.util.HashMap; 21 22 import java.util.Iterator; 23 import java.util.LinkedList; 22 24 import java.util.List; 25 import java.util.Map; 23 26 import java.util.logging.Level; 24 27 … … 53 56 @Test 54 57 public void testParseFile_1() throws Exception { 55 HTMLLogParser parser = new HTMLLogParser(); 56 parser.parseFile(new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_1.xml").getFile())); 58 HTMLLogParser parser = new HTMLLogParser(new HashMap<String, List<String>>()); 59 parser.parseFile 60 (new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_1.xml").getFile())); 57 61 Collection<List<Event>> events = parser.getSequences(); 58 62 … … 92 96 @Test 93 97 public void testParseFile_2() throws Exception { 94 HTMLLogParser parser = new HTMLLogParser(); 95 parser.parseFile(new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_2.xml").getFile())); 98 HTMLLogParser parser = new HTMLLogParser(new HashMap<String, List<String>>()); 99 parser.parseFile 100 (new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_2.xml").getFile())); 101 Collection<List<Event>> events = parser.getSequences(); 102 103 assertNotNull(events); 104 assertEquals(1, events.size()); 105 106 Iterator<List<Event>> iterator = events.iterator(); 107 assertNotNull(iterator); 108 assertEquals(2, iterator.next().size()); 109 assertFalse(iterator.hasNext()); 110 111 System.err.println("{"); 112 for (List<Event> session : events) { 113 System.err.println(" {"); 114 for (Event event : session) { 115 System.err.print(" "); 116 System.err.print(event); 117 System.err.println(","); 118 } 119 System.err.println(" }"); 120 } 121 System.err.println("}"); 122 System.err.println("\n\n"); 123 124 GUIModel guiModel = parser.getGuiModel(); 125 assertNotNull(guiModel); 126 127 for (IGUIElement root : guiModel.getRootElements()) { 128 dumpGUIElement(root, guiModel, ""); 129 } 130 } 131 132 /** 133 * Tests the parseFile method with a given trace file. 134 * @throws Exception 135 */ 136 @Test 137 public void testParseFile_3() throws Exception { 138 Map<String, List<String>> params = new HashMap<String, List<String>>(); 139 List<String> list = new LinkedList<String>(); 140 list.add("td[2]"); 141 list.add("th"); 142 params.put("clearIndex", list); 143 HTMLLogParser parser = new HTMLLogParser(params); 144 145 parser.parseFile 146 (new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_3.xml").getFile())); 147 Collection<List<Event>> events = parser.getSequences(); 148 149 assertNotNull(events); 150 assertEquals(1, events.size()); 151 152 Iterator<List<Event>> iterator = events.iterator(); 153 assertNotNull(iterator); 154 assertEquals(2, iterator.next().size()); 155 assertFalse(iterator.hasNext()); 156 157 System.err.println("{"); 158 for (List<Event> session : events) { 159 System.err.println(" {"); 160 for (Event event : session) { 161 System.err.print(" "); 162 System.err.print(event); 163 System.err.println(","); 164 } 165 System.err.println(" }"); 166 } 167 System.err.println("}"); 168 System.err.println("\n\n"); 169 170 GUIModel guiModel = parser.getGuiModel(); 171 assertNotNull(guiModel); 172 173 for (IGUIElement root : guiModel.getRootElements()) { 174 dumpGUIElement(root, guiModel, ""); 175 } 176 } 177 178 /** 179 * Tests the parseFile method with a given trace file. 180 * @throws Exception 181 */ 182 @Test 183 public void testParseFile_4() throws Exception { 184 Map<String, List<String>> params = new HashMap<String, List<String>>(); 185 List<String> list = new LinkedList<String>(); 186 list.add("html/body[1]/h1"); 187 params.put("clearId", list); 188 HTMLLogParser parser = new HTMLLogParser(params); 189 190 parser.parseFile 191 (new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_4.xml").getFile())); 192 Collection<List<Event>> events = parser.getSequences(); 193 194 assertNotNull(events); 195 assertEquals(1, events.size()); 196 197 Iterator<List<Event>> iterator = events.iterator(); 198 assertNotNull(iterator); 199 assertEquals(2, iterator.next().size()); 200 assertFalse(iterator.hasNext()); 201 202 System.err.println("{"); 203 for (List<Event> session : events) { 204 System.err.println(" {"); 205 for (Event event : session) { 206 System.err.print(" "); 207 System.err.print(event); 208 System.err.println(","); 209 } 210 System.err.println(" }"); 211 } 212 System.err.println("}"); 213 System.err.println("\n\n"); 214 215 GUIModel guiModel = parser.getGuiModel(); 216 assertNotNull(guiModel); 217 218 for (IGUIElement root : guiModel.getRootElements()) { 219 dumpGUIElement(root, guiModel, ""); 220 } 221 } 222 223 /** 224 * Tests the parseFile method with a given trace file. 225 * @throws Exception 226 */ 227 @Test 228 public void testParseFile_5() throws Exception { 229 Map<String, List<String>> params = new HashMap<String, List<String>>(); 230 List<String> list = new LinkedList<String>(); 231 list.add("html/body[1]/h1(htmlId=id_h1)"); 232 params.put("clearId", list); 233 HTMLLogParser parser = new HTMLLogParser(params); 234 235 parser.parseFile 236 (new File(ClassLoader.getSystemResource("htmlmonitor_testtrace_4.xml").getFile())); 96 237 Collection<List<Event>> events = parser.getSequences(); 97 238
Note: See TracChangeset
for help on using the changeset viewer.