0

I'm using HP Quality Center version 11.52, and I am tasked with copying a series of graphs, or AnalysisItems, as their official name is. I have not found any way to retrieve the graph display data directly from the AnalysisItem, so my approach is to extract the filter in these AnalysisItems, and copy/refine them into working REST-calls, or URLs. This works in most cases, but I am having trouble with chained joins. Here is an example filter from one of the AnalysisItems, as found in configurations tab, and filter text box:

Filter: Test: Project["My Project"]; 
Cross Filter: <Cross Filter Test Instance-Test Set>Test Set Folder[^Root\My Path\My Project\My Tests^]

Here, there are two filter clauses, separated by ';'

  1. I can easily find test instances under the project, by name. It goes like this:

    .../test-instances/?query={test.user-18["My Project"]}
    

of course, this requires that we use the user-18 field for storing project name, which is a logical partision used in my company, within the defined Projects that is a QC entity.

  1. However, if I want to cross filter these found test instances, with instances found only within the test sets within a specific folder, i would have to do a chained join, which I expected might be written something like this:

    .../test-instances/?query={test.user-18["My Project"];
    test-set.test-set-folder.name["^Root\My Path\My Project\My Tests^"]}
    

however, this gives me an error, stating that "Entity: test-set does not have a field named: test-set-folder.name. Now I knew that, but I hoped that it would understand that the part before the last punctuation mark, was also a relation. It doesn't.

Ive also tried:

.../test-instances/?query={test.user-18["My Project"];
test-set[test-set-folder.name["^Root\My Path\My Project\My Tests^"]]}

but nested square brackets doesn't work either.

Lastly I tried a syntax I've seen in the database in "filter-data", and it looked like this:

.../test-instances/?query={test.user-18["My Project"];
test-set[x]test-set-folder.name["^Root\My Path\My Project\My Tests^"]}

This is not allowed either.

I feel pretty confident that what I want to achieve is possible, but the documentation is not being very helpful. I reckon if it is possible to set in the filter in an AnalsisItem inside QC's user interface, it should be possible in the REST-API as well. I have tried extensively searching the API, but it is either not possible, or very hard to find in the documentation.

Can anyone help me with the correct syntax, if any, here?

jumps4fun
  • 3,994
  • 10
  • 50
  • 96
  • I don't think you can pass a complete path of a folder in `test-set-folder.name=^Root\My Path\My Project\My Tests^` the reason simply is each folder name is stored with a different ID in the database and there is no easy way for the RESTAPI to iterate over the tree of folders to find the right ID to continue. – Barney Feb 01 '17 at 15:47
  • You are right. I realized that folder names does not include paths, so that is my approach as of now. It seems strange though, that the filter data cannot be directly used to refine a single call. – jumps4fun Feb 01 '17 at 16:16
  • 1
    Maybe not easier, but I would go through the path you mentioned and get the latest ID for the folder or the hierarchical path. Then I guess you can use the folder ID to retrieve your data since that is Unique in QC ALM. – Marco smdm Mar 07 '17 at 14:23
  • @Marcosmdm, you really should put that in an answer with some additional explanations on the path structures. – Matthias dirickx May 08 '17 at 10:52
  • @Matthiasdirickx: answer added, hope this clarify a bit more :-) Have a nice day. – Marco smdm May 08 '17 at 13:36

3 Answers3

1
  • In quality center the reports and graphs do not contain data. They are only definitions and they retrieve the data from the DB 'live'.
  • The QC filters that are shown are probably more likely to be the OTA (Open Test Architecture) definitions used to interact with the back-end then it is REST.

But If yo want to collect the test instance data, then you can work your way down from the folder.

Step one: get the folder path

In Quality Center the folder paths are defined by a combination of letters. The folders are built with phrases of three letters. 'AAA' is the root.

'AAA'
   -- 'AAAAAA'
         -- 'AAAAAAAAA'
         -- 'AAAAAAAAB'
         -- 'AAAAAAAAC'
   -- 'AAAAAB'

I do not think it is possible to create an extra folder on the same level as the root folder in the UI itself. So essentially, when no customization has been done, the first three letters will always be 'AAA'.

Building on Marco's comment and my experience, I would create a component to take care of retrieving folders. You will need it when diving into other structures as well, so it will not be a lost effort if you put effort in generalizing it.

Your first search will be on hierarchical path, starting with 'AAA' ( the root folder), and 6 characters long (folder on the second level, your first child to search after). Then take the new Id and repeat until you are at the end of your path identifiers. In your case:

  • My path
  • My project
  • My test

Essentially you walk down the path based on name, and compose the identifier with the letters with a String concatenation. That result can then be used to retrieve the exact folder. The assumption is that there are no two folders with the same name on the same level.

