I want to create a two way relationship between test cases and requirements in MediaWiki using Semantic MediaWiki. Specifically, I have test cases which include this property:

This test covers requirements [[RequirementID::Requirement 12345]], [[RequirementID::Requirement 54321]].

Then I have a query like this:

{{#ask:format="table"|[[Category:Test case] |?RequirementID}}

This enables me to list all the test cases and their matching requirements, a one to many relationship in a table. E.g.

  • test case 1 covers requirements 12345, 54321
  • test case 2 covers requirements 12323, 22340
  • etc

Now what I want is also to show the mapping from requirements to test cases (so the opposite relationship), e.g.

  • requirement 12345 is tested by test cases 1, 2 and 3.

I'm trying to solve it using compound queries like this:

{{#compound_query:[[Category:Requirement]];?Description || [[Category:Test design]]; |format=table}}

or this, which works but I want the page title, not the Description

{{#ask:format="table"|[[Category:Requirement]] |?Description}}

But this just lists all requirements and all test cases. Anyone know how to solve this?

I have MediaWiki 1.17.0 and Semantic Bundle Version 2011-08-24.20110824.

Update: I think there may be a way to do it using something like this:


That is, using WhatLinksHere to get all the test case pages from the Requirements category. But I cannot get the syntax right.

  • I'm not getting many views and I'd really like help with this. If anyone can suggest help with phrasing the question to get more attention, I'd be grateful. Dec 7, 2011 at 12:19

1 Answer 1


Well, I am not sure you really need that. I do something similar and at the beginning I was also looking for a way to create the back relation but now I do not thing I need that.

You just need 2 pages, one for "Testcase XYZ" and one for "Requirement 12345".

In your page Testcase XYZ you already listed all requirements associated to you test case. So now you just need in your page "Requirement 12345" to see all Testcases related to your Requirement 12345:

{{#ask:format="table"|[[Category:Test case] |?RequirementID}}

Is this way not a solution for you?

  • Thanks, but no, that's already in the question! :) I see though that I need to make the question more clear. Mar 13, 2012 at 11:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.