TFS 2017 power tool custom field connected to User Story - tfs

Using the power tool I was able to add a new custom field but I want that it take automatically a specific value if present.
Each test case has a "user story" associated but to associate it we have to go in "Tested User Story Section" so I'd like that in the main page appear automatically the ID of the user story.
Sorry for the confusion maybe with the image will be more understandable:
Someone can advice me of what to introduce in the Visual Studio Power Tool please? because I'm finding different example but none explain how to auto-populate with another dynamic item.
If you are asking me why it's because we want to have the "User Story ID" present in the main page so we know directly at which user story the test case is associated:

There is no way to get the User Story ID as a field. Since a single Test Case can test multiple User Stories this makes little sense anyway.
Have you tried adding Requirement based Suits to Test Professional so that you can see all of the Test Cases under a Story? From a testing perspective it makes lots of sense to look from the Story down to Tests rather than Test up to Stories.
Although my screenshots are from the Web App the features at the same in MTM. You can add a Requirement Based Test Suite that relates back to the User Story.

As #MrHinsh mentioned, there is no direct way to get the User Story ID from a field.
From TFS query, it's easy to get the linked User Story, you can select the Work Item and Direct Links in work item query, check the screenshot below:

Related

How do describe a simple process in Gherkin-style? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Suppose I'm designing some SaaS service. And I need to have a function that allow users create sites. User can makes special settings for each site in the admin panel (e.g. design of widget) and gets unique code for install service to his own site.
User story could be:
As a logged user I want to add the new site in the admin panel so that I could configure each instance of widgets separately and could get a unique code for install widget to my own site.
Form
But if I will try to describe this functionality with BDD or GWT (Given When Then) or Gherkin-style, I will face with some trouble. I start from next description:
GIVEN I'm logged into admin panel
AND I'm on "Sites" page
WHEN I click "Add site" button
THEN Pop-up window "Add site" come up
As you can see above realization suppose that site adding will be in pop-up window (e.g. it very important for UX). Pop-up window contains Site URL input field, drop-down control with languages and "Add" and "Cancel" buttons.
And we got a strange scenario which responsible for just pop-up opening. Is it correct? And how can I name this scenario ("Add site's form opening" ??)? Also this scenario has only a one case (when I click - pop-up open). Maybe this scenario not needed at all? I'm confused...
In this case we need to create another scenario when describes:
GIVEN "Add site" pop-up form is opened
WHEN I fill the "Site URL" field
AND click on "Add" button
THEN New site will be create in system
AND I will transfer to my own site's list
How do you think, where do I need to apply a business rules such as:
1) When new site is created a unique code must be generated and consist of minimum 8 characters including numbers and Alphabetical symbols.
2) checks doesn't apply for Site URL input field and user can input a Cyrillic symbols
3) etc?
I have a lot of additional question and hope on the community help!
The thing with BDD is to stay away from implementation details as much as possible. This scenario has multiple implementation details:
GIVEN I'm logged into admin panel AND I'm on "Sites" page
WHEN I click "Add site" button
THEN Pop-up window "Add site" come up
What happens if the "Sites" page becomes "Awesome Site" page or is simply deleted?
What happens if "Add site" is not a button anymore?
What happens if it's not a popup but a redirect occuring
What happens after? Is the value simply in showing the popup? I guess not...
For this specific example, a better approach would be:
GIVEN I'm an authorised administrator
WHEN I enter all the required information for a new site and save it
THEN I should see that site in my own sites list
With this scenario, if your implementation changes, you will only have to change your step definitions, you won't have to change your gherkin. Don't forget that those tests are supposed to explain the Behaviour of the system, not the way it is implemented.
The other questions you have are more related to unit testing in my opinion:
When new site is created a unique code must be generated and
consist of minimum 8 characters including numbers and Alphabetical
symbols => I'd do it at the class level, gherkin would not be
appropriate unless the customer specifically asked for this, then
the condition is "THEN a code having the required characteristics is
generated for that site" and you would have to define "required
characteristics" in a glossary the customer can read and understand.
Checks doesn't apply for Site URL input field and user can input a Cyrillic symbols => again, would put that at the class level en same as for 1. unless the customer wants to be able to read something about it, it should be at the unit level.
I hope that answers your question. I recommend this article by Dan North if you want to have a better idea of how to write better gherkin features.
EDIT 11/13/14
Based on your comments, I suggest we take a step back and describe a way to deal with requirements in your case. I have to tell you that I'm not a BDD expert and am only sharing my own personal experience, for more info on the subject I suggest you get in touch with the guys behind BDD Kickstart and Cucumber.pro where you will find online BDD courses. They will be able to give you lots of information and books to read.
That being said, let's dive into the subject.
The first thing you get is a list of features or stories that, if you follow Mike Cohn's story template would look like:
As a <type of user> I want <to do something> in order to <serve a business purpose>
I personally like to put the business purpose first to make sure we don't skip it in the discussions. You might also not follow that template and that's fine, but remember that it's a good idea to make sure the features you are listing with your customers have a business purpose. If there is no business value behind a feature then what's the point of doing it anyway...
So you do have a list of features/stories described as above. Now for each of these features, there are different cases or scenarios, that's what Dan describes in his article. This is where the Given-When-Then is introduced.
Scenario: Title
Given <some context>
When <there is an event>
Then <something happens>
Each of those scenarios are examples on how this specific feature behaves in different contexts. They are the different acceptance criteria for a specific feature, things the customer described as the expected behaviour of the system. They should be ignorant of any implementation details. So stuff like:
Given I am on page "First page"
When I click "Hello world"
Then I should see "You clicked hello world"
Is wrong for the reasons described prior to this edit.
Let's assume the following feature:
In order to save time when answering clients requests, as a webmaster,
I want to be able to manage the list of websites I am responsible for
Scenarios for this story would be:
Scenario 1: Show a list of websites
GIVEN I am an authorised administrator
AND I am managing several websites
THEN I should see a list of all the sites I manage
Scenario 2: Add website to list
GIVEN I am an authorised administrator
WHEN I enter all the required information for a new site and save it
THEN I should see that site in my own sites list
Scenario 3: Edit website from list
GIVEN I am an authorised administrator
WHEN I edit the site informations
THEN I the changes should be visible in my sites list
...
Now what if you want to go into data validation stuff like "site should have a title" for instance. To me there are two different ways to approach this. You can test that from the user's perspective with a full-stack test or test that there is some validation at the object level.
Let's assume the following scenario:
Scenario: New site has no title
GIVEN I'm an authorised administrator
WHEN I forget to fill in the title for a new site and save it
THEN I should be warned the site is not valid
You can use cucumber or specflow to run this scenario from the UX, therefore using some kind of browse-based proxy to test your app. That is usually slow as it hits the whole system and simulates a real user. It's an option, but I don't think it's the best though. IMO not all tests should be run against the UX and having too many Gherkin features can be a pain to maintain, that's why I prefer focusing on having the happy or critical path (usually I ask myself, where does the money comes from) tested full-stack and put the rest at lower levels.
You can still use Gherkin for these unit tests if you'd like. But that is not mandatory. You only need a way to show your customer you actually have a test for all those specific format controls and validation checks.
That doesn't mean you are not doing BDD anymore, you can still use the given-when-then-should pattern in rspec if you're a rubyist, or any other testing framework you use.
Hope that clarifies all this, let me know if there are any confusing parts...
I think Marc simply deserves the big green tick on this one, thanks to his amazingly thorough answer!
I just wanted to add a few comments.
You don't need to automate all your scenarios.
If you want to capture business requirements in a form that everyone (i.e. including non-tech savvy folks) can understand and Gherkin's Given/When/Then work for you, just go for it. There's nothing forcing you to automate all of your scenarios.
You don't need to automate all your scenarios through the UI.
Your software is made of layers that often respond to similar behaviours, via different interfaces (UI, HTTP, API, ...). Should you want to describe fine-grained business rules (i.e. site name constraints) with automated gherkin scenarios, you could write step definitions that talk directly to your domain layer instead of going through the user interface. That would probably still give you a decent level of confidence.
As a side note, I would recommend not to use Given/When/Then in classic testing frameworks (i.e. those that only devs can see!) if your purpose is to share your tests/requirements with non-tech people.
Have conversations!
Above all, BDD is about better communication: try to talk more, involve your developers (or some of them) earlier in the process so that they gain more knowledge, sooner. Formalising Gherkin scenarios comes in a second phase. Automating them should even be further down your priority list!

