当我们在基本流程中编写用例表*(id,描述,参与者,前提条件,后置条件,基本流程,替代流程)*时,我们展示了参与者与系统之间交互的简单步骤。我想知道如何在用例基本流程中显示条件? AFAIK,基本流程包含针对用例的简单简单步骤。但是如果没有伪代码,我无法显示条件? UML用例描述的基本流程中是否允许使用伪代码?
对于上图,应该是下表吗?
-------------------------------------------------------------
| ID | UC01 |
-------------------------------------------------------------
| Description | do something |
-------------------------------------------------------------
| Precondition | -- |
-------------------------------------------------------------
| Postcondition | -- |
-------------------------------------------------------------
| Basic flow | 1. actor requests system to do something |
| | 2. if X = true |
| | 2.1 system does step 1 |
| | else |
| | 2.3 system does step 2 |
| | 3. system return results to actor |
-------------------------------------------------------------
| Alternate flow| -- |
-------------------------------------------------------------
答案 0 :(得分:3)
答案 1 :(得分:2)
do something
和step 1
显然是不同级别的,最好将它们放在单独的用例中。Actor
并不是演员角色的最好称呼,可以说它是User
。Step 1
更改为Calculation 1
以避免混淆。示例
------------------------------------------------------------------------
| ID | UC01 |
------------------------------------------------------------------------
| Level | User goal, black box |
------------------------------------------------------------------------
| Basic flow | 1. User requests Robot System to do something. |
| | 2. Robot System performs UC02. |
| | 3. Robot System return results to User. |
------------------------------------------------------------------------
------------------------------------------------------------------------
| ID | UC02 |
------------------------------------------------------------------------
| Level | SubFunction, white box |
------------------------------------------------------------------------
| Basic flow | 1. Robot System validates that X is true. |
| | 2. Robot System does Calculation 1. |
------------------------------------------------------------------------
| Alternate flow 1 | Trigger: Validation fails at step 1, X is false. |
| | 2a. Robot System does Calculation 2. |
------------------------------------------------------------------------