How to refer same DataTable across different features in cucumber-jvm? - cucumber

In one of step definitions I have created a function say “someFunction” that takes a DataTable, which has been defined in my feature file Feature1.
Feature1.feature
Given: User enters the following data
Varibale1|Variable2|Variable3
Value1|Value2|Value3
StpeDef.java
#Given(“^User enters the following data$”)
public void someFunction(DataTable input){
}
Now in another feature file “Feature2.feature”, one of my scenario needs to use same step i.e. call someFunction. I know I can use the same step definition but does that mean that I would have to redefine same DataTable input in Feature2 file.
If not, how would I do it?
Please note that I understand the Backgound keyword and its use, but if I say I need to keep these scenarios in different feature files, how should this be done?

You'll have to duplicate the common background. Since duplication is unwanted, you should consider giving a name/title to the resulting state that is represented by that common background and create a single given step that can be re-used. Something like "Given: the user has entered valid contact data" or "Given: the shopping cart has 3 items" (where any 3 will do).

Related

Forget second input in action when prompt for first input is responsed

I have my code in following structure:
action(app){
//two inputs in this action
1.InvocationName
2.MenuOptionValue //(Action1,Action2,Action3)
//output
Selected Menu Option operation
}
I am new to Bixby , I have following Two Questions:
1.When I give directly only menu option(2nd Input), it prompts me for Invocation name(1st Input) which is trained in NL ,and then I give invocation name and it starts output operation,which it should .But, here I want it to forget the previous Menu Option (2nd input) and prompt me for it again.Is it possible in this structure or suggest if possible in other structure way.
2.MenuOption have 3 options(Action1,Action2,Action3) which should redirect to 3 different operation on input.
Though i am printing in js (endpoint) on different inputs.But how will i perform another following action(User Interaction with Bixby) for those operation,saving previous data.Is it possible by this structure or any suggestions?
For question #1, please give concrete example. I don't understand what you want to do here. I will update my answer when you provide more content. Maybe as answer to question #2, remodeling your capsule to three actions each with different input solves this issue as well. Action would be isolated from each other, so there is no remember or forget issue.
For question #2, if 3 different actions requires different input method, for example, one is integer, and one is string or maybe the third is an integer plus string, you should consider make them different actions and link to separate JS file in endpoints. Then you can treat each action differently by adding different follow-up. Make sure you add training utterances for each of the actions. It is recommended that one action model in Bixby should handle, well, one action only.

UML Activity Diagram for android project

I have created the below diagram and I wanted to know if the diagram that I have done is correct.
The below diagram is based on an android application. When the application loads the user is given 3 button to select add, update and help. On click on add button the user is given an option to add a new user or add a new item. When he select either of the options he enters the required data once the data is entered the system check if all the values are entered correctly and then finally saved. The same process is applied for update.
Your diagram misses an entry point. Though it's rather obvious that the top action is the start, only the entry point is the one indicating the beginning.
You can omit most of the diamonds and directly transfer via a guard from actions. So your conditions should be guards and written as [Yes] or [No]. The top most action (and quite some others) is(/are) indeed what should be written inside (or aside) the diamond below.
An excerpt for an update could look like this:
Finally Values added does not look like an action but rather as state. It should be omitted. Alternatively use differently named end flows.
So far for the formal points. But as #eyp said: it's a good one and one can understand what you tried to express. The above is just for the picky teachers.
It's a good one but it lacks some detail in the diamonds. You should write besides the diamon the question before choosing the next setp to do.
For example in the diamond after Check update value you may write is valid? or another question that clarifies more the business logic.

Can I use parameters with Twist concepts?