Creating meaningful user stories

We are trying to use BDD to create a web service to supply data to a web page and then save the user's changes.
The story I have so far goes
Given I want the data for order number 1234
When I load the data
Then I have the data for order number 1234
What am I missing in my approach?
Are user stories not appropriate for this kind of task?
How do I go about formulating meaningful user stories?
[Update]
As a customer
I want to see my order
So that I can check it is what I expect
Given I have entered the order number
When I Click GO
Then I should see my order displayed on the screen
Here's how I'd write what you have so far:
Feature:
As a customer
I want to be able to view and change my orders
So that I can check that they're being processed as I expect and deal with them if they're not
Scenario:
Given I am a customer
And I have an order
When I go to the order
Then I should see the order
(I indented the way my tools seem to want me indent Cucumber, which is what I use, but that's not important.)
Here are at least some of the reasons why I'd rewrite it that way:
It is usual for several Scenarios that have to do with the same product feature (order management in this case) to be in the same Feature file, so the Feature section should have a broader scope than a single Scenario. Maybe this Feature should even include placing orders in the first place.
Givens are things that are true before the time period that the scenario is about, like the existence of the customer and the order. Actions during the scenario belong in Whens.
It's good to avoid UI detail like "click" and specific button names and "displayed on the screen". The scenario should focus on behavior. The When I go to the order step can encapsulate the details of going to the screen where you enter the number, entering the number, and clicking the button.
Likewise, all of the checks for different fields of the order that should be visible can be encapsulated in Then I should see the order.
I said "the order" rather than "my order" because And I have an order establishes that there's a single order with a special relationship with the scenario, and it's good to establish a language across all your scenarios that makes that relationship clear -- I always use "the" in that case. (This is a very small point.)
With those stylistic points taken care of, this is an OK scenario and I've certainly written many similar ones. To get to your real question, however:
Where Specflow-type tools really shine is when you use them to describe as complete a use case/user story as you can. For example:
Scenario:
Given I am a customer
And there is a product
When I go to the product page
Then I should see the product
When I add the product to my cart
And I check out
Then I should see that the order has been placed
And I should receive an order confirmation email
When I go to my orders
Then I should see the order listed
When I go to the order
Then I should see the order
When I cancel the order
Then I should see that the order has been cancelled
And I should receive an order cancellation email
When I go to my orders
Then I should not see the order listed
This is more valuable as an acceptance test, because it captures more requirements, and it's more powerful as an integration test, because it exercises more of the system, and fakes less of it. (In the short scenario we had to create an order artificially. Here we're doing it through the system.)

