1

Using Rally's rest API in C#, I have been trying to create a query that will find a test case that contains the character "+". When I create a test case using the API, the + sign makes it into the project without issue and is displayed correctly. When I then perform a query to find the test case with the "+" in the name, nothing is returned. I noticed when debugging that the query operator is converting from "+" to "%2B" and does not return a result that matches the test case name. How can I get my query to find test case names that contain the "+" sign? Additionally, I cannot seem to get test cases that contain the following characters to be found either: &, #, %, “”. My code for the query request:

string testName = "Example+";

  Request requestTC = new Request("TestCase");
        requestTC.Project = rallyProjectRef;
        requestTC.ProjectScopeDown = false;
        requestTC.ProjectScopeUp = false;
        requestTC.Fetch = new List<string> { "Name", "ObjectID", "TestFolder" };
        requestTC.Query = new Query("Name", Query.Operator.Equals, testName);
        bool noMatchesFound = true;
            QueryResult findTCMatchQueryResult = m.myRestApi.Query(requestTC);
  • Look up URL Encoding: http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters – Belogix May 15 '14 at 13:28

1 Answers1

0

True, this does not work:

testcaseRequest.Query = new Query("Name", Query.Operator.Equals, "Example+");

Per this post, + sign in the query string is URL-decoded to a space. %2B in the query string is URL-decoded to a + sign.

However this does not work either:

 testcaseRequest.Query = new Query("Name", Query.Operator.Equals, "Example%2B");

I submitted a defect DE21028. Fixed defects appear on what's new page.

Community
  • 1
  • 1
nickm
  • 5,936
  • 1
  • 13
  • 14