Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add new Test Run to a Test Plan #27

Open
bdfariello opened this issue Nov 13, 2017 · 2 comments
Open

Cannot add new Test Run to a Test Plan #27

bdfariello opened this issue Nov 13, 2017 · 2 comments

Comments

@bdfariello
Copy link

Hi,

Inside a milestone, I am doing the following:

  1. Create a new Test Plan.
  2. Create a new Test Run
  3. Configure the new Run with a Suite ID, a Milestone ID, an Assigned To ID, and a Plan ID (the one from the created plan)
  4. I log the pre-created Run object (using log4j2) and see it has the expected Plan ID
  5. I create the run.
  6. I log the Run object (post-creation), and see it now has a 'null' Plan ID
  7. Looking in TestRail, I see the Plan and Run side-by-side, rather than the Test Run being found inside the Test Plan.

Code:

    int milestoneId = 131;
    Plan plan = new Plan();
    UI_TEST_PLAN = "HTML_UI";
    plan.setName(UI_TEST_PLAN);
    plan.setMilestoneId(milestoneId);
    Plan responsePlan = TR.plans().add(projectId, plan).execute();
    LOGGER.info("Created new plan: {}. Full: {}", responsePlan.getId(), responsePlan);
    List<Suite> suites = TR.suites().list(projectId).execute();
    for (Suite suite : suites) {
        if (suite.getName().startsWith("UI")) { // expected one is named UI-Suite in this testrail sandbox
            Run run = new Run();
            run.setSuiteId(suite.getId());
            run.setPlanId(responsePlan.getId());
            run.setMilestoneId(milestoneId);
            run.setAssignedtoId(ROBOT_USER_ID);
            LOGGER.info("Pre-created run: {}", run);
            Run createdRun = TR.runs().add(projectId, run).execute();
            LOGGER.info("Created run: {}", createdRun);
            //TODO the test run is created but it's not getting into the test plan
        }
    }

Log4j2 logging, where you can see the Plan ID goes from 4355 pre-creation (which is correct) to null post-creation.

2017-11-13 09:11:25,130  INFO [main] [TestRailAPI] : Created new plan: 4355. Full: Plan(id=4355, name=HTML UI, description=null, url=https://vmturbo.testrail.com/index.php?/plans/view/4355, projectId=2, milestoneId=131, assignedtoId=null, createdOn=Mon Nov 13 09:11:22 EST 2017, createdBy=87, isCompleted=false, completedOn=null, passedCount=0, blockedCount=0, untestedCount=0, retestCount=0, failedCount=0, customStatus1Count=0, customStatus2Count=0, customStatus3Count=0, customStatus4Count=0, customStatus5Count=0, customStatus6Count=0, customStatus7Count=0, entries=[])
2017-11-13 09:11:46,657  INFO [main] [TestRailAPI] : Pre-created run: Run(id=0, name=null, description=null, url=null, projectId=0, planId=4355, suiteId=298, milestoneId=131, assignedtoId=87, includeAll=null, caseIds=null, createdOn=null, createdBy=0, isCompleted=false, completedOn=null, config=null, configIds=null, passedCount=0, blockedCount=0, untestedCount=0, retestCount=0, failedCount=0, customStatus1Count=0, customStatus2Count=0, customStatus3Count=0, customStatus4Count=0, customStatus5Count=0, customStatus6Count=0, customStatus7Count=0)
2017-11-13 09:12:34,200  INFO [main] [TestRailAPI] : Created run: Run(id=4356, name=UI-Suite, description=null, url=https://vmturbo.testrail.com/index.php?/runs/view/4356, projectId=2, planId=null, suiteId=298, milestoneId=131, assignedtoId=87, includeAll=true, caseIds=null, createdOn=Mon Nov 13 09:12:22 EST 2017, createdBy=87, isCompleted=false, completedOn=null, config=null, configIds=[], passedCount=0, blockedCount=0, untestedCount=1, retestCount=0, failedCount=0, customStatus1Count=0, customStatus2Count=0, customStatus3Count=0, customStatus4Count=0, customStatus5Count=0, customStatus6Count=0, customStatus7Count=0)

Screenshot showing correct milestoneId in URL bar (131), correct plan ID at the bottom left from hovering over the Plan link (4355), and showing the Test Run created outside the plan anyway.
run created outside of plan

Lastly, we're using a hosted TestRail version. Checking for updates says we're using the latest version, which is:

TestRail version | 5.4.0.3660 (check for update)

@yuriy-khortashko
Copy link

I have faced the same issue.
Entry, not Run should be added to Test Plan.
This code works for me:

        Plan.Entry.Run run = new Plan.Entry.Run();
        run.setName("AQA test");
        Plan.Entry entry = new Plan.Entry()
                .setRuns(Arrays.asList(run));
        entry.setSuiteId(suiteId);
        testRail.plans().addEntry(testPlanId, entry).execute();

@jshtaway
Copy link

how do you give this new entry a name!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants