use of io.irontest.models.HTTPStubMapping in project irontest by zheng-wang.
the class TestcaseDAO method createByImport.
@Transaction
default long createByImport(Testcase testcase, long targetFolderId) throws JsonProcessingException {
if (_nameExistsInFolder(testcase.getName(), targetFolderId)) {
throw new RuntimeException("Duplicate test case name: " + testcase.getName());
}
// insert the test case record
testcase.setParentFolderId(targetFolderId);
long testcaseId = _insertWithName(testcase);
// insert UDPs
for (UserDefinedProperty udp : testcase.getUdps()) {
udpDAO()._insertWithName(testcaseId, udp.getName(), udp.getValue());
}
// insert test steps
for (Teststep teststep : testcase.getTeststeps()) {
teststep.setTestcaseId(testcaseId);
teststepDAO().insertByImport(teststep);
}
// insert data table
dataTableDAO().insertByImport(testcaseId, testcase.getDataTable());
// insert HTTP stubs
for (HTTPStubMapping stub : testcase.getHttpStubMappings()) {
httpStubMappingDAO().insertByImport(testcaseId, stub);
}
return testcaseId;
}
Aggregations