当前位置: 首页 > 工具软件 > JWebUnit > 使用案例 >

Web testing BDD-style with JWebUnit and Easyb

车峻熙
2023-12-01
Behaviour-driven development is a great way to design and build the web layers of your application. In this article, I look at how to use JWebUnit, a fast and light-weight web testing framework, with Easyb, a powerful Groovy-based BDD framework.

JWebUnit is a web testing framework built on HTMLUnit. It runs in memory, so it's fast. However, it also has an intuitive, high-level API, making it easy to use even if you have only an approximate idea of the exact HTML details of your application screens. A simple JWebUnit test case is shown here:

import net.sourceforge.jwebunit.junit.WebTestCase;
import net.sourceforge.jwebunit.junit.WebTester;

public class TestJWebUnitDepositStoryUI extends WebTestCase {

public void setUp() {
setBaseUrl("http://localhost:9090/ebank-web");
}

public void testDepositingCashShouldAddToBalance() {
beginAt("/");
assertTextPresent("Current Balance: $0");
setTextField("depositAmount","100");
clickButtonWithText("deposit");
assertTextPresent("Current Balance: $100");
}
}


详细链接如下:http://www.wakaleo.com/component/content/article/183
 类似资料:

相关阅读

相关文章

相关问答