I have a large activity diagram with a lot of branches. I want to denote that part of this diagram is contained in one microservice, but when I add a partition it scrunches everything together and the lines get crossed, making it even more unreadable than it already was. Is there a way around this. I searched the docs and it looks like there is no way to set the width of a partition. While I can't post the actual code since it's confidential, here is a gibberish version
#startuml
skinparam backgroundColor Azure
"user clicks on link" --> "do something"
"do something" --> ===b1===
===b1=== --> "do somethin else"
===b1=== --> "yep"
"yep" --> "foobarbaz"
"do somethin else" --> "bizzfuzz"
"bizzfuzz" --> ===b2===
"foobarbaz" --> ===b2===
partition Conductor{
if "is it it" then
--> ["yes it's it"] "OK"
if "really?" then
-->"asdfasdfasdfasdfasdf"
else
-->"asdfasdffasdfasdf"
if "sure?" then
-->"zxcvzxcv"
else
-->"zxcv"
endif
endif
else
-->"do something different"
if "asdf?" then
-->"ghasdgf"
else
->"asdf"
if "reallysure?" then
-->"ireytiteryi"
else
-->"wertywert"
endif
endif
}
#enduml
Notice that if you remove the partition the elements spread out a bit. I want to keep them spread out that way but also have the partition. Is this possible? I've tried using swimlanes but it did not work for me (guess they do not work in activity diagrams)
I converted part of your diagram to swimlanes. The example with Conductor doesn't make any sense to me, so I reused something from the PlantUML documentation with many if statements. If you enable !pragma userVerticalIf on, the swimlane will become much narrower.
#startuml
skinparam backgroundColor Azure
!pragma useVerticalIf off
|Other|
start
:do something;
fork
:do somethin else;
:bizzfuzz;
fork again
:yep;
:foobarbaz;
end fork
|Conductor|
if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2;
stop
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
#enduml
I'm evaluating if PlantUML can be a good alternative to GraphViz.
It's promoted as "intuitive" but honestly the very first example from the homepage is already confusing.
Why does the following create "Bob" and "Alice" twice?
I'm seeing 2 nodes in the text, and 4 in the output.
Also, the arrow doesn't go between the nodes, but between relations between duplications of the nodes.
Bob->Alice : hello
It makes zero sense to me.
What is the meaning of this example, and what would be a more trivial example with just 2 nodes and an arrow between them?
I see you have fallen for the classical trap of "The first page of the manual is not representative of the tool".(1)
Besides various UML diagrams (like the sequence diagram you encounered), PlantUML has support for various other Software development related formats (such as archimate, Block diagram, bpmn, c4, Computer network diagrams, erd, gantt chart, Mind maps, and wbd), as well as visualization of json and yaml files.
In fact, it even understands Graphviz syntax!(2)
Because of all of this, "intuitive" doesn't happen until you have some basic knowledge of PlantUML.
So back to your issue... What you are seeing isn't what you think it is.
What is that?
Relating things to Graphviz, instead of this:
digraph d {
Bob -> Alice : hello
}
You are actually seeing this:(3)
#startuml
digraph sequenceDiagramExample {
bobHead [ label="Bob" pos="0,1.5!" shape="record" ];
bobPoint0 [ pos="0,0.75!" shape="point" width="0" ]
bobFoot [ label="Bob" pos="0,0!" shape="record" ];
aliceHead [ label="Alice" pos="1,1.5!" shape="record" ];
alicePoint0 [ pos="1,0.75!" shape="point" width="0" ]
aliceFoot [ label="Alice" pos="1,0!" shape="record" ];
bobHead -> bobPoint0 -> bobFoot [ dir="none" style="dashed" ]
aliceHead -> alicePoint0 -> aliceFoot [ dir="none" style="dashed" ]
bobPoint0 -> alicePoint0 [ label="hello" labelloc="c" style="solid" ]
}
#enduml
Gimme an example!
What an example with just two nodes and an arrow between them looks like depends on the kind of graph chosen...
What you have to remember is that, with Graphviz, you have to apply all meaning to a diagram yourself. With PlantUML, the meaning is provided by PlantUML for you. All you need to do is tell PlantUML what you mean.
With a few basic pointers, this becomes intuitive quite quickly. You just need to know what kind of diagram you want to draw before starting...
As you can see from the examples below, PlantUML is a very powerful tool to add to your software developer toolbelt.
I hope the examples will help to make things more intuitive, and that your first misstep won't keep you from exploring PlantUML further!
Activity
#startuml
:Alice;
:Bob;
#enduml
Archimate
#startuml
archimate #Application Alice
archimate #Business Bob
Alice -> Bob
#enduml
Class
#startuml
Alice -|> Bob: Hello
#enduml
Component
#startuml
[Alice] -> [Bob]: Hello
#enduml
Deployment
#startuml
folder Alice
file Bob
Alice -> Bob: Hello
#enduml
Ditaa
#startuml
ditaa
+-------+ +-----+
| | hello | |
| Alice +------>| Bob |
| | | |
+-------+ +-----+
#enduml
Gantt
#startgantt
[Alice]->[Bob]
#endgantt
JSON
#startjson
{
"Alice": ["Bob"]
}
#endjson
MindMap
#startmindmap
+ Alice
++ Bob
#endmindmap
Network
#startuml
nwdiag {
network hello {
Alice;
Bob;
}
}
#enduml
Object
#startuml
object Alice
object Bob
Alice -> Bob
#enduml
Sequence
#startuml
Bob -> Alice : hello
#enduml
State
#startuml
[*] -> Alice
Alice -> Bob: hello
Bob -> [*]
#enduml
Timing
#startuml
concise Hello
0 is Alice
+100 is Bob
#enduml
Use Case
#startuml
:Alice: -> :Bob: : Hello
#enduml
WBS
#startwbs
+ Alice
++ Bob
#endwbs
Footnotes
It's not realy a classic, I just made that up. But it is something that commonly happens.
Reference the manual here: https://plantuml.com/dot
Rendered in neato not dot, see https://stackoverflow.com/a/53470455/153049
They are not “four nodes”, they are top and bottom headers for every participant in the sequence. This is useful for readability in larger sequence diagrams, see some examples here https://plantuml.com/en/sequence-diagram
You can style your diagram to comply with strict UML with
skinparam style strictuml
Full code
#startuml
skinparam style strictuml
Bob -> Alice : hello
Alice -> Bob : ok
#enduml
I want to have deployment and sequence stuff in one and the same rendered plantuml picture. So I tried the following but it does not work, the rendering shows the sequence stuff for A, B and C as deployment.
How can I force rendering for "A->B" and "B->C" as sequence diagram stuff?
#startuml
file main.c
note right: I want to have description text here
A -> B : main()
note left : program\nentry function
B -> C : load()
note left : another important function
#enduml
I think you need to add your note later:
#startuml
title file main.c
A -> B : main()
note left : program\nentry function
B -> C : load()
note left : another important function
note right: I want to have description text here
#enduml
Result:
So I use a general "I press "*" button" Gherkin statement for pressing buttons. My problem is the text is not standardized throughout the app.
What I want to do is use find_elements to form an array of all button elements, take the text from my Gherkin input (for example: 'I press the "Yes" button'), utilize the .casecmp method to ignore the capitalization of my button text from the find_elements array and compare the text attributes and my Gherkin input.
Here's my attempt at the code:
Then (/^I press the "([^"]*)" button$/) do |button_text|
#assign gherkin input to variable
#button_text = button_text
#create find_elements array for all Buttons
button_array = find_elements(xpath: "//android.widget.Button")
#create for loop that will compare each element's text with #button_text
button_array.each do |index|
#Attempting to reference text attribute of array at index and compare #button_text with case insensitive comparison
matching_button = button_array[index].text.casecmp("#{#button_text}")
if matching_button = 0 #this means it's a match
button_array[index].click()
else
end
end
end
At the moment I get the following errors:
And I press the "YES" button # features/step_definitions_android/common_steps.rb:107
no implicit conversion of Selenium::WebDriver::Element into Integer (TypeError)
./features/step_definitions_android/common_steps.rb:113:in `[]'
./features/step_definitions_android/common_steps.rb:113:in `block (2 levels) in <top (required)>'
./features/step_definitions_android/common_steps.rb:111:in `each'
./features/step_definitions_android/common_steps.rb:111:in `/^I press the "([^"]*)" button$/'
features/FAB.feature:18:in `And I press the "YES" button'
I'm not totally sure what these errors mean in my case but I'm continuing my research. If anyone can share insight into what I'm doing incorrectly I'd greatly appreciate it.
Also is there any documentation as to how appium stores elements in that array? Can I even compare the text attribute of the element to a variable or other value? Thanks a ton for any help you can give me.
The index which you have taken will have the web-element instead of an Integer which you are expecting. Try the following :
Then (/^I press the "([^"]*)" button$/) do |button_text|
button_array = find_elements(xpath: "//android.widget.Button")
button_array.each do |btn|
btn.click if btn.text == button_text
end
end
Let me know in the comments if you face further issue.
Hope it helps!!
I am not really sure whether this problem comes under multi array or not.
I have some set of values mentioned below
For 1 hr in 100 °C -> 2516
For 2 hr in 100 °C -> 2566
For 1 hr in 200 °C -> 2344
For 2 hr in 200 °C -> 2156
There are 50 to 60 records like this.. And I will enter everything manually in the code something like array..
What will be the best way to retrieve the values
For Eg: If I give 2 hr and 100 °C -> Result should be 2566
For more clear I am attaching one screen shots below
Software UI and Charts
I have embedded Charts below the UI screen itself and there are more charts like that..
If I select radio button 100 °C With 1 Hr. then the Output will be
B.H -> M21(2516) & NC(2573)
A.H -> M21(2512) & NC(2567)
Loss -> M21(0.159) & NC(0.2332)
Sorry if I am not good with English or else with Explanation.
Thanks in advance.
You can work with Dictionary, since this instruction can work with an index and a value. See if this can helps you:
http://www.dotnetperls.com/dictionary-vbnet