Extends the scripttable of fitnesse: If-then is supported.

Source: Internet
Author: User

The scripttable of fitnesse can only execute all rows in sequence. This blog post describes how to enable scripttable to support if-then to execute one row in conditions.

First, let's popularize the concept. What isFitnesseLet's hear about the. Net version of Cucumber's founder asak helles ø y.FitnesseComparison with cucumber:

Fit/FitnesseAnd cucumber both perform acceptance tests written in advanced languages. Fit only recognizes HTML, while fitnesse simplifies the process of writing tests by providing wiki syntax. In fit/fitnesse, all tests are presented as tables.
Fitnesse has the advantage of Wiki support over cucumber.

After fitnesse is extended, the Wiki text of if-then is used in scripttable:
! Path classes! Path lib/*. Jar! Define test_system {slim }! | Import | fitnesse. fixtures | library | echo fixture | script | check | echo | 1 | 0 <_ <2 | ensure | echo | true | reject | echo | false | $ true = | echo | true | $ false = | echo | false | show | echo | $ true | show | echo | $ false | ''' $ t? ''' Indicates that if the value of the variable $ t is true, the row is executed. Otherwise, ''' $ f !? ''' Indicates that if the value of the variable $ F is false, the row is executed. Otherwise, note: $ T must be assigned a value in the first scripttable, can $ t be used in the second scripttable? And $ T !? | Script | show | echo | 112233 | $ true? | $ T1 = | echo | true | check | echo | $ T1 | true | $ true !? | $ T2 = | echo | false | check not | echo | $ T2 | false | $ false !? | $ F1 = | echo | false | check | echo | $ F1 | false | $ false? | $ F2 = | echo | true | check not | echo | $ F2 | true |

Note:
| $true? | $t1= | echo | true |Explanation: if ($ true) then $ T1 = true
| $true!? | $t2= | echo | false |Explanation: If (! $ True) then $ T1 = false

Note:
However, $ t can only be used in the next scripttable after $ t is assigned to the first scripttable? And $ T !?,
In another way: in the same scripttable, after $ t is assigned a value, $ t? New values cannot be obtained in time.

Test results:

Modify one fitnesse source file:

Fitnesse/src/fitnesse/testsystems/slim/Tables/scripttable. Java

The specific modification code can be viewed in http://git.oschina.net/fitneesefan/FitnesseKit/commit/99240ecb915e007c11761cf29036c46465b112f2#diff-5.

Let's briefly record it. If an enthusiastic audience wants to know more details, I would like to explain it further.

Extends the scripttable of fitnesse: If-then is supported.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.