{"id":1710,"date":"2013-10-15T00:00:00","date_gmt":"2013-10-15T00:00:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/acceptance-testing-with-fitnesse-naming-and-layout\/"},"modified":"2021-05-11T15:56:15","modified_gmt":"2021-05-11T15:56:15","slug":"acceptance-testing-with-fitnesse-naming-and-layout","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/development\/dotnet-development\/acceptance-testing-with-fitnesse-naming-and-layout\/","title":{"rendered":"Acceptance Testing with FitNesse:  Naming and Layout"},"content":{"rendered":"<div id=\"pretty\">\n<h2>Contents<\/h2>\n<ul>\n<li><a href=\"#one\">Naming <\/a>\n<ul>\n<li><a href=\"#two\">Fixture Naming Pattern <\/a><\/li>\n<li><a href=\"#three\">Naming Your API Elements <\/a><\/li>\n<li><a href=\"#four\">Naming Your Test Pages <\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#five\">Layout <\/a>\n<ul>\n<li><a href=\"#six\">Embed Line Breaks in your Test Tables <\/a><\/li>\n<li><a href=\"#seven\">Order Your Columns Correctly <\/a><\/li>\n<li><a href=\"#eight\">Use Block Structure <\/a><\/li>\n<li><a href=\"#nine\">Ensure Your Blocks are Blocks <\/a><\/li>\n<li><a href=\"#ten\">Use Collapsed Blocks for Setup Pages <\/a><\/li>\n<li><a href=\"#eleven\">Keep Your Layout Tight <\/a><\/li>\n<li><a href=\"#twelve\">Deaden Portions of Your Test <\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#thirteen\">More to Come<\/a><\/li>\n<\/ul>\n<p class=\"start\"><b>FitNesse<\/b> is a wiki-based framework for writing <a href=\"http:\/\/en.wikipedia.org\/wiki\/Acceptance_testing\">acceptance tests<\/a> for software systems. If you are not familiar with FitNesse, Part 1 of this series walks through a complete .NET example from writing the test in your browser to writing the C# code-behind. The remaining articles in the series provide &#8220;tips from the trenches&#8221;, i.e. an accumulation of tips collected from intensive use of FitNesse on a daily basis to alleviate or avoid frustrations or quirks of FitNesse.<\/p>\n<table class=\"series-articles table--bare\">\n<tbody>\n<tr>\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p><a href=\"https:\/\/www.simple-talk.com\/dotnet\/.net-tools\/acceptance-testing-with-fitnesse,-the-overview\/?utm_source=simpletalk&amp;utm_medium=weblink&amp;utm_content=fitnesspt3\">Part 1: FitNesse Introduction and Walkthrough<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p><a href=\"https:\/\/www.simple-talk.com\/dotnet\/.net-tools\/acceptance-testing-with-fitnesse-documentation-and-infrastructure\/?utm_source=simpletalk&amp;utm_medium=weblink&amp;utm_content=fitnesspt3\">Part 2: Documentation and Infrastructure<\/a><\/p>\n<\/td>\n<\/tr>\n<tr class=\"series-articles--active\">\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p>Part 3: Naming and Layout<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p><a href=\"https:\/\/www.simple-talk.com\/dotnet\/.net-tools\/acceptance-testing-with-fitnesse-debugging,-control-flow,-and-tracing\/\">Part 4: Debugging, Control Flow, and Tracing<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p><a href=\"https:\/\/www.simple-talk.com\/dotnet\/.net-tools\/acceptance-testing-with-fitnesse-symbols,-variables-and-code-behind-styles\/\">Part 5: Symbols, Variables, and Code-Behind Style<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p><a href=\"https:\/\/www.simple-talk.com\/dotnet\/.net-tools\/acceptance-testing-with-fitnesse-multiplicities-and-comparisons\/\">Part 6: Multiplicities and Comparisons<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\u00a0<\/td>\n<td valign=\"top\">\n<p><a href=\"https:\/\/www.simple-talk.com\/dotnet\/.net-tools\/acceptance-testing-with-fitnesse-database-fixtures,-project-overview\/\">Part 7: Database Fixtures, Project Overview<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"note\">\n<p class=\"note\">Most sections in this article have references with actual hyperlinks to the FitNesse, fitSharp, or DbFit reference material. Some also have references to the sample test suite accompanying this series of articles, e.g. <b>CleanCode.ConceptNotes.LayoutShowingEmbeddedNewlines<\/b>. That path refers to a page on your FitNesse server. Thus if you are running on port 8080 on your local machine, the full URL to visit that page would be:<code><br \/>\nhttp:\/\/localhost:8080\/CleanCode.ConceptNotes.LayoutShowingEmbeddedNewlines<\/code><\/p>\n<\/div>\n<h2 id=\"one\">Naming<\/h2>\n<h3 id=\"two\">Fixture Naming Pattern<\/h3>\n<p>In C# there are a variety of naming patterns you use when defining classes: <code>somethingObserver<\/code>, <code>somethingProvider<\/code><i>, <\/i><code>somethingListener<\/code>, etc.\u00a0 That gives others in your team, or even you for that matter, some notion of the purpose of the class. Similarly, the fixtures you write (to sit between your FitNesse test pages and your system under test) should use the naming pattern <code>somethingFixture<\/code>. Not only does this give the benefit to the reader of knowing what the class is for, but also a benefit to the test writer. When a class uses that naming pattern, you can, and should, refer to it in a test without the <code>Fixture<\/code> suffix: Doing so makes the test more quickly understandable\u00a0 to the reader. In the example below, on the right the purpose of this test table is obvious from its name: you intend to delete an incentive invoice. \u00a0On the left, however, it feels incongruous to\u00a0 have the word &#8216;Fixture&#8217; in there, needlessly exposing a piece of the inner machinery for no particularly good reason.<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>Less Clear Format<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>More Clear Format<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    !|DeleteIncentiveInvoiceFixture |<br \/>\n                    |Id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Result?|<br \/>\n                    |25\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|<br \/>\n                    <\/code><\/td>\n<td valign=\"top\"><code><br \/>\n                    !|DeleteIncentiveInvoice|<br \/>\n                    |Id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 Result?|<br \/>\n                    |25\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|<br \/>\n                    <\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"three\">Naming Your API Elements<\/h3>\n<p>This next tip builds on the last technique for naming fixtures, but applies to <i>all<\/i> your API elements, both fixture classes as well as the fields, properties, or parameters within a fixture class that you expose as your API to FitNesse. Common C# coding convention recommends both your class names and your public elements begin with a capital letter. Beyond the first word, when you have multiple words in a\u00a0 name there are different conventions that Visual Studio (or Resharper\u00a0 for that matter) cannot enforce because it does not know where the word boundaries are. Some people like to <code>Use_Underscores_Between_Words<\/code> while others prefer <code>RunTogetherWords<\/code> and still others might use a combination of those. For your FitNesse Fixture classes you should use RunTogetherWords (more formally known as <i>Pascal-casing<\/i>) because, through the magic of FitNesse, you can use either the computer-oriented format (left) or the human-oriented format that allows whitespace between words (right) shown below. The choice is left to the reader!<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>Computer-oriented Format<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Human-oriented Format<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    !|DeleteIncentiveInvoice\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n                    |InvoiceNumber|ClientName\u00a0\u00a0 |Result?|<br \/>\n                    |101\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|Apex Holdings|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n                    <\/code><\/td>\n<td valign=\"top\"><code><br \/>\n                    !|Delete Incentive Invoice\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0|<br \/>\n                    |Invoice Number|Client Name\u00a0 |Result?|<br \/>\n                    |101\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|Apex Holdings|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n                    <\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"four\">Naming Your Test Pages<\/h3>\n<p>When you create a FitNesse test page in your browser, the name of the test (or test page-they are the same) must be a valid <a href=\"http:\/\/en.wikipedia.org\/wiki\/Wikiword\">WikiWord<\/a> and must therefore:<\/p>\n<ul>\n<li>Use Pascal casing, i.e. initial capital for each word<\/li>\n<li>Use only letters or numbers<\/li>\n<li>Have at least two capital letters in the word<\/li>\n<li>Have no spaces between words<\/li>\n<\/ul>\n<p>Thus the perfectly reasonable seeming names on the left are not allowed and must be coerced into a form like that shown on the right to pass muster. On the bright side, FitNesse gives you immediate feedback as you type the name as to whether your name is a valid or not.<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>Illegitimate Names<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Legitimate Names<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p>HTMLTest<\/p>\n<p>myTestPage<\/p>\n<p>e-LearningTest<\/p>\n<p>Test2<\/p>\n<\/td>\n<td valign=\"top\">\n<p>HtmlTest<\/p>\n<p>MyTestPage<\/p>\n<p>ElearningTest<\/p>\n<p>TestPage2<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Rule 4 above might seem strange, given that FitNesse permits-nay, even enthusiastically encourages-whitespace in API element names, as shown in the previous tip. Well it is still doing that though it is not immediately obvious. When you are on a given test page, the test name is shown without whitespace. But if you traverse up to the parent of the test page, there it is shown with the words automatically separated out with white space.<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>On Each Test Page<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>On Parent Page<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    HtmlTest<br \/>\n                    - - -<br \/>\n                    MyTestPage<br \/>\n                    - - -<br \/>\n                    ElearningTest<br \/>\n                    - - -<br \/>\n                    TestPage2<br \/>\n                    <\/code><\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<ul>\n<li>Html Test<\/li>\n<li>My Test Page<\/li>\n<li>Elearning Test<\/li>\n<li>Test Page2<\/li>\n<\/ul>\n<p><code><br \/>\n                    <\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"five\">Layout<\/h2>\n<h3 id=\"six\">Embed Line Breaks in your Test Tables<\/h3>\n<p>All the test tables I have been using are deliberately narrow, perhaps just two or three columns and anything in their cells is relatively short. In actual practice, particularly if you start using database queries in a test, the contents of a single cell can get quite wide.<\/p>\n<p>A test table, as you now know, consists of vertical bars delimiting cells. The contents of a single cell must be all on one line because FitNesse will otherwise stop looking for those vertical bars, get rather confused, and just decide it is not a test table after all.<\/p>\n<p>Imagine that you have a database query that is typed on a single line that scrolls off the right edge of your browser, simulated here with this box being a proxy for your browser-if you could scroll horizontally you would see the query go on and on, both in the source and in the output:<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><b>!|query|SELECT ProductId, CurrentPrice, LastPrice, PriceIncreaseDate, TransactionC<\/b><\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>query<\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>SELECT ProductId, CurrentPrice, LastPrice, PriceIncreaseDate, TransactionCode FROM d<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>But FitNesse provides a handy mechanism to create a literal zone. Put anything between these brackets !- anything -! and the contents are preserved exactly as is including, in particular, line breaks:<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    <b>!|query|SELECT !-ProductId, CurrentPrice, LastPrice, PriceIncreaseDate, TranCode<\/b><br \/>\n                    <b>FROM dbo.Incentives<\/b><br \/>\n                    <b>WHERE CurrentPrice &lt; LastPrice and CustId != 999-!|<\/b><br \/>\n                    <\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td>\n<p>query<\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                                    SELECT ProductId, CurrentPrice, LastPrice, PriceIncreaseDate, TranCode<br \/>\n                                    FROM dbo.Incentives<br \/>\n                                    WHERE CurrentPrice &lt; LastPrice and CustId != 999<br \/>\n                                    <\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>References: CleanCode.ConceptNotes.LayoutShowingEmbeddedNewlines<\/p>\n<h3 id=\"seven\">Order Your Columns Correctly<\/h3>\n<p>Inputs must appear before outputs! FitNesse processes columns sequentially from left to right. Thus calling the <code>Result<\/code> method before defining the <code>Value<\/code> property in the <code>Echo<\/code> fixture would result in unexpected output. In this example I am showing C# pseudocode rather than FitNesse test source code to make the issue obvious:<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>Outputs before Inputs (incorrect)<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Inputs before Outputs (correct)<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>function Result { return Value; }<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>Result();<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>Value = &#8220;one&#8221;;<\/p>\n<p><code><br \/>\n                    <\/code><\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>function Result { return Value; }<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>Value = &#8220;one&#8221;;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>Result();<\/p>\n<p><code><br \/>\n                    <\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\">\n<p><i>Echo<\/i><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>Result?<\/p>\n<\/td>\n<td valign=\"top\">\n<p>Value<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><code><br \/>\n                                    one <span class=\"fitlabel\"><i>expected<\/i><i><\/i><\/span><br \/>\n                                    <span class=\"fitlabel\">---------------<\/span><br \/>\n                                    null <span class=\"fitlabel\"><i>actual<\/i><i><\/i><\/span><br \/>\n                                    <\/code><\/td>\n<td valign=\"top\">\n<p>one<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\">\n<p><i>Echo<\/i><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>Value<\/p>\n<\/td>\n<td valign=\"top\">\n<p>Result?<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>one<\/p>\n<p><code><br \/>\n                                    <\/code><\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>one<\/p>\n<p><code><br \/>\n                                    <\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>References: CleanCode.ConceptNotes.OrderOfParametersMatters<\/p>\n<h3 id=\"eight\">Use Block Structure<\/h3>\n<p>Approach writing a test just as you would \u00a0writing code, i.e. do not have just one big blob of test tables. Unlike a unit test, where each test typically tests just one thing, an acceptance test in FitNesse may encompass a complex user story where, for instance, you may need to prepare bank data and customer data, validate preconditions before running a transaction, run the transaction and validate data from different database tables.<\/p>\n<p>FitNesse provides these key syntactic elements to aid you:<\/p>\n<div>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p><b>Element<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Token<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p><b>Begin expanded block<\/b><\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>!*<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p><b>Begin collapsed block<\/b><\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>!*&gt;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p><b>Begin hidden block<\/b><\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>!*&lt;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p><b>Close any of these blocks<\/b><\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>*!<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p><b>Add horizontal rule<\/b><\/p>\n<\/td>\n<td valign=\"top\"><code><code><\/code><\/code><\/p>\n<p>&#8212;-<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>This example shows how to use the three types of block elements:<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    <b>'''Invisible block''' here to sanity check some preconditions:<\/b><br \/>\n                    <b>!*&lt; Sanity Check<\/b><br \/>\n                    <b>Sanity Check here...<\/b><br \/>\n                    <b>*!<\/b><br \/>\n                    <b>'''Collapsed block''' here to set up data for the upcoming transaction test<\/b><br \/>\n                    <b>!*&gt; Insert Data<\/b><br \/>\n                    <b>Insert data here...<\/b><br \/>\n                    <b>*!<\/b><br \/>\n                    <b>'''Expanded block''' here for the stuff you really care about in this test.<\/b><br \/>\n                    <b>!* Do Transaction<\/b><br \/>\n                    <b>Do Transaction here...<\/b><br \/>\n                    <b>*!<\/b><br \/>\n                    <\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Invisible block<\/b> here to sanity check some preconditions: <\/p>\n<p><b>Collapsed block<\/b> here to set up data for the upcoming transaction test.<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba<i>Insert Data<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><b>Expanded block<\/b> here for the stuff you really care about in this test.<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p><i>Do Transaction<\/i><\/p>\n<p>Do Transaction here&#8230;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The references below include two pages in my sample project illustrating good block style.<\/p>\n<p>References: Line and Block Formatting, <br \/>\nCleanCode.ConceptNotes.LayoutShowingDifferentBlocks, CleanCode.DataBaseNotes.CrudOperations<\/p>\n<h3 id=\"nine\">Ensure Your Blocks are Blocks<\/h3>\n<p>A block must have a title in order to be recognized as a block.<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>Title Missing (incorrect)<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Title Present (correct)<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    !*&gt;<br \/>\n                    stuff here...<br \/>\n                    *!<br \/>\n                    <\/code><\/td>\n<td valign=\"top\"><code><br \/>\n                    !*&gt; test block<br \/>\n                    stuff here...<br \/>\n                    *!<br \/>\n                    <\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    !*&gt;<br \/>\n                    stuff here...<br \/>\n                    *!<br \/>\n                    <\/code><\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba<i>test block<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"ten\">Use Collapsed Blocks for Setup Pages<\/h3>\n<p>Generally you should collapse all your setup and teardown blocks. You can globally control whether they are expanded or collapsed with these two constants, typically defined on the root page. This affects <code>SetUp<\/code>, <code>TearDown<\/code>, <code>SuiteSetUp<\/code>, and <code>SuiteTearDown<\/code> pages.<\/p>\n<p><code>!define COLLAPSE_SETUP {true}<\/code><\/p>\n<p><code>!define COLLAPSE_TEARDOWN {true}<\/code><\/p>\n<p>The latest version defaults to <b>true<\/b> for these, so you really only need to add these to your root page if you want to turn them off.<\/p>\n<p>Reference: <a href=\"http:\/\/fitnesse.org\/FitNesse.UserGuide.QuickReferenceGuide#GlobalVARIABLES\">Global Variables<\/a><\/p>\n<h3 id=\"eleven\">Keep Your Layout Tight<\/h3>\n<p>Compact your test vertically by eliminating blank lines between blocks. This is particularly helpful in compactly displaying a sequence of several closed blocks as shown.<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td valign=\"top\">\n<p><b>Loose Vertical Space<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Tight Vertical Space<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    !*&gt; Variables<br \/>\n                    . . .<br \/>\n                    *!<\/p>\n<p>                    !*&gt; Namespaces<br \/>\n                    . . .<br \/>\n                    *!<\/p>\n<p>                    !*&gt; Connecting to the database<br \/>\n                    . . .<br \/>\n                    *!<\/p>\n<p>                    !*&gt; Check for debugging enabled<br \/>\n                    . . .<br \/>\n                    *!<br \/>\n                    <\/code><\/td>\n<td valign=\"top\"><code><br \/>\n                    !*&gt; Variables<br \/>\n                    . . .<br \/>\n                    *!<br \/>\n                    !*&gt; Namespaces<br \/>\n                    . . .<br \/>\n                    *!<br \/>\n                    !*&gt; Connecting to the database<br \/>\n                    . . .<br \/>\n                    *!<br \/>\n                    !*&gt; Check for debugging enabled<br \/>\n                    . . .<br \/>\n                    *!<br \/>\n                    <\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Variables<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Namespaces<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Connecting to the database<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Check for debugging enabled<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Variables<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Namespaces<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Connecting to the database<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>\u25ba <i>Check for debugging enabled<\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>References: CleanCode.DataBaseNotes.CrudOperations<\/p>\n<h3 id=\"twelve\">Deaden Portions of Your Test Page<\/h3>\n<p>Generally speaking, everything on your test page is <i>active content<\/i>-if FitNesse recognizes it as a valid token or construct it will engage with it, whether this is rendering text between vertical bars as a table and then executing it or embedding hyperlinks on any text in a WikiWord format, and so forth. There are several types of constructs that let you mask things from FitNesse.<\/p>\n<p><i>Comment tables<\/i> allow you to define a test table in the usual way and have it nicely formatted by FitNesse, but the content is not executed when you run the test page. Create a comment table with the <code>Comment<\/code> fixture:<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\"><code><br \/>\n                    <b>!|Comment\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/b><br \/>\n                    <b>|Put anything|you want here\u00a0\u00a0 |<\/b><br \/>\n                    <b>|and it will not be executed\u00a0 |<\/b><br \/>\n                    <\/code><\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<table class=\"MsoTableGrid\">\n<tbody>\n<tr>\n<td colspan=\"2\">\n<p>Comment<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Put anything\u00a0\u00a0<\/p>\n<\/td>\n<td valign=\"top\">\n<p>you want here<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>and it will not be executed\u00a0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><i>Character escaping<\/i> allows you to mark any amount of text to be used &#8220;as is&#8221;: no WikiWord evaluation (if the page exists as a reference it becomes a link; otherwise, it gets a <code>[?]<\/code> notation appended), line breaks (if present) are preserved, and the text itself appears just like its neighboring text.<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b>Enter a !-LineOfText-! with character escaping to prevent<\/b><\/p>\n<p><b>the [?] suffix from appearing. Here is OneWithoutTheEscape for comparison.<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p>Enter a LineOfText with character escaping to prevent<\/p>\n<p>the [?] suffix from appearing. Here is OneWithoutTheEscape[?] for comparison.<i><\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><i>Block escaping<\/i> allows you to mark any amount of text to be formatted as a code sample, i.e. it is rendered in a fixed-width font, line breaks (if present are preserved), and there is always a line break before and after the block:<\/p>\n<table class=\"MsoTableLightGridAccent3\">\n<tbody>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img59.jpg\" alt=\"1884-img59.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><code>Regular text here.<\/code><\/p>\n<p><code>Code: {{{Enter a code sample or other text in braces like this.}}}<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1884-img5A.jpg\" alt=\"1884-img5A.jpg\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><code>Regular text here.<\/code><\/p>\n<p><code>Code:<\/code><\/p>\n<p><code>Enter a code sample or other text in braces like this.<\/code><i><\/i><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Reference: <a href=\"http:\/\/fitnesse.org\/FitNesse.UserGuide.CommentTables\">Comment Fixture<\/a>, <a href=\"http:\/\/fitnesse.org\/FitNesse.UserGuide.QuickReferenceGuide#CharacterFORMATTING\">Character Formatting<\/a>, <a href=\"http:\/\/fitnesse.org\/FitNesse.UserGuide.QuickReferenceGuide#LineBlockFORMATTING\">Line &amp; Block Formatting<\/a><\/p>\n<h2 id=\"thirteen\">More to Come&#8230;<\/h2>\n<p>There are many more aspects to review and issues to alleviate-stay tuned for Part 4!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Having dealt with Documentation and Infrastructure in the popular wiki-based acceptance-testing tool Fitnesse, Michael turns his attention to conventions and best-practices for naming and layout, in his continuing series of articles that represent the &#8216;view from the trenches&#8217;.&hellip;<\/p>\n","protected":false},"author":221868,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143538],"tags":[4143,4204],"coauthors":[6802],"class_list":["post-1710","post","type-post","status-publish","format-standard","hentry","category-dotnet-development","tag-net","tag-net-tools"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/1710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/221868"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=1710"}],"version-history":[{"count":11,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/1710\/revisions"}],"predecessor-version":[{"id":72855,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/1710\/revisions\/72855"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=1710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=1710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=1710"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=1710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}