Not logged in. Login

Requirements Elaboration: TDD Examples

TDD stands for test-driven development.

The key idea is that tests are written very early in the development process, even before implementation.

A particular form of TDD considers the development of tests as part of requirements elaboration. These tests are sometimes called Examples.

  • Tests during requirements elaboration (Examples) are written natural language descriptions of how the system operates in order to implement a user story.
  • Examples refer to specific aspects of user interfaces and how user stories are reflected in changes visible through the user interface.
  • These examples can be communicated to customers and stakeholders as part of the requirements elaboration process.

Example for icgrep

  • User story: As a user interested in Chinese language search, I want to use Chinese radicals (e.g. 虫, insect radical)as wildcards so that I can find Chinese characters with that radical.
  • Example: When a user searches for matches to the two radical sequence 虫虫, lines containing two consecutive Chinese characters matching the radicals will (e.g. 蜻蜓)be printed.

Executable Tests

  • Examples can also be considered to be human-executable tests.
  • Customers can "execute" the example to see if an actual system behaves as required.
  • Thus examples serve as an important basis for acceptance testing.

Test Case Development

  • Examples can also serve as the basis for writing machine-executable tests.
  • Test cases generated this way are particularly useful for ensuring that user requirements are required.
  • The icgrep TDD example above is encoded in greptest.xml.
<datafile id="Chinese">别看那些的曲线很像你走的蜿蜒的小路,
最后还要特别强调的是,
'''它们都不表示物体走过的路径。'''
当信息是属于网络蜘蛛(spider)
或者网络机器人(bot)所产生的页面浏览
并且必须举例说明它的传播或者解决技术问题.
中国的毒蛇可分为两类:
蝰蛇科和眼睛蛇科
</datafile>
<grepcase regexp="虫虫" datafile="Chinese" greplines="1 4 8"/>

Full-test driven development

  • Red-Green Method
    • Unit tests are written first, before software is implemented.
    • Executing the unit test should fail: RED result.
    • Programming should only take place to resolve RED test failures.
    • Programming is complete when the failing tests now pass: GREEN result.

Benefits:

  • Developed tests are useful throughout software development to make sure that software keeps functioning.
  • This is regression testing.
  • Test coverage is complete.
    • No code is written, unless it is in response to a test.

Further Reading

Jennitta Andrea, "Test Driven Development: Driving New Standards of Beauty," Chapter 14 of Beautiful Testing edited by Tim Riley and Adam Goucher.

Updated Sun Sept. 10 2023, 10:42 by cameron.