Fitnesse中的symbols和variables

 

1.symbols 主要在表間傳遞信息,做用於一個page中,相似於局部變量express

SaveRecordInDatabase
name date =key?
Bob today bobKey
Bill later billKey

 在方法名前加=表示要把結果存儲在symbol中,而不是跟方法的返回結果做比較測試

FetchRecordsFromDatabase
key= fetch() name date
billKey true Bill later
bobKey true Bob today

 在入參的列中加入=表示使用單元格中的symbol值fetch

symbol是在測試執行中賦值this

 

2.variables 相似全局變量,只要在父級頁面定義了,就能夠在子級頁面使用spa

定義的方法主要有三種code

  • !define var {text} - as a delimited block of text
  • !define var othervar - by copying the value of another variable
  • !define var {${= 10 / 2 =}} - as an expression

例子:it

!define myVariable {
This is the
text of
my
variable
}
variable defined: myVariable= this is the text of my variable
io

!define n 10
variable defined:
n=10
!define q 2
variable defined: q=2
!define d {${= ${n}
/ ${q} =}}
variable defined: d=${= ${n} / ${q} =}
${d} is : 5
IMPORTANT: If the variables
used in the expression change than also the result changes!
!define q 5
variable defined: q=5
${d} is : 2
table

 

variables在測試執行前定義好,在測試過程當中不會改變class

相關文章
相關標籤/搜索