Search in sources :

Example 1 with TestRunContainer

use of org.apache.ofbiz.testtools.TestRunContainer in project ofbiz-framework by apache.

the class RunTestEvents method runTest.

public static String runTest(HttpServletRequest request, HttpServletResponse response) throws ContainerException {
    String component = request.getParameter("compName");
    String suiteName = request.getParameter("suiteName");
    String caseName = request.getParameter("caseName");
    String result = null;
    List<StartupCommand> ofbizCommands = new ArrayList<StartupCommand>();
    if (caseName == null) {
        ofbizCommands.add(new StartupCommand.Builder("test").properties(UtilMisc.toMap("component", component, "suitename", suiteName)).build());
    } else {
        ofbizCommands.add(new StartupCommand.Builder("test").properties(UtilMisc.toMap("component", component, "suitename", suiteName, "case", caseName)).build());
    }
    TestRunContainer testRunContainer = new TestRunContainer();
    testRunContainer.init(ofbizCommands, "frontend test run", "   ");
    if (testRunContainer.start() == false) {
        result = "error";
    } else {
        result = "success";
    }
    return result;
}
Also used : StartupCommand(org.apache.ofbiz.base.start.StartupCommand) TestRunContainer(org.apache.ofbiz.testtools.TestRunContainer) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 StartupCommand (org.apache.ofbiz.base.start.StartupCommand)1 TestRunContainer (org.apache.ofbiz.testtools.TestRunContainer)1