Fitnesse 入门二: 第一个fitnesse项目

Step 1: Edit the FrontPage in FitNesse

Remove the default content from the FrontPage and prepare it for global settings. Click on the Edit button of the FrontPage and remove the existing content. Add the contents as shown in the below screenshot. It has the test Case page which we are going to test on FitNesse server, Set Up page which is used to import the Java class fixtures, Tear down page to act after the test is executed successfully and the most important one is the setting up of the Java Class path and definition of the various FitNesse variables. Once these four pages are defined, click on the save button to generate these FitNesse pages.

Step 2: Creating and defining the page properties for 4 FitNesse Pages

This step involves creating and saving above 4 FitNesse pages and defining their properties. “Test Cases” page has page type as Test while the remaining 3 FitNesse test pages have page type as Static.

Step 3: Adding content to root page in FitNesse

Root page is the very important page in FitNesse as all the system variable definitions are defined here along with the classpath for Java fixtures. For the current example to test the mathematics operations, we need to define the Java classpath where fixtures are located. Also we need to define basic FitNesse variables such as TEST_SYSTEM as slim (Testing engine used), COLLAPSE_SETUP as true and COLLAPSE_TEARDOWN as true. Below screenshot demonstrates how to define a variable and classpath in FitNesse as script.

Step 4: Adding content to Setup page in FitNesse

Click on the Edit button and add the script as shown in the below screenshot. This script imports the package where Java class fixtures are found. In the current example we are going to develop and compile Java classes into package name as test.

Step 5: Adding content to Teardown page in FitNesse

FitNesse test scripts present on the Teardown page are executed after any FitNesse test or entire suite is executed successfully. For example, if you need to clear the database after current test is completed in order to execute the next test. It is best to call that fixture directly by writing a script on this page. Below screenshot demonstrates how a TearDown FitNesse page looks like.

Step6: 写一个Java程序计算1+5=6

Step7: 写testcase

root 一般放置全局变量使用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值