Is there a way to measure time spent on a use case or a task in Visual Studio Online? I would like to keep everything in one place (Visual Studio Online would be the case) and from there to be able to generate reports, for instance monthly time tracking reports per user and daily reports that would reflect the actual time that has been worked on a specific use case / task versus the estimated time.

- 22,364
- 14
- 59
- 168

- 133
- 1
- 1
- 4
-
1There is a good discussion about time tracking options with Team Foundation Server and Visual Studio Online here: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2060101-tfs-needs-the-ability-to-track-hours-tied-to-a-wor – Ed Blankenship Dec 09 '14 at 22:00
3 Answers
When you are creating a Task linked to a Backlog item or a Bug, the field Remaining work is actually in hours. So you can set this to have kind of a time tracking.
Unfortunately, there is no way to set the actual time the task took after it is finished, as far as I know.

- 30,738
- 21
- 105
- 131

- 5,975
- 3
- 40
- 75
-
There isn't, because the system can't really know what the user is doing. You're on the right track, and they can check in their work tied to a specific task/bug/issue, so the reports make sense. – Jason Dec 09 '14 at 13:16
-
@Jason When you set the Task on `Done` there could be a field like `Actual work` that the users could set to set the actual hours that the task took. – Gimly Dec 09 '14 at 14:28
-
There is an actual work setting (at least with cmmi profiles). Estimated, remaining, actual. This doesn't solve the exact timing I think the OP was asking for, as the worker can put whatever in there. – Jason Dec 09 '14 at 14:30
-
Thanks! I will definitely try this approach. I need to have all things in one place, so there are no errors or omissions due to double evidence. Of course, as a PM, I am interested also in measurements (for instance estimation versus actual time spent to implement a feature), so we can learn from these bad estimations and also establish the velocity of the team. – Diana TM Dec 09 '14 at 15:51
-
There is no way to use TFS as a time tracking tool. – MrHinsh - Martin Hinshelwood Dec 09 '14 at 21:44
No, there is no way to do this out of the box in VSO or on TFS. This approach is not conducive to effective and value delivery. Indeed studies show that it can be detrimental to delivering value to customers.
While there are third party tools that plug into VSO and provide this capability I would recommend a different approach.
Have a separate time tracking against course grained tasks. Focus on billing and not time tracking. I want to know which customer or project to bill as well as capex vs opex... Beyond that there is little value in the data. I use Freshbooks and have used Harvest in the past successfully.
Update: If you are a consultancy you obviously need to track your time for billing. This should be done in a separate system from TFS.

- 23,409
- 5
- 46
- 69
-
2I'm confused by this. Currently we use fogbugz and create cases for all the work we do in that - and by that I mean bug cases, new feature cases, cases for all the features of new projects, as well as company development tasks etc. That way we know how we are spending our time and have a solid record of exactly how we spent our time for billing our customers (a lot of our billing is time-as-taken work, so this is vital). A feature that allowed us to record time in VSO would allow us to switch from fogbugz to VSO, I don't see why so many people are against it? – tomRedox Feb 24 '15 at 20:23
-
Time tracking is something seperate from development effort.i might have a single CustomerA-ProjectA-CapEx entry for recording time, where in TFS this is 50 tasks. Different problems... – MrHinsh - Martin Hinshelwood Feb 25 '15 at 05:17
-
That might be the case for you, but it's not for us as we bill time as taken. Our customers like to see the breakdown of where we spent our time. You say that "This approach is not conducive to effective and value delivery", but in our case it is vital to record our time against each case for exactly that reason. I guess my point is that your reply seems to be implying your company's workflow is the only correct one. Can you point me to some of the studies you mention? (I'm interested to understand why I keep encountering this viewpoint, hence the question.) – tomRedox Feb 25 '15 at 15:07
-
1tom_redox, that's not my companies workflow at all. We don't track time at all as there is no value in it. If I do a days work for my customer I bill them for 1 day. If I do two hours I bill them for 2 hours. You are encountering this viewpoint because any form of time tracking, not for billing, is not valuable. If your customers require a per hour itemisation of the work that you do then they don't trust you. If they don't trust you are they really the right customers for you? – MrHinsh - Martin Hinshelwood Feb 25 '15 at 20:46
-
It's not a question of trust though, it's just helping them understand where their money went. Our cases are discrete units of work, e.g. "fix this bug", "add these columns to a data export", "add facility to record qualifications" etc. Because we work for many clients, by far the most convenient thing is just to record the time against the cases. Then we can produce a list of what we did easily. Doing it your way we'd have to create a separate list and record times against that. OK that list would be at a lower level of detail, but it is still a different list to maintain for no benefit – tomRedox Feb 26 '15 at 11:20
-
I guess my point is that for our scenario I think tracking time against cases is perfectly valid. It also helps us easily identify how much time we spend on different categories of work (bug fixing, new features, new idea generation, meetings, etc.) which is important for us, if we didn't record times on a per case basis that data wouldn't exist. I appreciate that's not how you work, but I think saying "there is no value in it" as an absolute statement that applies to all companies is not right, "there's no value in it for us" sure, but there is value for some companies. – tomRedox Feb 26 '15 at 11:23
-
Dude, I advise companies on how to do this add this is not the way. Track "timesheets" separately from TFS. Its a BAD idea to put them in there WHATEVER your awesome reasoning for thinking it is a good idea. I have no problem tracking the data that you want, however TFS is not ever the place to do it. – MrHinsh - Martin Hinshelwood Feb 26 '15 at 12:48
-
1OK, cool, were not advancing either of our understanding here, you're repeatedly stating that this is a bad idea without any real reasoning, and I'm probably not communicating our scenario fully. This is probably the wrong place for this discussion, the short format nature of the comments restricts us. Thanks for taking the time to respond, let's leave it there. – tomRedox Feb 26 '15 at 13:33
-
1Happy for you to email me and we can discuss in detail! – MrHinsh - Martin Hinshelwood Feb 26 '15 at 17:54
-
@MrHinsh I'd be interested in knowing why you say "...any form of time-tracking not for billing is not valuable." Mind if I email you? – Ben Collins May 21 '15 at 17:55
-
4Sorry to weigh in on an old topic, but this is of interest to me. I'm interested in tracking time spent by our devs on work too, but not because I want to bill clients (we develop applications for in-house use), but because I want to know how we're performing in comparison to our estimates. If a dev gives me an estimate of 35 hours for a piece of work, I want to know how long it ACTUALLY took to complete. And I want to report on this to get an overall picture of how well we're estimating. I'm disappointed that such a facility isn't available in VSO. – Philip Stratford Nov 02 '15 at 14:58
I used Jira in the past and liked the way one could log hours worked.
We created a workaround in VSTS using the list of comments. It's not elegant, but it works. One adds a numeric value in a comment and that is counted as a number of hours worked. You can make this more elaborate using a regular expression, but I'm enclosing code that assumes there is a float or integer in there.
URL_PREFACE = "https://yourproject.visualstudio.com/defaultcollection/"
def getTicketComments(ticketID):
""" Gets a list of the comments (in order from oldest to newest) for a given ticket """
url = URL_PREFACE + "_apis/wit/workitems/" + str(ticketID) + "/comments?api-version=3.0-preview&order=asc"
jsonDict = readURL(url)
return jsonDict["comments"]
Then we sum the values we find:
def getHoursSum(ticketID):
""" For the given ticket, gets their comments, and calculates the hours
"""
commentList = getTicketComments(ticketID)
hourSum = 0
for comment in commentList:
try:
hourSum += float(comment["text"]) # Will break if it's not a number
except:
pass
return hourSum
And finally, we store the number of hours worked in the CompletedWork
field:
def updateHours(ticketID, completedHours):
headers = {"Content-Type": "application/json-patch+json"}
url = URL_PREFACE + "_apis/wit/workitems/" + str(ticketID) + "?api-version=1.0"
body = """[
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Scheduling.CompletedWork",
"value": """ + str(completedHours) + """
}
]"""
username = 'username' # Doesn't matter
password = TOKEN
# TO GET TOKEN:
# Log into https://yourproject.visualstudio.com/
# Click on your name -> My Profile
# In the left-hand sidebar, click on "Security"
# Under "Personal Accesss Tokens," click "Add"
# Under "Description" give your token a name (doesn't matter)
# Choose an expiration for your token (recommend: 1 yr)
# "Authorized Scopes" = "All Scopes"
# Click "Save"
# Copy the token it gives you into token field below (paste between quotes)
session = requests.Session()
request = requests.Request(method="PATCH", headers=headers, auth=(username, password),
url=url, data=body)
prepped = request.prepare()
response = session.send(prepped)
return response
(I just copied and pasted some simplified code--you will need to integrate it.)
Code was written by my most excellent colleague @Elliptica.

- 30,738
- 21
- 105
- 131

- 628
- 1
- 6
- 12