Is it possible to write a TFS Shared Query with a parameter on a custom field?

I have a set of queries on the Team home page that use the standard #Me, for example to let different users quickly get to bugs they have personally raised, PBIs they created that are now in a certain state.
The users are in customer groups and I'd like to have a similar set of queries showing as tiles on the home page, e.g. "Team Open Bugs", "Team PBIs for review".
Is it possible to write a query that does this -
Select all [work item type] from [team project] where [state] and [#myCustomerTeam] ?
From what I have read so far I believe this is not possible, and certainly not possible through the UI. I'm curious to find out if anyone has solved a problem like this - having different customer groups see different Team Favorites tiles on the Home page of Team Web Access - in some other way. I'm going to try making three sets of queries and putting different permissions on them (there are TFS groups that correspond to the Customer Group field) but I'm not confident that Denying even Read permission on the query itself will stop the tile showing on everyone's homepage.
Edited to say that solution worked for my purposes, as per comment.
Still interested to know if anyone has managed something like this more cleanly. In this case the field I would have liked to parameterise happened to be something I could map to a completely different type of thing, thus shifting the problem. I can imagine wanting to parameterise a field that didn't have that characteristic though.

How to set the Test Phase field in Team Foundation Server

I am looking for a way to track the testing status of user stories in TFS. I noticed a field named Test Phase as an option in the search query, but I don't see how to edit that field. How do I edit the Test Phase of a user story?
I cannot see Test Phase as a field on any Process Templates I have downloaded (that's not to say it's not there), so my advice might not be accurate.
You could try and customise the TFS process template to show this "Test Phase" field on the User Story - depending on what it's purpose is. You can experiment with Microsoft Excel by creating a query and adding that as a Column.
Another option, depending on what you need to track. If it is just to see what needs testing, then you can Customise the Kanban lanes on the Backlog Board. Esteban has an excellent article here describing the process.

TFS, Scrum template and Product Backlog Item

I am trying to add stories to my product backlog.
Am I right in saying that, within the PBI in TFS(2012), for a story that sounds like:
As a user, I want to login to the system so that I have access to the features my login allows.
Is that a valid story? And then, within TFS, there's a 'Name' and a 'Description'. Wouldn't the description be what I wrote above, and the name be 'Login'? I'm battling to work out what best practice would be for entering my product backlog items.
When I have used TFS, I have tried to keep the "Title" (or "Name") to be a shortened value that can be easily searched and sorted. That value is used when displayed in queries and on the board, so I find it handy to have a different format than the standard user story description.
I would then recommend the user story text you have be in the description. Something like this:
Title: Authentication: Login
Description: As a user, I want to login to the system so that I have access to the features my login allows.
In earlier versions of TFS, I wasn't able to tag stories (which is now possible) so we used a Theme in the title of our stories to quickly identify in the Title what investment theme the story belong to (in my example, Authentication).
You may want to consider that the story may get broken down into multiple stories, and your Title should be able to be used to represent that. For example, you may have a story about an SSO requirement, a Logout requirement, a loading of personal details upon login, a "Remember Me" story, etc. Using your Title in such a way as to allow for the grouping of all these stories will help you down the road.
My version of the Scrum Process Template doesn't have a name field, I'm not sure where that is coming from (it might be a customization in your TFS instance).
Your story seems like a proper Title.
The Description would probably expand on the title adding because, why, value proposition. May possibly elaborate a bit more or give context to the story.
Be careful that the story you add has proper value. I as a user don't want to login to a system, I want it to recognize me in the easiest and secure way possible. I want it to ensure I am the only person who can see my personal data. A logon screen is an implemetation of these desires, but it's usually just one of them and possibly not the best one to match my demands as a user.

Resources