Preparation (standard)
P1. Copy com.phoenixcontact.polarion.codereview.formextension_1.0.0 and com.phoenixcontact.polarion.codereview.servlet_1.0.0 into the Polarion plugins folder and restart Polarion
P2. Choose a Work Item type for code reviews. Creating a new type is recommended.
P3. Add a custom field "codeReviewData" of type string (single line plain text).
P4. Add a form layout configuration and insert the extension:
<extension id="codeReview" label="Code Review" linkDepth="1"/>
The linkDepth attribute specifies where linked revisions are read from. It specifies how many levels of linked Work Items are inspected. 1 is the recommended value. 0 ist the default value. When 0 is used, revisions must be linked directly to the Work Item that displays the form extension.
Hide the custom field:
<field id="@allCustomFields,-codeReviewData"/>
Optional attributes of the form extension:
tableView(boolean)
true by default. Set false to display the file comments as list.
showFullPath(boolean)
false by default. Set true to display the full file path.
useCurrentUserCredentials(boolean)
false by default (the form extension uses the polarion user to read revision data). Set true to use the current user.
svnPropertyName(String)
Set this property to track reviewed revisions in Subversion.
Don't forget to create an empty pre-revprop-change hook.
P5. If you are using external repositories, add a property
codereview.webclienturls=reponame1;baseurl1;compareurl1;viewurl1,reponame2;compareurl2;viewurl2
For example:
codereview.webclienturls=testrepo;http://myserver/repo;http://myserver:8080/svnwebclient_test/fileCompare.jsp?url=#url#&startrev=#startrev#&endrev=#endrev#;http://myserver:8080/svnwebclient_test/fileContent.jsp?url=#url#&pegrev=#endrev#&crev=#endrev#
Review workflow (standard)
R1. Create a new code review Work Item. Link it to the Work Item(s) that contain(s) the linked revisions that are subject to review.
R2. Select review participants as assignees.
R3. Perform the code review and inspect the changed files listed in the files section. Each file can be inspected in the web client.
R4. Insert comments and mark files as reviewed.
R5. Save the review and continue later with remaining files. (optional)
R6. Add a concluding comment for the review, mark the review as completed and save the review.
R7. Make and commit changes as required and link the revisions to the original Work Item.
R8. Open the code review Work Item created in R1 to check if further changes have been committed and perform the follow-up reviews accordingly.
Preparation (extended)
PX1. See preparation (standard). Use linkDepth="0".
PX2. Add a custom field "createCodeReviewData" of type string (single line plain text)
to your existing Work Item type that contains the linked revisions (e.g. task)
PX3. Add this extension to the form layout of this Work Item type:
<extension id="createCodeReview" label="Create Code Review" workItemType="codereview" linkRole="relates_to"/>
The workitemtype attribute must contain the name from P2.
PX4. Hide the custom field:
<field id="@allCustomFields,-createCodeReviewData"/>.
Review workflow (extended)
RX1. Open the Work Item that contains the linked revisions.
RX2. In the "Create code review" extension section select the revision you want to review (screenshot 7) and click "Create code review". A new Work Item is created and opened.
RX3. Proceed as in standard workflow (R2 - R7)
RX4. In the original (task) work item (as mentioned in RX1), select the revisions for the follow-up review and create a new code review work item using the form extension.
Additional Servlets
To display code review (same view as in form extension):
/polarion/codereview/CodeReview?projectid=playground&workitemid=PG-4&linkdepth=1&tableview=false&showfullpath=true&usecurrentusercredentials=true&svnpropertyname=mypropertyname
To display an overview of all code revies in the current project (screenshot 6):
/polarion/codereview/CheckCodeReview?projectid=playground&linkdepth=1&workitemtype=codereview&sortkey=id
Use an iFrame to include them in a wiki:
<iframe src="http://myserver/polarion/codereview/CheckCodeReview?projectid=myproject&workitemtype=codereview&sortkey=id" width="100%" height="500"></iframe>
Identify Testcases based on source code changes
This additional servlet allows you to find suspect revisions (i.e. work items that have not been updated after linked revisions were committed):
/polarion/codereview/FindSuspectRevisions?projectid=playground&sourceworkitemtype=testcase&targetworkitemtype=task&linkdepth=2&linkdepthback=2&showcommitmessage=true&showtitle=true
sourceworkitemtype(String)
Specifies the Work Item type from where to start the search and compare the change date.
targetworkitemtype(String)
Optional. Specifiles the target Work Item type that contains the linked revisions. Items of any tye are searched if ommited.
linkdepth(int)
Specifies how many levels of links are searched in upward direction (e.g. from Test Case to Requirement)
linkdepthback(int)
Specifies how many levels of links are searched in downward direction (e.g. from Requirement to Task)