The group-by expression is relative to the selected elements, so you don't want to repeat "testcase" in the path.
Yes, the body of the for-each-group is processed once for each distinct value of the grouping key. Within the body, you can access the contents of the group using the current-group() function.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference