testcase.getSuccessor() always null.

Fabian Tietz, modified 10 Years ago.

testcase.getSuccessor() always null.

Youngling Posts: 9 Join Date: 8/9/13 Recent Posts
Hi,

it seems testcase.getSuccessor always returns null with the Version 3.8.2 - Build 66 (2013-09-12 13:26:53)
I think this was working before, with the older build we previously tested.

StringBuffer query = new StringBuffer();
query.append("select tc from KlarosTestCase tc");
List<KlarosTestCase> alltc = context.executeQuery(query.toString());
alltc=alltc.findAll { ((it.name == "TC00004") &&(it.getSuccessor()==null)) };

alltc still contains a list of all revisions for this Testcase.

Regards,

Fabian.
thumbnail
Torsten Stolpmann, modified 10 Years ago.

RE: testcase.getSuccessor() always null.

Jedi Council Member Posts: 755 Join Date: 2/12/09 Recent Posts
Hi Fabian,

your query will indeed return a list of all test case revisions in all projects. I see no reasons why this behavior should have changed for 3.8.2.

It is probably a good idea to use a where clause like shown below:

select tc from KlarosTestCase tc where tc.configuration.name='P0001' and tc.successor is null

Hope this helps.

Regards,

Torsten
Fabian Tietz, modified 10 Years ago.

RE: testcase.getSuccessor() always null.

Youngling Posts: 9 Join Date: 8/9/13 Recent Posts
OK, i wasn't aware of the fact, that the query executes on all projects, not on the selected one.
Is there a way to get the currently active Project from a groovy script?

The query below still returns 428 Testcases, the total number shown on the projects page for
the "P00001" project is 409. Getting the head revisions works.

I have still several testcases duplicated in the list, both having the same
name, shortname and revision now, hence the difference.

Regards,
Fabian.
thumbnail
Torsten Stolpmann, modified 10 Years ago.

RE: testcase.getSuccessor() always null. (Answer)

Jedi Council Member Posts: 755 Join Date: 2/12/09 Recent Posts
Sure: context.getActiveProject() is your friend, which documented here: http://www.klaros-testmanagement.com/files/doc/html/User-Manual.Appendix.Report.html

In case you have not seen it yet: The example in our Report Tutorial also uses this method amongst other hopefully useful information.

Regards,

Torsten