01-10-2014 09:33 AM
I have used regular expression while fetching defect details from QC using OTA script, but getting err message.
please find the below code for reference
Set tdc = CreateObject("tdapiole80.tdconnection")
tdc.login "tester", "pwd"
tdc.Connect "project", "Releases"
Set BugFact = tdc.BugFactory
Set BugFilter = BugFact.Filter
BugFilter.Filter("BG_STATUS") = "Closed"
BugFilter.Filter("BG_PROJECT") = "'testproject'"
'BugFilter.Filter("BG_DETECTED_IN_RCYC") = "^Releases\2013\UAT Test^" - actual value
'using regular expression
BugFilter.Filter("BG_DETECTED_IN_RCYC") = "*UAT Test*"
Set BugList = BugFilter.NewList
Getting error message in the highlighted line. please help me on this.
Basically my aim is to identify the defect count in each phase(UAT, Unit testing, Integratin testing, etc ) for the project. plesae let me knw, if there are any other ways to achieve the same.
01-14-2014 01:27 AM
If the filter causes an error from the GUI, then it won't work from the API. I haven't found a way of using wildcard in paths like this in QC. I think the reason is BG_DETECTED_IN_RCYC does not actually contain a path, but an integer referring to the ID of the cycle.
I guess what you will have to do is to iterate over the cycles and check their names. Then you can get the full path of them using the Path property, and the concatenate the paths with ORs in your filter condition.
[Please do not contact me off line for receiving support. Use the forum!]
01-14-2014 02:17 AM
The BG_DETECTED_IN_RCYC does not actually contain the name but the ID as Jan indicated. You could however get the list of ID from the CycleFactory of a certain Release.
Example from API Documentation: ("Get filtered releases under a specified folder" example)
Set FolderFilter = relFactory.Filter
RelName = "Release*" 'Release 1, Release to QA, Release1.1, and so on.
'Get the list of the Releases in the folder that
' match "Release*"
FolderFilter.Filter("REL_NAME") = RelName
Set listOfReleases = FolderFilter.NewList
You could get the ID list also using the API's Command object and running SQL something like below:
SELECT RCYC_ID, RCYC_NAME FROM RELEASE_CYCLES WHERE RCYC_NAME like '%UAT Test%'
This list of IDs could be then used in API filter.
Note: usage of Command object is only allowed for admin users by default. This can be change by Site Configuration however.