The Twist documentation for extracting concepts shows how multiple steps can be grouped into one step that contains those steps. For instance, the following eight fixtures
1. Start at the Maintain product catalog page.
2. The page title should be “Joe’s musical —Maintain Product Catalog.”
3. Click the Add New Instrument button.
4. The page title should be “Joe’s musical—Add New Musical Instrument.”
5. Enter text “Guitar” into the Instrument field.
6. Select “Slide” from the Type selection list.
7. Select “Dobro” from the Brand selection list.
8. Click the Save button.
Can be condensed into one concept:
1. Add a New Musical Instrument “Guitar” of type “Slide” and brand “Dobro”
However, the tutorial doesn't say if it's possible to use this concept with other parameters (perhaps with "Drum" instead of "Guitar"). However, it does clearly say that parameters in the concept name should be surrounded by quotes, but they also should match the parameter name, so it's not clear if it's possible.
So can I use parameters with Twist concepts?
Yes! The documentation is really crummy about making this clear, but it is absolutely possible.
If you extracted a concept in the way that they described in the tutorial you referenced and others, then the fixture Add a New Musical Instrument “Guitar” of type “Slide” and brand “Dobro” actually contains three parameters named Guitar, Slide, and Dobro. What makes this so confusing is in each scenario you can change the value of each parameter to whatever you like (perhaps "Drum", "Snare", "Yamaha"), but under the hood, the variables are still called by their original names (thus Guitar=Drum, etc.) and these original names will appear as default values whenever you add the concept to a scenario.
To eliminate confusion, I recommend changing these default names. In this case, it might be Add a New Musical Instrument “Instrument” of type “Type” and brand “Brand”. Bizarrely, you can't rename the parameters via "Rephrase the Open Concept" because you run into a catch-22 situation. You can't change the name of the concept because it doesn't match the usage in the fixture. And you can't rename the fixtures because the parameters are bound to the concept name. So I recommend just opening it up in the text editor and making the change there.
So bottom line, the examples make it seem like you can't use parameters because the parameters wind up being named after whatever value you inputted. I recommend changing the default parameter names, but you have to do it in the text editor because Twist won't let you.

Best approach to design an infopath form with repeating (but not identical) sections

i'm an InfoPath noob, and i have to prepare a (quite complex) form.
This form is made of two main areas: a summary page and one (or more) "element-specific" page(s).
In the summary page the user must select one or more elements (with a maximum of 4) and fill some data.
When the user selects one of those elements, the form should add the element-specific page related to the selected element.
I have already created both the summary and the element-specific pages (all in a single view...is that bad?) for a single "element-type".
Now i'm having quite a problem. Due to the fact that the element-specific form is quite long and have different fields and validation logics, i really don't want to replicate (copy) all those fields and elements one by one (if i just copy the section, it will have the same field/value of the other element-type).
I have seen the repeating/optional section, but those options doesn't seem to be good for my problem (in the summary page the user must check the element-type in order to enable some data fields that must be filled...and the checked items must be consistent with the sections that are shown. The user cannot add arbitrary sections like in the repeating/optional sections, the form (based on the checked fields) should show the correct sections)
Consider that some small details are different from a specific-section to another (i have to take some values of some fields from a specific section fields in the summary page and change an image) and i don't know how to handle those differences.
Consider also that the final output of this work should be a printable pdf.
Here you can find some images mocking the result of the form:
1) This is the Summary Page:
2) this is a mock of two detail pages. Please note that are the two ones "selected" in the summary.
3) this is a mock of the fields structure of the form:
What i need is in fact to create 4 "mostly identical clone" sections, all with their status and values, with some minor differences from one to another.
Is there any way to achive such result whithout having to create 4 different "sets" of fields, one for each specific element (that would obviously be a big amount of error-prone work)?
Sorry for the long post...hope it was clear enough.
Many thanks in advance
Ok, so i've found a very good solution using template parts. I've designed some template part for the common form sections (following this guide on www.informit.com, then i've added them to the complete form template by building each block using,when needed, the right template part.
Thanks to teylyn for the help (luckly i didn't have to write to a list or use vb or c# code in my template part, only in the main template).

Drupal6: How to handle node links in user profile attributes?

One of the fields in my user profiles is a list of nodes. (This list is generated automatically, based on other data on the site.) Currently, it displays like this:
Nodes
nid1, nid2, nid3
I want it to look like this:
Nodes
$nid1->title, $nid2->title, $nid3->title
where each title is a link to its node. What is the best way to do this? I tried filling the field with links generated by l(), but the html gets filtered out.
Also, when using l(), is there a way to say: create a link to the node with $nid, no matter where it happens to be located at runtime?
Concerning the first question:
The field values of a profile list are run through ´check_plain()inprofile_view_field()`, so you can only get markup in there after they got loaded, which leaves you with at least two options, depending on where you want to alter the output:
Implement hook_user() and, on the 'view' operation, modify the field values in the $account->content array (Make sure that your modules weight is below that of the profile module or the values will not be in there yet).
Add your own preprocess functions for all templates where the fields are used and make your adjustments there. On first sight, these should be the following, but the list might be incomplete:
yourModule_preprocess_profile_block() (profile module)
yourModule_preprocess_profile_listing() (profile module)
yourModule_preprocess_user_profile_item() (user module)
As for the second question:
Also, when using l(), is there a way
to say: create a link to the node with
$nid, no matter where it happens to be
located at runtime?
I do not understand what you mean by "no matter where it happens to be located at runtime". Anything that is not covered by the following?
l('SomeTitle', 'node/' . $nid)

Resources