天天看點

使用TextTest來做認定測試——本質是通過diff對比程式的運作log輸出,來看測試結果和預期結果是否相同

Welcome to TextTest.org!

TextTest is an open source tool for text-based functional testing. This means running a program in lots of different ways from the command line, and using the text output produced as a means of controlling the behaviour of that application.

Also on this site are StoryText and CaptureMock, which aid in GUI testing and mocking respectively. They do not depend on TextTest in any way but are well suited to being used together with it.

Site index

<a href="http://texttest.sourceforge.net/index.php?page=about">About</a>

Introducing TextTest and Acceptance Testing

<a href="http://texttest.sourceforge.net/index.php?page=documentation_3_27">TextTest</a>

TextTest Tutorials and Reference

<a href="http://texttest.sourceforge.net/index.php?page=ui_testing">StoryText</a>

Formerly "PyUseCase". Domain-language GUI testing for PyGTK, Tkinter, wxPython, Swing and SWT/Eclipse RCP

<a href="http://texttest.sourceforge.net/index.php?page=capturemock">CaptureMock</a>

Capture-replay mocking for Python, command-line programs, and synchronous messaging

<a href="http://texttest.sourceforge.net/index.php?page=publications">Publications</a>

Conference publications, presentations and workshop summaries

<a href="http://texttest.sourceforge.net/index.php?page=download">Download</a>

Download a TextTest release or the latest source

<a href="http://texttest.sourceforge.net/index.php?page=nightjob">Nightjob</a>

Live test results and coverage for the self-tests

About Texttest

Background

We feel that the world still produces way too much software that is frankly substandard. The reasons for this are pretty simple: software producers do not pay enough attention to testing, or rely too heavily on manual testing. Manual testing should be focussed on examining the user experience and finding complex bugs, and too often it is used for simple regression testing : to check that the latest release does not crash on startup.

Verifying Application Behaviour with TextTest

As the name suggests, TextTest works via comparing plain text logged by programs with a previous 'gold standard' version of that text. This is in contrast to most acceptance testing frameworks on offer today, which generally use some form of hand-written 'assertions' by the test writer that call into an application API.

So, when your test fails and you click on it to see what went wrong, you might see this (Click to Enlarge):

使用TextTest來做認定測試——本質是通過diff對比程式的運作log輸出,來看測試結果和預期結果是否相同

On the left you see what we wanted the program to produce. On the right we see what actually happened. This is testing a small 'video store' application, and this test checks that the same movie cannot be added twice. Given what happened, it obviously can right now...

The focus is around testing a particular executable program with a variety of inputs. To start with, a plain text configuration file is created that tells TextTest about your program, how to run it, and how to test it. Tests (and test suites) are then defined entirely using plain text files in a directory structure.

A test is defined partly by the expected files and their contents that should be produced, and partly by the 'input' to provide, which can consist any or all of:

Options to be provided on the command line

A file to be redirected to standard input

Environment variables that should be set

The application needs to write a log file describing what is happening, similar to the one shown above. Any output at all can be compared, so long as it is plain text, or can be converted to it.

本文轉自張昺華-sky部落格園部落格,原文連結:http://www.cnblogs.com/bonelee/p/6508375.html,如需轉載請自行聯系原作者