ELM-Python-Client icon indicating copy to clipboard operation
ELM-Python-Client copied to clipboard

Query for all qm components on a GC

Open sergiomarsen opened this issue 4 months ago • 15 comments

Hello!

We are trying to get all testcases from a qm project. This project is configuration management enabled and has more than one components. All this components are contributing to a GC.

We are trying to query to this qm project with the GC project and GC stream, and the query works but only extracts the testcases from the default component.

Do you know if is there a way to extract test cases from all the components or any workaround to deal with this?

Thanks a lot in advance!

sergiomarsen avatar Feb 16 '24 10:02 sergiomarsen

Running oslcquery on a QM project with three components all contributing to a GC, specifying a GC project and configuration, I get results for test cases from all three components.

My commandline is

oslcquery -A qm,gc -G "SGC Production Stream" -O testcases.csv -p "SGC Quality Management" -E "SGC GC" -s *

Where:

  • -A specifies the context roots for qm and gc
  • -G specifies the GC stream name
  • -O specifies the csv file name
  • -p specifies the QM project name
  • -E specifies the GC project name
  • -s * selects all properties to be returned

This gets 36 results - one component has 30 test cases, the second has 3 and the third component also has 3.

So AFAICT oslcquery does what you're looking for, at least with 7.0.2 SR1 iFix025

What version+ifix are you using,

What's your commandline?

barny avatar Feb 16 '24 12:02 barny

Similarly querying for test plans by adding option -r TestPlanQuery I get 4+1+1 test plans from the three components

barny avatar Feb 16 '24 12:02 barny

Are you on the most recent version of elmclient? oslcquery shows the version when it runs, should be 0.26.2 I think.

barny avatar Feb 16 '24 14:02 barny

Here's a gotcha that might have got you - by default oslcquery caches responsed from the server for 7 days for everything except the query itself, which can cause problems when important things change - if you put option -W at the end of your commandline that will clear the cache at startup so everything will be retrieved at least once, which can work around important things having changed. Or use -WW to disable caching completely.

barny avatar Feb 20 '24 16:02 barny

Hello, Thanks for the interest @barny , sorry didn't see the responses until now.

I confirmed I was using a bit old version from elm client, so upgraded it and followed your recommendation using -WW

However I can see this 2 issues:

  1. While among all modules have a total of 1828 test cases (during the query seems to read them somehow) it finally only retrieves 540 entries. See pic below: image

(Also tried using --pagesize 0 but exactly same result,

  1. I have detected that the $uri attribute extracted only redirects to the qm test case for the default component, for the other extracted test cases the uri displays this error: AQXCM5008E The operation cannot be completed because the resource, https://****/qm/oslc_qm/contexts/_LRxjELO9Ee6SC_2Ft2FkkQ/resources/com.ibm.rqm.planning.VersionedTestCase/_Hs5UA8UJEe6uXKS9QbuYYQ, was not found.

Actually, what more disturb me now is the second point about the uris, as this is also happening also quering component by component (despite for default one). Have you ever experienced a similar issue? Thanks in advance!

sergiomarsen avatar Mar 12 '24 11:03 sergiomarsen

Your (2) is straightforward - the URI needs to be used with the configuration URL added to specify the test case fully, otherwise if you don't provide a configuration the uri is searched for in the default configuration in the default component and not found because it's not in that config. Same for RM artifact uris. The default config is the 'initial stream' of the original component of the project. Be aware that the default configuration can be archived so don't rely on URIs without configuration always working. You could modify the code that saves the result to add a column with the full uri-in-configuration like: URI?oslc_config.context=CONFIGURI

For (1) there was a defect in DN which had a similar effect of varying numbers of results but only when paging was in used, that's why by default paging is now disabled just like --pagesize 0. I don't have large ETM data to try reproduce this. If you're using -s * then try being more selective, does that change things? If you can get to a single query which shows varying numbers of results then you could create a support case? But get it to a query where you coan use the URL in a browser rest client (with headers) and see varying numbers of results, so you eliminate any possibility of elmclient being part of the problem.

barny avatar Mar 12 '24 14:03 barny

oslcquery -A qm,gc -G "SGC Production Stream" -O testcases.csv -p "SGC Quality Management" -E "SGC GC" -s *

hi, would you please provide an example to get Testcases just for specific component? I know we need to use local configuration, but after reading documentation I dont find the proper combination of flags. this thread provided the most helpful information so far.

If you wish, I can afterwards contribute to the project putting such examples to the README.

Thanks in advance!

ukuko avatar Apr 10 '24 13:04 ukuko

For an ETM project "SGC Quality Management", in component "SGC MTM" for (local) configuration "SGC MTM Production stream" this will get all the testcases:

oslcquery -A qm -p "SGC Quality Management" -C "SGC MTM" -F "SGC MTM Production stream" -O testcases.csv -s *

barny avatar Apr 10 '24 16:04 barny

somehow your suggestion above didnt work for me and I get the usual error: (I have to add that, as in this thread, we need to query with the GC project and GC stream)

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://abcd.com/qm/oslc_config/resources/com.ibm.team.vvc.Component

ukuko avatar Apr 10 '24 16:04 ukuko

Are you using the most recent elmclient version 0.26? Which version of Python, is it from python.org? What version+ifix of ELM are you using?

I've found a defect in ETM 7.0.2, resolved in 7.0.3, which causes this sort of error when you aren't a member of the project - can you check if you're a member? If this is the problem then until you can upgrade to 7.0.3 the only really practicable workarounds are to be made a member of the project, or to get JazzAdmin privilege.

we need to query with the GC project and GC stream

Why? If you query in a GC context oslcquery will give you results from that GC context's contributions, i.e. not just one contribution/component.

barny avatar Apr 11 '24 07:04 barny

we are using: client: python: 3.10.12 (running in WSL) elmclient: 0.26.2

we run the query with user which is a member of the project and has following roles: Tool Administrator, Configuration Lead, Test Engineer, Test Lead, Tester

ETM: 7.0.2 SR1 -> is this then the issue?

ukuko avatar Apr 12 '24 07:04 ukuko

ETM: 7.0.2 SR1 -> is this then the issue?

If you're a project member then that defect shouldn't be the problem. Sorry I don't have any idea what else might be going wrong.

barny avatar Apr 12 '24 12:04 barny