I am unable to add plan entries to a newly created test plan in TestRail using the TestRailSDK.
Steps to Reproduce
Create connection to TestRailService.
Get TestRail project.
Create a new test plan.
Create test plan entry runs.
Create test plan entry.
Add test plan entry to newly created test plan.
Here is the code the you can use to reproduce (Note: I have removed account and project details):
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.rmn.testrail.entity.PlanEntry;
import com.rmn.testrail.entity.PlanEntryRun;
import com.rmn.testrail.entity.Project;
import com.rmn.testrail.entity.TestPlan;
import com.rmn.testrail.entity.TestPlanCreator;
import com.rmn.testrail.service.TestRailService;
public class TestRailSDK {
public static void main(String[] args) {
// Create connection to TestRailService
TestRailService testRailService = new TestRailService(clientId, username, password);
// Get TestRail project
Project project = testRailService.getProjectByName(projectName);
// Create a new test plan
TestPlanCreator testPlanCreator = new TestPlanCreator();
testPlanCreator.setName("Test Plan");
testPlanCreator.setAssignedToId(6);
TestPlan testPlan = testRailService.addTestPlan(project.getId(), testPlanCreator);
// Create test plan entry runs
List<PlanEntryRun> planEntryRuns = new ArrayList<PlanEntryRun>();
List<Integer> case_ids = Arrays.asList(5518,5517);
PlanEntryRun run1 = new PlanEntryRun();
run1.setIncludeAll(false);
run1.setCaseIds(case_ids);
run1.setConfigIds(Arrays.asList(2,7));
run1.setAssignedToId(6);
planEntryRuns.add(run1);
PlanEntryRun run2 = new PlanEntryRun();
run2.setIncludeAll(false);
run2.setCaseIds(case_ids);
run2.setConfigIds(Arrays.asList(3,7));
run2.setAssignedToId(6);
planEntryRuns.add(run2);
// Create test plan entry
PlanEntry planEntry = new PlanEntry();
planEntry.setName("Test Plan Entry");
planEntry.setAssignedToId(6);
planEntry.setSuiteId(14);
planEntry.setIncludeAll(false);
planEntry.setRuns(planEntryRuns);
// Add test plan entry to test plan
PlanEntry addedPlanEntry = testRailService.addTestPlanEntry(testPlan.getId(), planEntry);
System.out.println("Added Plan Entry: " + addedPlanEntry.getName());
}
}
Actual Results
The test plan is created but the plan entries are not added. The following exception being thrown when attempting to print the name of the added plan entry:
Exception in thread "main" java.lang.NullPointerException
at com.transverse.tract.TestRailSDK.main(TestRailSDK.java:51)
I verified that the case IDs are a part of the specified test suite.
I am unable to add plan entries to a newly created test plan in TestRail using the TestRailSDK.
Steps to Reproduce
Here is the code the you can use to reproduce (Note: I have removed account and project details):
Actual Results
The test plan is created but the plan entries are not added. The following exception being thrown when attempting to print the name of the added plan entry:
I verified that the case IDs are a part of the specified test suite.
Here is my test environment: