1 5 6 package net.sourceforge.jwebunit; 7 8 import net.sourceforge.jwebunit.HttpUnitDialog; 9 import junit.framework.TestCase; 10 11 import java.io.PrintStream ; 12 13 21 public class WebTestCase extends TestCase { 22 protected WebTester tester; 23 24 public WebTestCase(String name) { 25 super(name); 26 tester = new WebTester(); 27 } 28 29 public WebTestCase() { 30 tester = new WebTester(); 31 } 32 33 protected WebTester getTester() { 34 return tester; 35 } 36 37 public HttpUnitDialog getDialog() { 38 return tester.getDialog(); 39 } 40 41 public TestContext getTestContext() { 42 return tester.getTestContext(); 43 } 44 45 public void beginAt(String relativeURL) { 46 tester.beginAt(relativeURL); 47 } 48 49 public String getMessage(String key) { 50 return tester.getMessage(key); 51 } 52 53 55 public void assertTitleEquals(String title) { 56 tester.assertTitleEquals(title); 57 } 58 59 public void assertTitleEqualsKey(String titleKey) { 60 tester.assertTitleEqualsKey(titleKey); 61 } 62 63 public void assertKeyPresent(String key) { 64 tester.assertKeyPresent(key); 65 } 66 67 public void assertTextPresent(String text) { 68 tester.assertTextPresent(text); 69 } 70 71 public void assertKeyNotPresent(String key) { 72 tester.assertKeyNotPresent(key); 73 } 74 75 public void assertTextNotPresent(String text) { 76 tester.assertTextNotPresent(text); 77 } 78 79 public void assertTablePresent(String tableSummaryOrId) { 80 tester.assertTablePresent(tableSummaryOrId); 81 } 82 83 public void assertTableNotPresent(String tableSummaryOrId) { 84 tester.assertTableNotPresent(tableSummaryOrId); 85 } 86 87 public void assertKeyInTable(String tableSummaryOrId, String key) { 88 tester.assertKeyInTable(tableSummaryOrId, key); 89 } 90 91 public void assertTextInTable(String tableSummaryOrId, String text) { 92 tester.assertTextInTable(tableSummaryOrId, text); 93 } 94 95 public void assertKeysInTable(String tableSummaryOrId, String [] keys) { 96 tester.assertKeysInTable(tableSummaryOrId, keys); 97 } 98 99 public void assertTextInTable(String tableSummaryOrId, String [] text) { 100 tester.assertTextInTable(tableSummaryOrId, text); 101 } 102 103 public void assertKeyNotInTable(String tableSummaryOrId, String key) { 104 tester.assertKeyNotInTable(tableSummaryOrId, key); 105 } 106 107 public void assertTextNotInTable(String tableSummaryOrId, String text) { 108 tester.assertTextNotInTable(tableSummaryOrId, text); 109 } 110 111 public void assertTextNotInTable(String tableSummaryOrId, String [] text) { 112 tester.assertTextNotInTable(tableSummaryOrId, text); 113 } 114 115 public void assertTableEquals(String tableSummaryOrId, ExpectedTable expectedTable) { 116 tester.assertTableEquals(tableSummaryOrId, expectedTable.getExpectedStrings()); 117 } 118 119 public void assertTableEquals(String tableSummaryOrId, String [][] expectedCellValues) { 120 tester.assertTableEquals(tableSummaryOrId, expectedCellValues); 121 } 122 123 public void assertTableRowsEqual(String tableSummaryOrId, int startRow, ExpectedTable expectedTable) { 124 tester.assertTableRowsEqual(tableSummaryOrId, startRow, expectedTable); 125 } 126 127 public void assertTableRowsEqual(String tableSummaryOrId, int startRow, String [][] expectedCellValues) { 128 tester.assertTableRowsEqual(tableSummaryOrId, startRow, expectedCellValues); 129 } 130 131 public void assertFormElementPresent(String formElementName) { 132 tester.assertFormElementPresent(formElementName); 133 } 134 135 public void assertFormElementNotPresent(String formElementName) { 136 tester.assertFormElementNotPresent(formElementName); 137 } 138 139 public void assertFormElementPresentWithLabel(String formElementLabel) { 140 tester.assertFormElementPresentWithLabel(formElementLabel); 141 } 142 143 public void assertFormElementNotPresentWithLabel(String formElementLabel) { 144 tester.assertFormElementNotPresentWithLabel(formElementLabel); 145 } 146 147 public void assertFormPresent() { 148 tester.assertFormPresent(); 149 } 150 151 public void assertFormPresent(String formName) { 152 tester.assertFormPresent(formName); 153 } 154 155 public void assertFormNotPresent() { 156 tester.assertFormNotPresent(); 157 } 158 159 public void assertFormNotPresent(String formName) { 160 tester.assertFormNotPresent(formName); 161 } 162 163 public void assertFormElementEquals(String formElementName, String expectedValue) { 164 tester.assertFormElementEquals(formElementName, expectedValue); 165 } 166 167 public void assertFormElementEmpty(String formElementName) { 168 tester.assertFormElementEmpty(formElementName); 169 } 170 171 public void assertCheckboxSelected(String checkBoxName) { 172 tester.assertCheckboxSelected(checkBoxName); 173 } 174 175 public void assertCheckboxNotSelected(String checkBoxName) { 176 tester.assertCheckboxNotSelected(checkBoxName); 177 } 178 179 public void assertRadioOptionPresent(String radioGroup, String radioOption) { 180 tester.assertRadioOptionPresent(radioGroup, radioOption); 181 } 182 183 public void assertRadioOptionNotPresent(String radioGroup, String radioOption) { 184 tester.assertRadioOptionNotPresent(radioGroup, radioOption); 185 } 186 187 public void assertRadioOptionSelected(String radioGroup, String radioOption) { 188 tester.assertRadioOptionSelected(radioGroup, radioOption); 189 } 190 191 public void assertRadioOptionNotSelected(String radioGroup, String radioOption) { 192 tester.assertRadioOptionNotSelected(radioGroup, radioOption); 193 } 194 195 public void assertOptionsEqual(String selectName, String [] options){ 196 tester.assertOptionsEqual(selectName, options); 197 } 198 199 public void assertOptionsNotEqual(String selectName, String [] options){ 200 tester.assertOptionsNotEqual(selectName, options); 201 } 202 203 public void assertOptionValuesEqual(String selectName, String [] options){ 204 tester.assertOptionValuesEqual(selectName, options); 205 } 206 207 public void assertOptionValuesNotEqual(String selectName, String [] options){ 208 tester.assertOptionValuesNotEqual(selectName, options); 209 } 210 211 public void assertOptionEquals(String selectName, String option) { 212 tester.assertOptionEquals(selectName, option); 213 } 214 215 public void assertSubmitButtonPresent(String buttonName) { 216 tester.assertSubmitButtonPresent(buttonName); 217 } 218 219 public void assertSubmitButtonNotPresent(String buttonName) { 220 tester.assertSubmitButtonNotPresent(buttonName); 221 } 222 223 public void assertSubmitButtonValue(String buttonName, String expectedValue) { 224 tester.assertSubmitButtonValue(buttonName, expectedValue); 225 } 226 227 public void assertButtonPresent(String buttonID) { 228 tester.assertButtonPresent(buttonID); 229 } 230 231 public void assertButtonNotPresent(String buttonID) { 232 tester.assertButtonNotPresent(buttonID); 233 } 234 235 public void assertLinkPresent(String linkId) { 236 tester.assertLinkPresent(linkId); 237 } 238 239 public void assertLinkNotPresent(String linkId) { 240 tester.assertLinkNotPresent(linkId); 241 } 242 243 public void assertLinkPresentWithText(String linkText) { 244 tester.assertLinkPresentWithText(linkText); 245 } 246 247 public void assertLinkNotPresentWithText(String linkText) { 248 tester.assertLinkNotPresentWithText(linkText); 249 } 250 251 public void assertLinkPresentWithText(String linkText, int index) { 252 tester.assertLinkPresentWithText(linkText, index); 253 } 254 255 public void assertLinkNotPresentWithText(String linkText, int index) { 256 tester.assertLinkNotPresentWithText(linkText, index); 257 } 258 259 public void assertLinkPresentWithImage(String imageFileName) { 260 tester.assertLinkPresentWithImage(imageFileName); 261 } 262 263 public void assertLinkNotPresentWithImage(String imageFileName) { 264 tester.assertLinkNotPresentWithImage(imageFileName); 265 } 266 267 public void assertElementPresent(String anID) { 268 tester.assertElementPresent(anID); 269 } 270 271 public void assertElementNotPresent(String anID) { 272 tester.assertElementNotPresent(anID); 273 } 274 275 public void assertTextInElement(String elID, String text) { 276 tester.assertTextInElement(elID, text); 277 } 278 279 public void assertTextNotInElement(String elID, String text) { 280 tester.assertTextNotInElement(elID, text); 281 } 282 283 public void assertWindowPresent(String windowName) { 284 tester.assertWindowPresent(windowName); 285 } 286 287 public void assertFramePresent(String frameName) { 288 tester.assertFramePresent(frameName); 289 } 290 291 294 public void assertCookiePresent(String cookieName) { 295 tester.assertCookiePresent(cookieName); 296 } 297 298 public void assertCookieValueEquals(String cookieName, String expectedValue) { 299 tester.assertCookieValueEquals(cookieName, expectedValue); 300 } 301 302 public void dumpCookies() { 303 tester.dumpCookies(); 304 } 305 306 public void dumpCookies(PrintStream stream) { 307 tester.dumpCookies(stream); 308 } 309 310 312 public void setWorkingForm(String nameOrId) { 313 tester.setWorkingForm(nameOrId); 314 } 315 316 protected void setFormElement(String formElementName, String value) { 317 tester.setFormElement(formElementName, value); 318 } 319 320 protected void setFormElementWithLabel(String formElementLabel, String value) { 321 tester.setFormElementWithLabel(formElementLabel, value); 322 } 323 324 protected void checkCheckbox(String checkBoxName) { 325 tester.checkCheckbox(checkBoxName); 326 } 327 328 protected void checkCheckbox(String checkBoxName, String value) { 329 tester.checkCheckbox(checkBoxName, value); 330 } 331 332 protected void uncheckCheckbox(String checkBoxName) { 333 tester.uncheckCheckbox(checkBoxName); 334 } 335 336 protected void uncheckCheckbox(String checkBoxName, String value) { 337 tester.uncheckCheckbox(checkBoxName, value); 338 } 339 340 public void selectOption(String selectName, String option) { 341 tester.selectOption(selectName, option); 342 } 343 344 346 protected void submit() { 347 tester.submit(); 348 } 349 350 public void submit(String buttonName) { 351 tester.submit(buttonName); 352 } 353 354 public void reset() { 355 tester.reset(); 356 } 357 358 protected void clickLinkWithText(String linkText) { 359 tester.clickLinkWithText(linkText); 360 } 361 362 protected void clickLinkWithText(String linkText, int index) { 363 tester.clickLinkWithText(linkText, index); 364 } 365 366 protected void clickLinkWithTextAfterText(String linkText, String labelText) { 367 tester.clickLinkWithTextAfterText(linkText, labelText); 368 } 369 370 protected void clickLinkWithImage(String imageFileName) { 371 tester.clickLinkWithImage(imageFileName); 372 } 373 374 protected void clickLink(String linkId) { 375 tester.clickLink(linkId); 376 } 377 378 protected void clickButton(String buttonId) { 379 tester.clickButton(buttonId); 380 } 381 382 384 public void gotoRootWindow() { 385 tester.gotoRootWindow(); 386 } 387 388 public void gotoWindow(String windowName) { 389 tester.gotoWindow(windowName); 390 } 391 392 public void gotoFrame(String frameName) { 393 tester.gotoFrame(frameName); 394 } 395 396 399 public void gotoPage(String page) { 400 tester.gotoPage(page); 401 } 402 403 405 protected void dumpResponse(PrintStream stream) { 406 tester.dumpResponse(stream); 407 } 408 409 protected void dumpTable(String tableNameOrId, PrintStream stream) { 410 tester.dumpTable(tableNameOrId, stream); 411 } 412 413 protected void dumpTable(String tableNameOrId, String [][] table) { 414 tester.dumpTable(tableNameOrId, table); 415 } 416 417 } 418 | Popular Tags |