I am sending a query to check whether there is a testcaseresult associated with a testcase. I am using this:
QueryRequest c = new QueryRequest("testcaseresult");
c.setFetch(new Fetch("testcase"));
c.setQueryFilter(new QueryFilter("testcase", "=", testCaseRef));
QueryResponse cc = r.query(c);
//String testresultRef = cc.getResults().get(0).getAsJsonObject().get(“_ref”).toString();
I want to create a new testcaseresult only if there is no testcaseresult in the testcase so far. how can i use the query to do it?
Thank you.
I think you’re on the right track in doing a followup Query. You can’t query on Ref’s however. However since you have the ref, and presumably also have the TestCase JsonObject, you could do something like the following where you would query on the FormattedID of the parent TestCase: