Fitnesse启动参数与配置

Fitnesse最新版20140630默认启动后,网页风格与 fitnesse.org 的Bootstrap风格完全不一致。 
需要配置plugins.properties中的Theme=bootstrap,才能启动Bootstrap风格的Fitnesse。

启动Bootstrap风格的Fitnesse

从 fitnesse.org 下载最新版20140630的fitnesse-standalone.jar后, 
启动fitnesse:

1
D:\fitnesse\fitnesse-20140630>java -jar fitnesse-standalone.jar -p 40630

在浏览器中输入url: http://localhost:40630 
看到的Fitnesse网站是这样的:

fitnesse网站默认风格

但 fitnesse.org 明明是这样的:

fitnesse网站Bootstrap风格

这个问题困扰了我两个星期,无意中看到fitnesse启动时参数表: 
fitnesse启动参数

启动参数可以在plugins.properties中定义,

打开Fitnesse源代码网站的 https://github.com/unclebob/fitnesse/blob/master/plugins.properties

看到如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
##
# Theme
#
# Themes can be used to customize the look and feel of the wiki.
# Build in theme include fitnesse_straight (the default), fitnesse_mint,
# fitnesse_topnav and bootstrap (based on the Twitter bootstrap front-end
# framework).
#
#Theme=fitnesse_straight
Theme=bootstrap
 
##

plugins.properties中已经把网页风格设置为Bootstrap,

把plugins.properties下载到fitnesse运行目录下:

copy启动配置文件

重新启动fitnesse后,看到如下网站:

bootstrap风格的fitneese

大功告成!

命令行方式启动测试用例的测试

首先看一下浏览器中启动测试的url:

test url

url:

1
http://localhost:11026/BaiduMapApiSuite.GetIpLocation?test

Fitnesse还支持xml格式的测试结果输出,只要输入url:

1
http://localhost:11026/BaiduMapApiSuite.GetIpLocation?test&format=xml

test-xml-format

注意其中的:

  • /finalCounts/right 是通过的测试用例个数
  • /finalCounts/wrong 是失败的测试用例个数
  • /finalCounts/ignores 是未执行的测试用例个数
  • /finalCounts/exceptons 是引起异常的测试用例个数,就是Fitneese报java异常的供述

判断Suite测试失败的判断标志是: /finalCounts/wrong + /finalCounts/exceptons > 0 
通过在命令行中用curl或wget调用此url,就能在持续集成工具Hudson/Jenkins中定期或每次安装后启动回归测试

再看命令行方式启动测试测试:

先看一下fitnesse的启动命令行参数:

1
2
3
4
5
6
7
8
9
10
11
D:\fitnesse\fitnesse-20111026>java -jar fitnesse.jar -h
Usage: java -jar fitnesse.jar [-pdrleoa]
        -p <port number> {80}
        -d <working directory> {.}
        -r <page root directory> {FitNesseRoot}
        -l <log directory> {no logging}
        -e <days> {14} Number of days before page versions expire
        -o omit updates
        -a {user:pwd | user-file-name} enable authentication.
        -i Install only, then quit.
        -c <command> execute single command.

其中的 -c 可以执行单个测试用例或测试套件

1
D:\fitnesse\fitnesse-20111026>java -jar fitnesse.jar -p 9001 -c "BaiduMapApiSuite.GetIpLocation?test&format=xml" > test-result.txt

打开 text-result.txt:

command-test-result

posted @ 2014-08-06 20:32  超爱fitnesse  阅读(801)  评论(0编辑  收藏  举报