-
Notifications
You must be signed in to change notification settings - Fork 56
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
How to update CustomFields #71
Comments
Hello, /**
* Dynamic creation of the test cases
*/
private static int createTestCase(String testTitle, String testJiraRef, Section section) {
Case testCase = new Case();
testCase.setTitle(testTitle.toLowerCase().trim());
testCase.setSectionId(section.getId());
testCase.setRefs(testJiraRef);
java.util.List<CaseField> caseFields = testRail.caseFields().list().execute();
setCustomFields(testCase, Map.of(
"CustomField1","field value 1"),
"CustomField2", "field value 1"),
"CustomField3", "field value 1"));
testCase = testRail
.cases()
.add(section.getId(), testCase, caseFields)
.execute();
log.info("Created test case {}", testCase);
return testCase.getId();
} Hope this helps. |
Thank you for that, really helpful, could you please provide content of the 'setCustomField' method? Regards |
Hello, implementation of private static Case setCustomFields(Case caseToUpdate, Map customFields) {
Set fieldNames = getCustomFields().stream().map(field->field.getName()).collect(Collectors.toSet());
if (fieldNames.containsAll(customFields.keySet())) {
caseToUpdate.setCustomFields(customFields);
}
else
log.error("Could not update custom fields for case {}", caseToUpdate.getId());
return caseToUpdate;
} implementation of private static List<CaseField> getCustomFields() {
return testRail.caseFields().list().execute();
} The private static TestRail testRail;
public static void initTestRail(){
// create a TestRail instance
testRail = TestRail
.builder(TEST_RAIL_ENDPOINT,"user name", "password")
.applicationName("TOOLBOX_TEST_RAIL_BOT").build();
} |
Hello, I am struggling to understand how to update CustomFields, when creating new TestCase
Now I know that my customCaseFields, contains field called 'steps' (index 1 in the list)
How can I set value for this custom field when adding new test case?
The text was updated successfully, but these errors were encountered: