Introduction
Recently our organization adopted BugZilla as the bug tracking system and we needed to shift lots of bugs from one local bug tracking system to BugZilla. I Googled a little for such a utility providing a feature for importing bugs from outside the system in any format. But I didn't find such a handy utility to meet my requirements. This custom utility will help BugZilla users having a requirement for importing lots of bugs to the system. They can also make the enhancements with the current utility to meet their requirements in the process of importing bugs.
Requirements
The basic requirements for this utility to run are bugzproxy-0.2.0 and xml-rpc.net.2.1.0. You can download both of them from Google code:
- bugzproxy-0.2.0: BugZProxy basically used to communicate with BugZilla system. It provides a class library to work with BugZilla's entity like Server, Bug, Product, etc.
- xml-rpc.net.2.1.0: XML-RCP basically used by the BugZProxy internally to call the BugZilla's Web services & methods to perform actions like CreateBug, Login, AppendComment, etc.
Along with this, if you are a non-technical person and directly using this utility to import your bugs from EXCEL file to BugZilla system, you need to have your Excel file in a given specific format so that this utility can read it properly.
Excel files need to have the following named columns in it, and possible values to those columns are written in parenthesis. Some column's values must match your BugZilla's configured values. I am using values which are configured in my system.
- Priority (P1, P2, P3, P4, P5)
- Severity (cosmetic, critical, major, minor, normal)
- FixBy (version name of your BugZilla's product)
- Resolved By (any user name of BugZilla system)
- Comments (This is the field used for additional comment if any user has posted after the bug has been created (not in BugZilla but in any other system). You can keep it empty if not used.)
- ReproSteps (This field will map to the Description field of BugZilla's system.)
- Title (This field will map to the Summary field of BugZilla's system.)
One more thing with the given Excel file is that the name of your worksheet from which you are importing bugs, must be "Bugs".
If you are a technical person, you can customize code to meet your Excel format.
Notes: While creating the bugs, some assumptions have been made with the bug details. Some of them are listed below:
- OperatingSystem has been defaulted to "Windows"
- Platform has been defaulted to "Other"
- Status has been defaulted to "NEW"
- targetMilestone has been defaulted to "---"
Using the Code
This whole implementation is pretty simple VB.NET code to use the above mentioned class library functions.
BugZProxy's Server
class is used to programmatically login to the BugZilla system with the supplied credentials.
Dim oServer As New Server(ServerName.Text.ToString, Port.Text.ToString, _
Path.Text.ToString,False,Nothing)
oServer.Login(UserName.Text.ToString, Password.Text.ToString, True)
Then we may have multiple products within a single BugZilla system, so we will find the supplied product from the list to import bugs to that product.
Dim iIDs() As Integer = oServer.GetAccessibleProductIds()
Dim oProducts() As Product = oServer.GetProducts(iIDs)
Dim iID As Integer = 0
For Each objProd As Product In oProducts
If objProd.Name = ProductName.Text.ToString Then
iID = objProd.Id
End If
Next Dim oProduct As Product = oServer.GetProduct(iID)
After getting the product, we will fill the dataset from the Excel file - that is simple OLEDB code, so I haven't mentioned it here.
A final call to CreateBug()
method will create the bug in the system and return that bug's reference.
oBug = oProduct.CreateBug("", ComponentName.Text.ToString, objDR("FixBy"), _
"Windows", "Other", objDR("Title"), strTemp, objDR("Priority"), _
objDR("Severity"), "NEW", "---", objDR("ResolvedBy"), Nothing, _
QAContactName.Text.ToString)
History
- 3rd December, 2008: Article created