UML中有没有一种方法可以表达“虚拟”之类的东西?用例?

发布于 2024-08-06 05:07:32 字数 550 浏览 9 评论 0原文

我正在做需求分析,所以我正在写一些用例图。我将尝试通过以下示例来阐明虚拟测试用例的含义:

我有一组操作,例如 {createread,<代码>更新,<代码>删除}。我想将它们分组为一种虚拟用例,这样我以后就可以扩展它并为每个操作创建一个新的用例。类似于:

  o
 -|- ----- ( basic operation ) <---- <<extends>> --- ( read )
 / \

理论告诉我这是不正确的,因为用例中的扩展应引入基本用例描述的基本操作序列的变化。就我而言,基本操作用例没有实际意义,因此它没有关联的操作序列。

这对于根据菜单项对操作进行分组可能很有用:

File Operations = {Save, Save As, Print, Exit}

您会如何表达类似的内容?

I am doing requirement analysis so I'm writing some use case diagrams. I'll try to clarify what I mean by virtual test case with the following example:

I have a set of operations, for example {create, read, update, delete}. I would like to group them in a kind of virtual use case, so I can later extend it and create a new use case with each operation. Something like:

  o
 -|- ----- ( basic operation ) <---- <<extends>> --- ( read )
 / \

The theory tells me that this is not correct, as the extensions in use cases shall introduce changes in the basic sequence of actions described by the base use case. In my case, the basic operation use case is empty of real meaning, so it has no associated sequence of actions.

This could be useful for grouping actions depending on a menu item:

File Operations = {Save, Save As, Print, Exit}

How would you express something like that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

纵山崖 2024-08-13 05:07:33

从您的问题来看,我认为您尝试做的主要事情之一是表达多个用例之间的逻辑关系。更具体地说,您试图表明许多用例(例如“保存文件”、“打印文件”等)在功能上是相关的(“文件操作”)。

您可以使用UML 包来表达此类关系。例如,您可以创建一个包含相关用例的“文件操作”包:“保存文件”、“打印文件”等。

It appears to me from your question that one of the primary things you are attempting to do is to express a logical relationship between a number of use cases. More specifically, you are attempting to indicate that a number of use cases (e.g. 'Save File', 'Print File', etc.) are functionally related ('File Operations').

You can express such relationships by using UML packages. For example, you could create a 'File Operations' package that contains the relevant use cases: 'Save File', 'Print File', etc.

心清如水 2024-08-13 05:07:33

UML 规范允许用例是抽象的。您可以使用 <> 关键字或斜体。我想说虚拟和抽象在用例级别上是相同的,这就像类一样。我认为用例是 UML 中的一种分类器。

您还可以使用模板并创建模板用例,并要求任何实例完成需要填写的创建、读取、更新、删除参数。您仍然可以标记模板用例摘要以帮助清除此问题。这是更严重的,在模型中捕获的,而不仅仅是图表方法。文字字符串将为您提供更多灵活性,操作需要 claas 参与并提供操作,这并不理想。

您可能还考虑用例的扩展点,但我对这些了解较少。

Well the UML spec allows for a use case to be abstract. You could use the keyword of <> or italics. I would say virtual and abstract are one and the same at the use case level, this is just like with classes. Use Case is a type of classifier in UML, I think.

You could also use templating and create a template use case and require that any instances then complete the parameters of create, read, update, delete which would need to be filled in. You could still mark the template use case abstract to help clear this up. This is the more serious, captured in the model, not just the diagram, approach. Literal Strings will give you more flexability, operations would require an claas to participate and provide the operation, not as desirable.

You might also consider extension points on use cases, but I know less about these.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文