Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:25:25+00:00 2026-06-12T13:25:25+00:00

I am sending a query to check whether there is a testcaseresult associated with

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:25:26+00:00Added an answer on June 12, 2026 at 1:25 pm

    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:

        // Query for Test Case to which we want to add results
        QueryRequest testCaseRequest = new QueryRequest("TestCase");
        testCaseRequest.setFetch(new Fetch("FormattedID","Name"));
        testCaseRequest.setQueryFilter(new QueryFilter("FormattedID", "=", "TC4"));
        QueryResponse testCaseQueryResponse = restApi.query(testCaseRequest);
        JsonObject testCaseJsonObject = testCaseQueryResponse.getResults().get(0).getAsJsonObject();
        String testCaseRef = testCaseQueryResponse.getResults().get(0).getAsJsonObject().get("_ref").toString();
        String testCaseFormattedID = testCaseQueryResponse.getResults().get(0).getAsJsonObject.get("FormattedID").toString();
    
        // Query for Test Case Results that are associated to this particular Test Case
        QueryRequest testCaseResultsRequest = new QueryRequest("TestCaseResult");
        testCaseResultsRequest.setFetch(new Fetch("Build","TestCase","Verdict","FormattedID"));
        testCaseResultsRequest.setQueryFilter(new QueryFilter("TestCase.FormattedID", "=", testCaseFormattedID));
        QueryResponse testCaseResultResponse = restApi.query(testCaseResultsRequest);
        int numberTestCaseResults = testCaseResultResponse.getTotalResultCount();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In MySQL I have to check whether select query has returned any records, if
I am currently sending a query variable to a php file like this: query
I recently asked this question: Dynamically Query a Database to check for value And
Sending XML from C# Server and receiving it it in Android Java client This
sending mail along with embedded image using asp.net I have already used following but
Sending Email in Android using JavaMail API without using the default/built-in app I'm trying
I need to check that our visitors are using HTTPS. In BasePage I check
I am able to do this query just fine with the test repository which
I have an ajax query sending to a php script and putting the response
I am trying to dynamically generate linqtosql query using LinqKit . I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.