【问题标题】:Automated test case generation from UML/OCL model in eclipse在 Eclipse 中从 UML/OCL 模型自动生成测试用例
【发布时间】: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 表达式示例。

标签: java uml modeling ocl


【解决方案1】:

由于您的查询似乎处理模型类的实例,您可以从 org.eclipse.uml 模型生成 EMF(ecore)(创建 genmodel 并选择 .uml-file 作为源),然后使用 Eclipse OCL 执行您的查询,例如此处描述:http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.emf.query.doc/tutorials/oclQueryTutorial.html

【讨论】:

  • 谢谢@Christian,我会试试你的建议
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-10
  • 2012-09-10
  • 2016-09-13
  • 2015-07-21
  • 2013-07-17
  • 1970-01-01
相关资源
最近更新 更多