Show Multiple Option Choice in Activity Diagram - uml

I have one dialog where user can perform activity like
"Add to Order"
"Show Item Detail in Full Screen"
"Perform Scrolling"
how do i show this choices in Activity Diagram user can perform any of this task as optional.
i though of using Fork/Join but isnt't it for parallel activity and these three seems not parallel activity please some one clear it :)
thanks

Use Decision node and Merge node.

Use Decision node and Merge node.
They are equivalent to if/then/else (or switch) statements.
For parallel activities there are Fork and Join
See the screenshot below (from VisualParadigm)

I'll like to add up one thing here that as its optional for user to explore any option so you can make an arrow from merge node back to first decision node.... as its upto user that whether aftr exploring one option, he wants to exit or explore another option

Related

Do I use foreach for 2 different inspection checks in activity diagram?

I am new in doing an activity and currently, I am trying to draw one based on given description.
I enter into doubt on a particular section as I am unsure if it should be 'split'.
Under the "Employee", the given description is as follows:
Employee enter in details about physical damage and cleanliness on the
machine. For the cleanliness, there must be a statement to indicate
that the problem is no longer an issue.
As such, I use a foreach as a means to describe that there should be 2 checks - physical and cleanliness (see diagram in the link), before it moves on to the next activity under the System - for the system to record the checks.
Thus, am I on the right track? Thank you in advance for any replies.
Your example is no valid UML. In order to make it proper you need to enclose the fork/join in a expansion region like so:
A fork/join does not accept any sematic labels. They just split the control flow into several parallel ones which join at the end.
However, this still seems odd since you would probably have some control for the different inspections being entered. So I'd guess there's a decision which loops through multiple inspection entries. Personally I use regions only for handling interrupts. ADs are nice to a certain level. But sometimes a tabular text (like suggested by Cockburn) is just easier to write and read. Graphical programming is not the ultimate answer (unlike 42).
First, the 'NO' branch of the decision node must lead somewhere (at the end?).
After, It differs if you want to show the process for ONE or MULTIPLE inspections. But the most logical way is to represent the diagram for an inspection, because you wrote inspection without S ! If you want represent more than one inspection, you can use decision and merge node to represent loop that stop when there is no more inspection.

How to represent 3 options in a UML Activity Diagram?

I have a situation where 3 options are presented to a user by a system:
Open PDF1.
Open PDF2.
Proceed.
The system instructs the user to read the PDFs, but doesn't enforce it.
So they're free to just click the proceed button and move on to the next screen.
I drew the following diagrams, but I feel like I've got it wrong somehow.
That's not correct this way. Your 2nd attempt isn't better at all. The bars will create parallel flows, but since you join them immediately it's actually a no-op in the first case. The bar will not be reached since it waits for 3 tokens where only one can actually arrive. In the 2nd case will never continue after the join since it only gets one token from the Provides... action but need 3 to continue.
Here's a cut part of what you need to do:
There's a merge node at first to capture the tokens coming from either the action on top or from the two left ones. After there there are two decisions going guarded to the actions at the left. The can be continued to the top (guard [read next]) or to the bottom (guard [acknowledge]). That way the user can repeat reading (or skip it completely) until he passes the Acknowledge action. There's a final merge node preceding that action.
Note that the read/ack guards should appear twice for each flow to make it a machine readable model. The texts here are just overlaid but a human can understand it anyway.

how to make an activity diagram in uml to support multiple activities without if/else

I need to clarify my concept.
I am making activity diagrams for different activities. for an activity titled as:
'View Profile'.... i need to make its dgm...
In 'view profile' a user can:
1- view his/her monthly bills
2- View demographics details
3- Edit his/her details
and foreach 1,2,3 there would be different steps to be followed
My question is:
how should i make an activity dgm for such a situation... here is what I am tryong to communicate.. help me how to correct it or what sort of symbol should be used in between to serve the correct purpose as its upto user whether he wants to explore all 1,2,3 or only 1 or only 2 etc
In fact I would create an activity diagram describing view profiling which would contains three CallActivities calling respectively three activities named "View details", "Edit details", and "View bills".
Now for linking these three CallActivities inside the ViewProfile Activity I would use decision/merge nodes (depending if the threes sub activities can not be performed in parallel).
Decision node corresponding to a if/else statement but if I well understood your issue you need that plus the fact that after having performed one of these subactivities you should be able to performe one of them and this is modeled by a flow coming back to these subactivities
Hoping it is clear and it helps
Please take a look at my attachment.
If only 1 option can occur at a time: a decision point (diamond shape) would be the most appropriate (annotated "user chooses option" or similar). The decision point would have 3 paths leading to the 3 possible options.
For clarity the paths should have arrows indicating direction.
To show that the user can perform another option after completing an initially chosen one, you could have another decision point that each of the 3 steps link to. That decision point could be named "User chooses to continue further steps?" or similar, with the "Yes" path leading back to the first decision point, and the "No" path leading to a final node.