Assuming that these are all the first under the root node, and assuming that you want further descendants as well, we continue the logic with this assumption:

The hierarchical path identified is 'AAAAAAAAAAAA'.

I know I am getting very verbose here, but as a less-techy user in the role of a tester I personally like a little more simple coded steps, then a complex one. Simply because writing dense coding is a poetic art, and I do not master it.

Step two: get all child folders of the requested path

So, to continue: With this hierarchical path we can identify all child folder, and so collect their ids.

This will look something like this:

.../test-set-folders?query={hierarchical-path["AAAAAAAAAAAA*"]}

Step Three: Get the Test sets

With those folder Ids, you can retrieve the test sets desired: Assume that it returns test set folder with ID 1.

.../test-sets?query={parent-id[1]}

Iterate the REST query for each folder ID, collect the test-set IDs.

Step Four: Get the test instances

With the test sets, you can get the test instances and all of the data available with an analogous query.

This was my take on the use of the rest service for such a thing. If you go for retrieving data from QC with the purpose to take snapshots and design your own graphs with the data, I would personally advise to query on the database. With SQL you can make all the connections you want quite easily in the Excel reports.

That does defeat the ease of using the REST API off course. Maybe a simple dedicated client for the database with the specific queries would be a solution?

One last remark for collecting data: when retrieving data for custom charting, I use the 'run' objects as my basis.

  • Runs can give a view over a period time
  • Runs can be linked to all kinds of stuff, and are the actual source of the execution
  • When using instances you need to take snapshots, runs take care of that for you in a way.
Matthias dirickx
  • 141
  • 2
  • 10
  • Hi Matthias, I like your explanation. With this approach only problem I can foresee is in case you have plenty of folders (I have plenty of folders). My approach is basically more simple in the query. You are always getting one folder at time and the load will be less for the client/server. Do you agree? In addition (not sure) if in the new HP version the hierarchical path is getting out of a combination of 4 character AAAA + AAAA+ AAAB and so on.Thanks and have a nice day! – Marco smdm May 08 '17 at 13:44
  • Thanks for the heads up. I'm going to follow your answer. Thanks! – Matthias dirickx May 08 '17 at 14:02
1

Suppose I want to go inside test-set path: Root/System Test/ProgramName/ReleaseName/WeekNumber/ and so on. After you are logged in and able to send REST msg :-)

Below just an example (output coming from my python module) of how I am checking a path and a description of the action:

GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['Root']}

In test-set ask for name Root --> it might be that multiple folder has name Root (I created another on purpose), but your tool should be able to get the real "Root" folder xml.

200 - test-sets folder hierarchy downloaded.
Multiple folder with that name! Found 2 folders with that name!
Root ID found.

GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['System Test'];parent-id['0']}
200 - test-sets folder hierarchy downloaded.
Folder System Test already existing...going ahead in path....

Get now the xml for next step: "System Test" folder name that has parent-id 0.

GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['ProgramName'];parent-id['112']}
200 - test-sets folder hierarchy downloaded.
Folder ProgramName already existing...going ahead in path....

Iterate multiple times same procedure (of course I am not doing this manually)

GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['ReleaseName'];parent-id['113']}
200 - test-sets folder hierarchy downloaded.
Folder ReleaseName already existing...going ahead in path....
GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['SWType'];parent-id['114']}
200 - test-sets folder hierarchy downloaded.
Folder SWType already existing...going ahead in path....
GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['WK18'];parent-id['115']}
200 - test-sets folder hierarchy downloaded.
Folder WK18 already existing...going ahead in path....
GET https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders?query={name['FeatureType'];parent-id['366']}
200 - test-sets folder hierarchy downloaded.

Imagine that at the end of your path you still want to append a new folder:

Folder FeatureType has to be created.
POST https://yourServer.com/qcbin/rest/domains/DomainName/projects/SANDBOX/test-set-folders
201 - test-set-folders created.

From the xml you are getting every time, you are using the parent-id and the folder name you would like to check. This is a unique combination.

After you reach the last step, then you know the ID (and all the description) of the end folder you were looking for. Now you can use that to check all the info you need!! That ID is exactly what you are looking for!

Procedure as I said can be fully automated. Have a nice day and I hope this help you a bit!

Marco smdm
  • 1,020
  • 1
  • 15
  • 25
0

Just a quick answer here, as to what solved most of my issues:

Relations

In the documentation, you can actually find something called relations, which gives you a lot of options very similar to SQL joins, which allows you to get results from one entity, based on values in a chained join-like manner.

jumps4fun
  • 3,994
  • 10
  • 50
  • 96