Search in sources :

Example 41 with TestCaseStep

use of org.cerberus.crud.entity.TestCaseStep in project cerberus-source by cerberustesting.

the class LoadTestCaseService method loadTestCase.

@Override
public void loadTestCase(TestCaseExecution tCExecution) {
    TestCase testCase = tCExecution.getTestCaseObj();
    String test = testCase.getTest();
    String testcase = testCase.getTestCase();
    List<TestCaseCountry> testCaseCountry = new ArrayList<TestCaseCountry>();
    List<TestCaseCountryProperties> testCaseCountryProperty = new ArrayList<TestCaseCountryProperties>();
    List<TestCaseStep> testCaseStep = new ArrayList<TestCaseStep>();
    List<TestCaseStep> PretestCaseStep = new ArrayList<TestCaseStep>();
    /**
     * Get List of PreTest for selected TestCase
     */
    LOG.debug("Loading pretests for " + tCExecution.getCountry() + tCExecution.getTestCaseObj().getApplication());
    List<String> login = this.testCaseStepService.getLoginStepFromTestCase(tCExecution.getCountry(), tCExecution.getTestCaseObj().getApplication());
    /**
     * Load Steps of PreTest
     */
    if (login != null) {
        for (String tsCase : login) {
            TestCaseCountry preTestCaseCountry = factoryTestCaseCountry.create("Pre Tests", tsCase, tCExecution.getCountry());
            preTestCaseCountry.setTestCaseCountryProperty(this.loadProperties(preTestCaseCountry));
            testCaseCountry.add(preTestCaseCountry);
            TestCase preTestCase = factoryTCase.create("Pre Tests", tsCase);
            LOG.debug("add all pretest");
            PretestCaseStep.addAll(loadTestCaseStep(preTestCase));
        }
    }
    /**
     * Load Information of TestCase
     */
    TestCase testCaseToAdd = factoryTCase.create(test, testcase);
    LOG.debug("add all step");
    testCaseStep.addAll(loadTestCaseStep(testCaseToAdd));
    LOG.debug("search all countryprop");
    List<TestCaseCountryProperties> testCaseCountryPropertyToAdd = this.testCaseCountryPropertiesService.findListOfPropertyPerTestTestCaseCountry(test, testcase, tCExecution.getCountry());
    LOG.debug("add all countryprop");
    if (testCaseCountryPropertyToAdd != null) {
        testCaseCountryProperty.addAll(testCaseCountryPropertyToAdd);
    }
    /**
     * Set Execution Object
     */
    testCase.setTestCaseCountry(testCaseCountry);
    LOG.debug("set testcasestep");
    testCase.setTestCaseStep(testCaseStep);
    LOG.debug("setTestCaseCountryProperties");
    testCase.setTestCaseCountryProperties(testCaseCountryProperty);
    LOG.debug("settCase");
    tCExecution.setTestCaseObj(testCase);
}
Also used : TestCaseCountryProperties(org.cerberus.crud.entity.TestCaseCountryProperties) TestCase(org.cerberus.crud.entity.TestCase) IFactoryTestCase(org.cerberus.crud.factory.IFactoryTestCase) ArrayList(java.util.ArrayList) IFactoryTestCaseCountry(org.cerberus.crud.factory.IFactoryTestCaseCountry) TestCaseCountry(org.cerberus.crud.entity.TestCaseCountry) IFactoryTestCaseStep(org.cerberus.crud.factory.IFactoryTestCaseStep) TestCaseStep(org.cerberus.crud.entity.TestCaseStep)

Aggregations

TestCaseStep (org.cerberus.crud.entity.TestCaseStep)41 ArrayList (java.util.ArrayList)20 IFactoryTestCaseStep (org.cerberus.crud.factory.IFactoryTestCaseStep)19 ITestCaseStepService (org.cerberus.crud.service.ITestCaseStepService)16 TestCase (org.cerberus.crud.entity.TestCase)15 TestCaseStepAction (org.cerberus.crud.entity.TestCaseStepAction)13 JSONObject (org.json.JSONObject)13 ApplicationContext (org.springframework.context.ApplicationContext)12 SQLException (java.sql.SQLException)11 TestCaseCountryProperties (org.cerberus.crud.entity.TestCaseCountryProperties)11 TestCaseStepActionControl (org.cerberus.crud.entity.TestCaseStepActionControl)11 Connection (java.sql.Connection)10 PreparedStatement (java.sql.PreparedStatement)10 ResultSet (java.sql.ResultSet)10 ITestCaseService (org.cerberus.crud.service.ITestCaseService)10 JSONArray (org.json.JSONArray)10 PolicyFactory (org.owasp.html.PolicyFactory)10 ITestCaseStepActionService (org.cerberus.crud.service.ITestCaseStepActionService)9 MessageEvent (org.cerberus.engine.entity.MessageEvent)9 TestCaseCountry (org.cerberus.crud.entity.TestCaseCountry)8