Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TDD with Curl (part 1)
10-24-2011, 08:23 PM, (This post was last modified: 10-24-2011, 08:36 PM by RobertShiplett.)
TDD with Curl (part 1)
The Curl External_Library project has a link at for an automated GUI testing framework. A demo can be run by loading

The challenge to doing Test-Driven Development in the classic Curl IDE is that TDD in Kent Beck's view is based on refactoring. Kent began in Smalltalk which was the programming IDE that gave us the first refactoring class browser and then SUnit, the first graphical unit testing framework (my first contract in Smalltalk was to work on a testing scenario and script
manager on an IBM banking project back in 1991 when we had neither.)

XUnit is now a standard module for many programming environments across languages, but Class Browsers intended for refactoring continue to evolve in Smalltalk (see and for examples.)

The first step in TDD is to write a test that fails. That presupposes an XUnit testing framework. The second step is iterative small-step refactoring to run a test Green, add a functional increment, run test RED, add something redundant, run test Green, refactor to incrementally remove redundancy. Many small steps. Many test runs. Tolerate what is needed to get a test to run. When all functionality is present, all redundancy is refactored, all tests are Green: we are done (as far as our unit-testing this piece of a project is concerned - other testing layers supervene, issues arise, requirements change, user acceptance may vary, whatever -we reiterate.)

But how to write that first failing test in Curl using CurlUnit?

In Eclipse Helios with the 7.0.5 Curl CDE, here is my test-runner:

{curl 7.0 applet}
{curl-file-attributes character-encoding = "windows-latin-1"}
{applet manifest = "manifest.mcurl", {compiler-directives careful? = true}}

{import * from COM.CURL.CDU.CURL-UNIT}
{import * from COM.CURL.CDU.CURL-UNIT-UI}
{install-style-sheet null, look-and-feel = the-standard-look-and-feel}

|| insert first GeoFrame code here ?

{include "test-cases/test-geoframe.scurl"} || test-suite

{let public test-UI:Graphic = {test-ui test-suite, target = TestTarget.current}}
{set test-UI.width = 20cm}
{set test-UI.height = 16cm}

{{Dialog test-UI}.show-at-xy title = {host-localize "TestGeoFrame"}, 1mm, 1mm}

||--ALT-SH-X then c to run-as Curl Applet
||--notes CTRL-/ for COMMENT toggle
||--this is CDE 7.005 under Helios release 2, i.e., not Indigo
||--select item then CTRL-SH-F3 to see type of selected item; SH-F2 for Curl Documentation Viewer

At the far end of the test spectrum is CurlUnit's AppletTestCase to test an applet load, but we have not yet written that first failing test for GeoFrame. We might be getting ahead of ourselves to start with a TestClassSuite for our new class.

What is required is a kind of GeoFrame such as we see at the end of the article on Dawson Creek as the last item of its External Links section. Those last links are embedded in a widget. The widget is built usng wiki markup which you can see by clicking 'edit' for that section. I have posted that markup and an image of the widget at eclectic-
pencil. Our task is to use TDD to develop the same kind of open-source widget for a Curl web page.

When such a GeoFrame finally instantiates with component links, we can test with COM.CURL.EXT.AUTO-TEST from the new open-source Curl External Library using its GuiGesture by processing log records.

The Curl Eclipse plugin catches so many errors that we have to be attentive to how we can write Red, i.e., failing tests before coding to run Green tests.

A good idea of how to proceed can be found in the source code ./tests folders of the
External Library project. For example, t-worksheet.curl has

let suite:TestSuite =

{TestSuite "main"

{TestSuite.import {url "worksheet-tests.scurl"}}
and the file worksheet-tests.scurl has many examples of TestCondition and TestCase from COM.CURL.CDU.CURLUNIT.

We could begin with a test-suite with the simplest use of the macro {test-case } for a SimpleTestCase:

{test-case "empty",


But it would not fail.

[to be continued in Part 2]
Robert Shiplett, Curlr
Fredericton NB


Possibly Related Threads...
Thread Author Replies Views Last Post
Brick Curl macros introduction (part 1) RobertShiplett 4 6,993 04-25-2015, 05:28 PM
Last Post: glennmcgrath
  server-side Curl issue : TocDocument RobertShiplett 3 5,691 02-09-2015, 02:11 PM
Last Post: Sumeraxe
  Curl with HTML widget + CintaNotes RobertShiplett 0 4,444 09-08-2014, 07:42 AM
Last Post: RobertShiplett
  Curl for the new Kodansh kanji books RobertShiplett 0 3,032 09-07-2014, 08:51 PM
Last Post: RobertShiplett
  Curl on Facebook - another page RobertShiplett 0 3,737 02-01-2014, 02:29 AM
Last Post: RobertShiplett
  Curl for CoffeeScript folks RobertShiplett 0 4,758 06-29-2013, 02:52 AM
Last Post: RobertShiplett
  Curl JavaScript bytecodes RobertShiplett 0 4,939 06-19-2013, 10:33 PM
Last Post: RobertShiplett
  jinja2 templates for Curl RobertShiplett 0 4,147 06-14-2013, 08:33 AM
Last Post: RobertShiplett
  Curl and QNX RobertShiplett 0 4,932 04-24-2013, 11:38 PM
Last Post: RobertShiplett
  WikizPad Curl personal wiki RobertShiplett 0 4,115 03-11-2013, 01:09 AM
Last Post: RobertShiplett
Forum Jump:

Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
INSERT INTO mybb_threadviews (tid) VALUES('322')