`
MyEyeOfJava
  • 浏览: 1126417 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7af2d6ca-4fe1-3e9a-be85-3f65f7120bd0
测试开发
浏览量:70239
533896eb-dd7b-3cde-b4d3-cc1ce02c1c14
晨记
浏览量:0
社区版块
存档分类
最新评论

[FitNesse|cucumber]FitNesse与cucumber行为驱动测试开发的典范

阅读更多
I was recently tasked with piloting a couple of design tools designed to help us with our development.
The first one was FitNesse, and the second Cucumber with Groovy.

The problem with “cutting edge” pieces of software tooling is that the tutorials are often up to the mercy of those who pioneered it. This is not always a good thing. In fact unless they are communicative experts its a bad thing; its a bad thing because the guys who come up with this magnificent software aren’t always the same as the guys who are able to write the best tutorials, and explain the simplest concepts (or see the need to).


Quote:

“FitNesse is a software development collaboration tool
Great software requires collaboration and communication. FitNesse is a tool for enhancing collaboration in software development.

FitNesse enables customers, testers, and programmers to learn what their software should do, and to automatically compare that to what it actually does do. It compares customers’ expectations to actual results.

It’s an invaluable way to collaborate on complicated problems (and get them right) early in development”

Well righto! thats right and its also correct, so what is it?

Well its this diagram and this is the truth:


So what is it? (Those who remember Cat in Red Dwarf a cult tv comedy classic )

In one sentence:

Its a wiki, that enables a BA to put in expected outputs given inputs, which plugs into an easily codable Java adaptor designed to plug the values into your system. (ah why didn’t you say so)

What do you need?

Developers willing to code adaptor classes that populate your business objects/services using setters and getters.
BA’s willing to use the wiki, and learn its own little language syntax.

Setup

Overall it was quite straightforwards to setup, I found the options were not amazingly intuitive but after a while I got the hang of it, and its nice to see the green filling in the boxes to show your adaptor (fixture) class is discovered and tests passed.


What is Cucumber and Groovy?

Well seems a little simpler from the outset but it has no wiki. The idea is:

1: Describe behaviour in plain text
2: Write a step definition in Ruby
3: Run and watch it fail
4. Write code to make the step pass
5. Run again and see the step pass
6. Repeat 2-5 until green like a cuke
7. Repeat 1-6 until the money runs out

Ah looks good except for the Ruby bit because I have Groovy, and that took long enough to get working. Good news comes in the form of cuke4duke which gets Cucumber to work with Groovy.
Fortunately the guy who did it had some examples underneath the tutorial (Aslak Hellesoy) and I was eventually able to piece together some command line prompt uses from elsewhere on the net.

So what is Cucumber and Groovy in my words?

Cucumber involves a form of structured english language in the form of a scenario or set of scenarios.

eg:

Feature: BMI Calculator Feature
In order to ensure that my BMI calculator
As a Moderately Overweight Developer
I want to run a cucumber test find out if it works or sucks

Scenario: Robert thorough
Given I have entered Robert as a name
And I have entered 5 in feet
And I have entered 9 in inches
And I have entered 190 in pounds
When I call calculateBMIService
Then the stored result should be 28.1
And the stones should be 13 Stones

Groovy then receives these instructions and using regex sneakily uses the JVM (without compilation need) to test the assertions.

eg.

Before() {
input = new com.rob.calculators.BMICalculatorInput();
output = new com.rob.calculators.BMICalculatorOutput();
bmiCalculator = new com.rob.calculators.BMICalculator();
}

Given(~"I have entered (.*) as a name") { String name ->
input.setName(name)
}

Setup

I found it a little trickier and slightly frustrating to setup in terms of command line stuff, but I eventually got there, configuration is the bane of me so this is where I am most likely to get frustrated and give up, but after I got there it seemed to behave itself!

and thats it.

What do I prefer? hmm JUnit, maybe thats because I am willing to sit with a BA/Tester/Person and write the unit tests so theres a bit of affinity bias there

I actually like them both, but I would say that Cucumber may edge it, for the domain language used will help slightly more in delivering business value, but I would expect both of these to evolve over the coming months and couple of years to something where both are better than either of them now. The only thing that put me off about the domain language of FitNesse was the use of “Fixtures”, quite obvious when you know but not when you don’t, remember its about selling this to those who are new to the product. If they had said the slightly more wordy “Custom Static Adaptor” then as a Java guy I’d know about it, and as it in my case is written in Java then thats the right domain terminology. They could have written “Custom Glue Code”, and I’d have had a better idea too, the name itself made me think that its another domain specific language with nuances I need to learn.


These are great great tools, made by extremely intelligent people (far more than myself) but often they dont have the time to sell it / package it / sugar coat it into something that will be found easy by all those invovled in using it, and by that I am talking business and BA’s.

Its one thing creating an expert tool/concept/idea, but if you can explain with examples in a really simple manner then it makes the job easier for people who come across the tool (who may not have fantastic communication/selling skills) who want to adopt agile and are also trying to sell to their bosses so they can get top down buy in.

In balance now I know them a little more I’d be comfortable with using them both, in fact I would try them both rather than reccomend one of them, each project team has a slightly different domain, and remember we are into writing really good software, whatever tool works best we use. If the company is “wiki-mad” and the requirements are less wordy and more calculative and the Java developers very enthusiastic then there is no reason FitNesse wont work well. If you already use Groovy it may be a mistake to go towards FitNesse, but still try both and see! Experiment!

转载别人的文章注明了出处:http://blog.agile78.co.uk/?p=171
分享到:
评论

相关推荐

    Fitnesse开发协作工具

    FitNesse是一套软件开发协作工具 FitNesse是帮助大家加强软件开发过程中的协作的工具。能够让客户、测试人员和开发人员了解软件要做成什么样,帮助建议软件最终是否达到了设计初衷。

    fitnesse 入门

    它将需求过程、测试过程、开发过程贯穿了起来。它可以取代一般的需求文档并结合了测试的能力。 首先下载fitnesse20070619.zip文件(当前最新的就是20070619版),在本地解压缩后(我这里是D:\fitnesse),直接双击run....

    开源测试软件-fitnesse

    开源测试软件-fitnesse,使用方法自己百度,教程很多

    fitnesse学习(整理版)

    从Fitnesse中学习Java单元测试 1。使用命令行来添加用户和用户密码: D:\fitnesse>java -cp fitnesse.jar fitnesse.authentication.Password -f password.txt -c fitnesse.authentication.HashingCipher Sophia ...

    fitnesse-jdbc-slim:精简格式的FitNesse JDBC固定装置。 允许在多个数据库连接上运行SQL命令

    < dependency> < groupId>com.github.andreptb</ groupId> < artifactId>fitnesse-jdbc-slim</ artifactId> < version>0.0.2</ version></ dependency>样本: |import||com.github.andreptb.fitnesse||library||...

    FitNesse 常用Fixture总结

    这是本个学习FitNesse后,,,总结出来的常用的FitNesse的Fixture的用法,,可供参考...

    fitnesse学习资料

    fitnesse学习资料:关于fitnesse测试软件的一些整理文档

    Fitnesse-Demos:使用简单的Java类演示Fitnesse测试框架

    Fitnesse-Demos 适应性测试框架演示在这个项目中,我编写了一些具有某些基本功能(例如Math Utilities)的简单Java类。 为了演示Fitnessfit的功能,我编写了一些“ fixture代码”(例如称为“ MathFixture.java”的...

    FitNesse帮助文档

    FitNesse帮助文档

    基于FitNesse的自动化回归测试工具的设计与实现

    基于FitNesse的自动化回归测试工具的设计与实现

    lr+Fitnesse做接口测试.doc

    其实无论用那种测试方法,接口测试的原理是通过测试程序模拟客户端向服务器发送请求报文,服务器接收请求报文后对相应的报文做出处理然后再把应答报文发送给客户端,客户端接收应答报文这一个过程。

    初识验收测试管理工具FitNesse

    FitNesse初识初识验收测试管理工具FitNesse软件测试刚刚开始研究FitNesse,我在这儿先抛块砖,大家有什么玉石啊,猫眼儿 初识验收测试管理工具FitNesse 软件测试 刚刚开始研究FitNesse,我在这儿先抛块砖,大家有...

    fitnesse_standalone.jar

    FitNesse是一个轻量级的、开源的框架,能够帮助开发团队方便的定义验收测试(Acceptance Tests),通过在web页面上简单的输出和预计输出的表格就可实现,并且可以运行这些测试以确定是否通过。

    fitnesse-standalone.jar

    在cmd中Java -jar 输入fitnesse-standalone.jar运行fitnesse工具类,在浏览器中输入http://localhost进入fitnesse界面

    fitnesse-standalone

    fitnesse-standalone.jar

    fitnesse:FitNesse-验收测试Wiki

    欢迎使用FitNesse,它是完全集成的独立验收测试框架和Wiki。 要开始使用,请访问 !快速开始和错误追踪器有错误或功能要求吗? 。社区有不是功能要求或错误报告的问题吗? 边缘构建可在FitNesse的最新稳定版本。 ...

    fitnesse帮助文档

    fitnesse帮助文档,对初学者很有用

    fitnesse, 修补验收测试 Wiki.zip

    fitnesse, 修补验收测试 Wiki FitNesse 欢迎使用 FitNesse,完全集成的独立验收测试框架和 wiki 。要开始,请查看 http://fitnesse.org 。快速启动对FitNesse的一分钟描述。下载FitNesse插件和插件插件

    ATDD用FitNesse验收测试让QA荣登开发三剑客-2013.04.20

    ATDD用FitNesse验收测试让QA荣登开发三剑客-2013.04.20

    API自动化测试工具Fitnesse的C#使用实例

    自己钻研总结的,愿意与大家分享交流,也欢迎加QQ群:144691524交流Fitnesse的相关知识。

Global site tag (gtag.js) - Google Analytics