Apache Jakarta and Beyond: A Java Programmeramp;#039;s Introduction [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Apache Jakarta and Beyond: A Java Programmeramp;#039;s Introduction [Electronic resources] - نسخه متنی

Larne Pekowsky

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







5.1. An Introduction to HTTPUnit


The problem of testing Web sites is so ubiquitous and so important that a set of tools called HTTPUnit Listing 5.1.

[1] The name comes from Hypertext Transfer Protocol, the protocol used between Web servers and clients.



Listing 5.2. A simple HTTPUnit test


package com.awl.toolbook chapter05;
import junit.framework.*;
import com.meterware.httpunit.*;
public class WebTest1 extends TestCase {
public void testGet() throws Exception {
WebConversation wc = new WebConversation();
WebRequest req = new GetMethodWebRequest(
"http://localhost:8080/toolbook/chapter05/sample.jsp");
WebResponse res = wc.getResponse(req);
assertTrue(res.getText().indexOf("Hello") != -1);
}
}

Listing 5.1.

Note that WebTest1 extends TestCase, so it may be run the same way that the examples in Chapter 4 were run. HTTPUnit exists as a set of add-on classes to JUnit, so all the points made about how and what to test still hold.


/ 207