【发布时间】:2013-02-08 02:42:06
【问题描述】:
我正在做基于模型的测试,我已经用 UML 图对我的应用程序进行了建模,还编写了使用 OCL 进行测试的所有约束,我想知道是否有 Eclipse 的工具或插件可以帮助从 UML 生成测试用例/OCL 模型,可用于黑盒测试。 (提前致谢)
' @Christian 感谢您的回复,以下是我的 OCL 表达式的一部分
post: numberOfTrials = numberOfTrials@pre + 1
and if userPin = customer.card.pin and numberOfTrials <= 3
then pinAccepted and result = PinResult::Correct
else not pinAccepted
and if numberOfTrials <= 3
then result = PinResult::Wrong
else result = PinResult::Abort
endif
endif
context ATMController::withdraw(amount:Real) : Boolean
pre: pinAccepted
post: if (amount <= customer.account.balance)
then customer.account.balance =
customer.account.balance@pre - amount
and result = true
else customer.account.balance =
customer.account.balance@pre
and result = false
endif
'
【问题讨论】:
-
你能给你的 OCL 表达式举个例子吗?他们是否在实例级别检查模型?如果是,只需使用 EMF 生成代码就足够了。
-
@Christian 我添加了我使用的 OCL 表达式示例。