Toolboxcategory cloud |
ViewsPersonal toolsEnhanced Perforce IntegrationFrom Seapine LabsWorks with TestTrack 2008 Works with Perforce 2007.2
[edit] OverviewThis article outlines how to implement a more enhanced integration with Perforce. In some previous examples, we've looked at how to trigger a defect update on P4 submit and prevent P4 submit based on defect status. Here we're going to look at a two-way integration between TestTrack Pro and Perforce that requires no special handling by a user. You'll need:
[edit] DownloadThe download contains the source files and binaries for the application. Download the P4Sync zip file.
[edit] How It WorksThe basic scenario this sample uses is:
To accomplish this, we're going to be modifying your P4 jobspec and adding TestTrack and (optionally) Perforce triggers. Probably not a bad idea to try this out a test server first! [edit] Configure Perforce JobspecWe're going to link jobs with defects, so we need to customize the Perforce jobspec to support storing a defect number. We'll use a field called DefectNum, which requires just one line added to the spec, under the Fields header.
[edit] Configure IntegrationOnce you've re-configured the P4 jobspec, you're ready to get started with the integration. [edit] Create Perforce JobThe first step is to create a job/defect link between the two systems. We'll do this with a TestTrack trigger, so TestTrack is driving the integration. You can configure the trigger in any manner you want, including using multiple triggers. The goal here is to simply create a job in Perforce that links back to the defect that fired the trigger. TestTrack triggers don't allow cmd-line parameters, so first setup a bat file with the following contents
Notice that we're calling the application you just donwloaded, and we only need to send one param which is essentially a flag telling the application to create a job from the defect. Defect information is pulled from environment variables passed to the application at runtime. [edit] Sync Job Fix with DefectThe second piece of the integration requries that we update the defect once the associated job has been "fixed" in Perforce. You can accomplish this in a couple ways, as outlined below. Feel free to use either or both of these methods, as fits your process. [edit] TestTrack TriggerThis trigger will pull the job fix information from Perforce, and update the associated defect. Here you get a one-to-many relationship for defects-to-jobs. An example would be you want to synchronize with job fixes when the defect is marked as Fixed in TestTrack Pro. Setup your batch file.
Notice the flag is now ttsync, so we're telling the application to do something besides create a job. Since we're running as a TestTrack trigger, we can pull most of the information from the environment variables passed to the application at runtime. [edit] Perforce TriggerThis method will push Perforce submits to the associated TestTrack defects. Here we can support a many-to-many relationship for defects-to-jobs. We're going to create a post-commit trigger that calls our script to update TestTrack. The basic syntax here is: <trigger name> change-commit //depot/... <script>
[edit] Tech Details and NotesThis sample was written and tested using Perforce 2007.2 and TestTrack Studio 2008.
|
|




