Introduction
The automated Code Review process not only helps the engineering teams to do the code review effectively but also automates preparation, notification and tracking of the code review tasks during the entire process. It automatically identifies updated code by scanning the source control system or the local file system, matches the code with designated reviewers and tracks the progress of each review item until closure. This allows teams to establish a bulletproof review process where all new code is reviewed and all identified issues are resolved. There are 2 types of code review work flow in Parasoft dotTest, Pre-commit and post-commit.
- Pre-commit code reviews are for teams who want to review code before adding it to source control.
- Post-commit code reviews are for teams who want to review code once the code is committed to source control. A Code Review Test Configuration is typically scheduled to run automatically on a regular basis (for example, every 24 hours). It scans the designated source control repository to identify code that requires review, then sends this information to the Team Server that then distributes it to the designated reviewer.
Pre-Commit |
Post-Commit |
Avoids breaking the nightly build |
Good option for experienced and seasoned developers |
Less restrictive. Gives the freedom to create the tasks as needed, for example comments do not need review |
Restrictive: Automatically creates a Code review task during the nightly build |
More flexible: Sets the reviewer of choice. |
Less flexible: Uses the config file to assign the tasks to reviewer. |
Code changes may get lost as not committed to a repository. |
Good option when teams are in various geographies. Local code changes may get lost |
Procedure to install Parasoft dotTest and configure it.
- Get the latest dotTest setup and Install it. It will automatically integrate with VS2008, VS2010 or VS2012.
- Open VS2012. In the toolbar, Parasoft -> Preferences. Activate the license as shown in the image below:
Figure 1: Activate License
- Set up the source control settings as shown below. Here the Source Control is SVN. (Ensure the path to svn.exe is correct.)
Figure 2: Source Controls
The Parasoft dotTest is configured now to be used.
Procedure for Pre-Commit Code Review
- Open Visual Studio 2012 and open a project in SVN.
- In VS2012 "Parasoft" -> Test Configurations -> Build-in -> Code Review -> Pre-Commit -> Right-click -> Duplicate.
- Create a "Pre-commit-Swapnil" as highlighted in the figure below.
Figure 3: Pre-commit-Swapnil
- Go to the Code Review tab and add the Authors (the developer name), Reviewers (who reviews the code), Auditors (Super user like Manager, who oversees the entire process).
- Modify the code and build the solution.
- Go to Parasoft -> Test Configurations. Go to the Code–review task and "Run Test". This will open a window as shown below. Add the details as shown.
Figure 4: Set Custom Roles
- Go to Parasoft -> Show View -> Quality Task -> Code review button. This will show all the Code Review tasks as shown below.
Figure 5: Code Review
- The task is created for the Reviewer.
Step for Reviewer for Code Review
- After the Author modified the code in the “pre-commit" task. The Reviewer should be able to review it.
- Open VS2012. Click Parasoft -> Show view -> Quality task -> Import from Team Server.
- The reviewer should get the Code review task visible. He can review the code and put in his comments. He can either "Accept" or mark "To fix".
- This will send the notification back to the Author, once he does the Parasoft -> Show view -> Quality task -> Import from Team Server.
I hope this article will help you getting started with the Automated Code Review using Parasoft dotTest.