-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathScriptingMakeover.html
154 lines (115 loc) · 4.87 KB
/
ScriptingMakeover.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Concordion - Scripting Makeover</title>
<link media="all" rel="stylesheet" type="text/css" href="css/default.css"/>
<link media="print" rel="stylesheet" type="text/css" href="css/print.css"/>
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
</head>
<body>
<div class="page">
<div class="header">
<div id="google_translate_element" class="language-translation"></div>
<div class="logo"><a href="index.html"> <img src="image/front-page-banner.png" alt="Specification by Example" /> </a></div>
</div><!-- header -->
<div class="menuBar">
<ul class="menu">
<li><a href="/">Home</a></li>
<li><a href="Tutorial.html">Tutorial</a></li>
<li><a href="Technique.html">Hints and Tips</a></li>
<li><a href="ExtensionsAPI.html">Extensions API</a></li>
<li><a href="Extensions.html">Extensions</a></li>
<li><a href="Download.html">Download</a></li>
<li><a href="Questions.html">FAQ</a></li>
</ul>
</div><!-- menuBar -->
<div class="content">
<h1>Scripting Makeover</h1>
<div class="memo">
<p class="subtext">
This makeover contrasts a typical Fit/FitNesse test with the Concordion
equivalent specification.
</p>
<h1>Before</h1>
<p>
Fitnesse is a wiki-based system and has acceptance tests covering
its wiki syntax. This example (taken from its website¹)
covers the syntax for bold text:
</p>
<p>
<img src="image/concept/fitnesse/BoldText-FitNesse.png" alt="FitNesse before (scripting)"/>
</p>
<p>
This is a <b>test script</b>. It tells you <b>how to test</b> the
bold text feature.
</p>
<p>
The test also includes several unexplained table cells. For
example, what are "page attributes" and what does "valid?" mean
in this context? These kinds of irrelevant details often occur
in Fit/FitNesse tests because the standard usage pattern is to
create a handful of generic fixtures and copy-and-paste them.
</p>
<br />
<h1>After</h1>
<p>
The equivalent Concordion active specification is written at a more
abstract level. It doesn't care how you test it, it just tells you
what's supposed to happen:
</p>
<p>
<img src="image/concept/fitnesse/BoldText-Concordion.png" alt="Concordion (specifying)"/>
</p>
<p>
This is a <b>specification</b>. It <b>describes the behaviour and gives an example</b>.
</p>
<p>
Behind the scenes, the first <pre> will be instrumented to set a temporary variable:
</p>
<pre class="html">
concordion:set="#wikiText"
</pre>
<p>
The second <pre> element will check the result:
</p>
<pre class="html">
concordion:assertEquals="renderAsHTML(#wikiText)"
</pre>
<p>
And all the scripting necessary to render the wiki text will be
hidden away in the accompanying Java fixture:
</p>
<pre class="java">
import org.concordion.integration.junit3.ConcordionTestCase;
public class BoldTextTest extends ConcordionTestCase {
public String renderAsHTML(String wikiText) {
// TODO
}
}
</pre>
</div>
<p style="border-top: 1px solid black; padding: 4px; margin-top: 30px">
¹ Source: <a href="http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteWidgetTests.TestBoldText">http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteWidgetTests.TestBoldText</a> [23 Oct 2007]</p>
</div> <!-- content -->
</div> <!-- page -->
<div class="copyright">
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
</div> <!-- copyright -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-58172036-1', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, gaTrack: true, gaId: 'UA-58172036-1'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</body>
</html>