In an activity diagram, are you allowed dead ends and joins without forks? (includes example)

My question actually consists of two questions regarding the same process modelling in an activity diagram.
The process in short:
Joe uploads a file into a portal, this portal transfers the file to our server where it is checked for errors. In case of an error the server sends a message to the portal where Joe can see this (if he is still logged in or on his next visit) and upload his file again (hopefully without the errors this time). In case of success the server will also notify the portal but Joe doesn't have to take any action so we are not interested in the result. As the file is okay the system now wait for Sarah who has to start the processing of the file manually after which the process completes.
In the below diagram I have drawn this, including my two problems.
Am I allowed to let the "Notify User of succes" (I spotted the spelling mistake, thank you) in the Portal swim lane to terminate like this? If I were to put a ActivityFinal behind this that would mean the entire process would end right there which is not what we want.
Am I allowed the to join before the "process file" without a fork or do I need a fork at the very start spanning all across form Joe to Sarah?
The point of this is nothing more than an attempt to find a valid UML solution to solve this, in my own diagrams I would just do it like in the example.
Thanks in advance!
I'm not sure if it forbidden to leave an activity node without outgoing links, but for clarity (since users may think this is a mistake) I would use a flow final node (circle with x inside). This node simply terminates the flow and does not affect other flows in the diagram.
You can use a join node anywhere you want, independent if you previously did a fork or not. So what you did is correct.
I would in that case make a arrow from 'Notify user of success' to the join element, delete the arrow from the fork to the join element, and create an arrow from the fork to 'Start process'.
As far as I know the join element must have a fork at some point before it.
You can have many activity end nodes in the diagram, but I think you can't have more than one start nodes.
You have no activities on the activities diagram, do you think it is OK? No.
When a lane receives something, it should be shown as message (writing on the arrow), not as an action. Sending and receiving are special things, that are shown not as actions, but as arrow ends or if they are important as activities' parameters - border rectangles.
As for fork/join combining, it is absolutely OK.
Here is an example diagram, I have put useful for you elements on it. It doesn't mean you should copy it, only use it as a source.

Mixing Then and When in BDD User Stories/Acceptance Tests

How do you handle user stories/acceptance tests that have long chains like this one, where the Then/When mingle together? Is it best to split this into a separate acceptance test where one tests that the dialog appears and then the second one tests the behavior after the dialog has been shown?
Feature: Confirmation before removing products from cart
In order to avoid accidentally removing an item from my cart
As a Customer
I want a confirmation dialog to ask me if I'm sure I want to remove an item
Scenario: I want to remove an item from my cart
Given I have added item "xyz" to my cart
When I click "Remove"
Then a confirmation dialog pops up
And it asks "Are you sure you want to remove this from your cart"
When I click "Yes"
Then item "xyz" should be removed from my cart
Your scenario seems a little long, and it's quite heavily tied to the gui. What would happen if you tied it to the capabilities of the system instead?
Scenario: I want to remove an item from my cart
Given I have a cart containing "xyz"
When I remove "xyz" from my cart
Then my cart should be empty.
The scenario now describes stuff that's useful to the user, and it's easier to refactor.
I love BDD as much as I do because I had a situation much like this. We had 120 acceptance tests and they were mostly failing. Someone had put a confirmation dialogue box in much like the one you describe, and instantly broke over 80 acceptance tests. By turning them into scenarios with high-level, reusable steps instead, we can easily refactor and keep the tests working even if the mechanisms we use to implement the capabilities of the system change. The actual clicking of buttons happens within those reusable steps, and it's OK to have more than one UI action per step.
I wrote a scenario here which does this if it's useful (it's a DSL rather than English but you should get the idea):
http://code.google.com/p/wipflash/source/browse/Example.PetShop.Scenarios/PetRegistrationAndPurchase.cs
The question is really one of what the "branches" are.
If there are multiple steps there must be user choices at each step. There should be multiple "When"'s. This should form a rich tree with lots of user-selected alternatives at each branch. Each possible outcome should have it's own test to make the various choices and arrive at that outcome.
A three step sequence with two user choices is 8 possible paths. Different paths may arrive at the same outcome (or may not). But you should have multiple paths through this.
If it's just sequential (because someone felt like writing sequential steps) and the user has no choices, then it's not really driven by consideration of the user's behavior, is it?
I don't see the choices. No choices == bad smell. But easy to test since there's only one outcome with a sequence of captive steps where the user has few or no choices.
If you work out the choices properly, then each step has multiple outcomes and each step should be tested independently.

Resources