Search in sources :

Example 1 with Testcase

use of io.irontest.models.Testcase in project irontest by zheng-wang.

the class TestcaseDAO method findById_Complete_NoTransaction.

/**
 * User defined properties are not included.
 * @param id
 * @return
 */
public Testcase findById_Complete_NoTransaction(long id) {
    Testcase result = _findById(id);
    result.setFolderPath(getFolderPath(id));
    List<Teststep> teststeps = teststepDAO().findByTestcaseId(id);
    result.setTeststeps(teststeps);
    return result;
}
Also used : Teststep(io.irontest.models.teststep.Teststep) Testcase(io.irontest.models.Testcase)

Example 2 with Testcase

use of io.irontest.models.Testcase in project irontest by zheng-wang.

the class FolderResource method importTestcase.

@POST
@Path("{folderId}/importTestcase")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@PermitAll
public Testcase importTestcase(@PathParam("folderId") long folderId, @FormDataParam("file") InputStream inputStream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) throws IOException {
    ObjectMapper objectMapper = new ObjectMapper();
    Testcase testcase = objectMapper.readValue(inputStream, Testcase.class);
    long testcaseId = testcaseDAO.createByImport(testcase, folderId);
    Testcase result = new Testcase();
    result.setId(testcaseId);
    return result;
}
Also used : Testcase(io.irontest.models.Testcase) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) PermitAll(javax.annotation.security.PermitAll)

Example 3 with Testcase

use of io.irontest.models.Testcase in project irontest by zheng-wang.

the class TestcaseRunResource method create.

@POST
@Path("testcaseruns")
@PermitAll
@JsonView(ResourceJsonViews.TestcaseRunResultOnTestcaseEditView.class)
public TestcaseRun create(@QueryParam("testcaseId") long testcaseId) throws IOException {
    Testcase testcase = testcaseDAO.findById_Complete(testcaseId);
    TestcaseRunner testcaseRunner;
    if (testcase.getDataTable().getRows().isEmpty()) {
        testcaseRunner = new RegularTestcaseRunner(testcase, utilsDAO, testcaseRunDAO, wireMockServer);
    } else {
        testcaseRunner = new DataDrivenTestcaseRunner(testcase, utilsDAO, testcaseRunDAO, wireMockServer);
    }
    return testcaseRunner.run();
}
Also used : RegularTestcaseRunner(io.irontest.core.testcase.RegularTestcaseRunner) Testcase(io.irontest.models.Testcase) TestcaseRunner(io.irontest.core.testcase.TestcaseRunner) DataDrivenTestcaseRunner(io.irontest.core.testcase.DataDrivenTestcaseRunner) RegularTestcaseRunner(io.irontest.core.testcase.RegularTestcaseRunner) DataDrivenTestcaseRunner(io.irontest.core.testcase.DataDrivenTestcaseRunner) JsonView(com.fasterxml.jackson.annotation.JsonView) PermitAll(javax.annotation.security.PermitAll)

Example 4 with Testcase

use of io.irontest.models.Testcase in project irontest by zheng-wang.

the class TestcaseDAO method findById_Complete.

@Transaction
default Testcase findById_Complete(long id) {
    Testcase result = _findById(id);
    result.setFolderPath(getFolderPath(id));
    List<UserDefinedProperty> udps = udpDAO().findByTestcaseId(id);
    result.setUdps(udps);
    List<Teststep> teststeps = teststepDAO().findByTestcaseId_Complete(id);
    result.setTeststeps(teststeps);
    DataTable dataTable = dataTableDAO().getTestcaseDataTable(id, false);
    result.setDataTable(dataTable);
    List<HTTPStubMapping> httpStubMappings = httpStubMappingDAO().findByTestcaseId(id);
    result.setHttpStubMappings(httpStubMappings);
    return result;
}
Also used : Teststep(io.irontest.models.teststep.Teststep) DataTable(io.irontest.models.DataTable) HTTPStubMapping(io.irontest.models.HTTPStubMapping) UserDefinedProperty(io.irontest.models.UserDefinedProperty) Testcase(io.irontest.models.Testcase) Transaction(org.jdbi.v3.sqlobject.transaction.Transaction)

Example 5 with Testcase

use of io.irontest.models.Testcase in project irontest by zheng-wang.

the class TestcaseDAO method findById_TestcaseEditView.

@Transaction
default Testcase findById_TestcaseEditView(long id) {
    Testcase result = _findById(id);
    if (result != null) {
        List<Teststep> teststeps = teststepDAO().findByTestcaseId_TestcaseEditView(id);
        result.setTeststeps(teststeps);
    }
    return result;
}
Also used : Teststep(io.irontest.models.teststep.Teststep) Testcase(io.irontest.models.Testcase) Transaction(org.jdbi.v3.sqlobject.transaction.Transaction)

Aggregations

Testcase (io.irontest.models.Testcase)8 Transaction (org.jdbi.v3.sqlobject.transaction.Transaction)4 Teststep (io.irontest.models.teststep.Teststep)3 PermitAll (javax.annotation.security.PermitAll)3 JsonView (com.fasterxml.jackson.annotation.JsonView)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DataDrivenTestcaseRunner (io.irontest.core.testcase.DataDrivenTestcaseRunner)1 RegularTestcaseRunner (io.irontest.core.testcase.RegularTestcaseRunner)1 TestcaseRunner (io.irontest.core.testcase.TestcaseRunner)1 DataTable (io.irontest.models.DataTable)1 Folder (io.irontest.models.Folder)1 HTTPStubMapping (io.irontest.models.HTTPStubMapping)1 UserDefinedProperty (io.irontest.models.UserDefinedProperty)1