Index: framework/webtools/regression/exampleTest1.ftl =================================================================== --- framework/webtools/regression/exampleTest1.ftl (revision 0) +++ framework/webtools/regression/exampleTest1.ftl (revision 0) @@ -0,0 +1,142 @@ + + + + +Example Test 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Example Test 1 (Click around the data tools)
open/webtools/control/logout
assertTitleexact:OFBiz: Web Tools:
typeUSERNAMEadmin
typePASSWORDofbiz
clickAndWait//input[@value='Login']
assertTitleexact:OFBiz: Web Tools:
clickAndWaitlink=XML Data Export
assertTitleexact:OFBiz: Web Tools:
clickAndWaitlink=WebTools
assertTitleexact:OFBiz: Web Tools:
clickAndWaitlink=XML Data Export All
assertTitleexact:OFBiz: Web Tools: XML Data Export All
clickAndWaitlink=WebTools
assertTitleexact:OFBiz: Web Tools:
clickAndWaitlink=XML Data Import
assertTitleexact:OFBiz: Web Tools: XML Data Import
clickAndWaitlink=WebTools
assertTitleexact:OFBiz: Web Tools:
clickAndWaitlink=XML Data Import Dir
assertTitleexact:OFBiz: Web Tools: XML Data Import Dir
clickAndWaitlink=WebTools
assertTitleexact:OFBiz: Web Tools:
+ + Index: framework/webtools/regression/exampleTest2.ftl =================================================================== --- framework/webtools/regression/exampleTest2.ftl (revision 0) +++ framework/webtools/regression/exampleTest2.ftl (revision 0) @@ -0,0 +1,100 @@ + + + + +Example Test 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<#list 1..20 as i> + + + + + + + + + + + + + + + + + +
Searches for partyIds 1 to 20
(sequence autogenerated by ftl)
open/webtools/control/logout
assertTitleexact:OFBiz: Web Tools:
typeUSERNAMEadmin
typePASSWORDofbiz
clickAndWait//input[@value='Login']
assertTitleexact:OFBiz: Web Tools:
clickAndWaitlink=Entity Data Maintenance
assertTitleexact:OFBiz: Web Tools: Entity Data Maintenance
clickAndWait//a[contains(@href, '/webtools/control/FindGeneric?entityName=Party')]
assertTitleexact:OFBiz: Web Tools: Find Values
typepartyId${i}
clickAndWait//input[@value='Find']
assertTitleexact:OFBiz: Web Tools: Find Values
+ + Index: framework/webtools/widget/RegressionTestScreens.xml =================================================================== --- framework/webtools/widget/RegressionTestScreens.xml (revision 0) +++ framework/webtools/widget/RegressionTestScreens.xml (revision 0) @@ -0,0 +1,35 @@ + + + + + + +
+ + + + + + + +
+
+
Index: framework/webtools/widget/SeleniumScreens.xml =================================================================== --- framework/webtools/widget/SeleniumScreens.xml (revision 0) +++ framework/webtools/widget/SeleniumScreens.xml (revision 0) @@ -0,0 +1,182 @@ + + + + + + +
+ + + +
+ + + + + + + + + + +
+
+
+
+ + +
+ + + + +

DOM Viewer

+

This page is generated using JavaScript. If you see this text, your + browser doesn't support JavaScript.

+ + + Index: framework/webtools/webapp/webtools/selenium/Log.ftl =================================================================== --- framework/webtools/webapp/webtools/selenium/Log.ftl (revision 0) +++ framework/webtools/webapp/webtools/selenium/Log.ftl (revision 0) @@ -0,0 +1,89 @@ + + + +Selenium Log Console + + + + + + + + + +
    + + + + Index: framework/webtools/webapp/webtools/selenium/TestPrompt.ftl =================================================================== --- framework/webtools/webapp/webtools/selenium/TestPrompt.ftl (revision 0) +++ framework/webtools/webapp/webtools/selenium/TestPrompt.ftl (revision 0) @@ -0,0 +1,130 @@ + + + + + + Select a Test Suite + + + + + +
    + +

    + Test Suite: + +

    + +

    + +
    + Options + +

    + + +

    + +

    + +

    + + +
    + + +
    + + + \ No newline at end of file Index: framework/webtools/webapp/webtools/selenium/TestRunner-splash.ftl =================================================================== --- framework/webtools/webapp/webtools/selenium/TestRunner-splash.ftl (revision 0) +++ framework/webtools/webapp/webtools/selenium/TestRunner-splash.ftl (revision 0) @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
    Test SuiteCurrent TestControl Panel
     
    + + + +

    Selenium

    +

    by ThoughtWorks and friends

    + +

    +For more information on Selenium, visit + +

    +    http://selenium.openqa.org
    +
    + +
    + + Index: framework/webtools/webapp/webtools/selenium/TestRunner.ftl =================================================================== --- framework/webtools/webapp/webtools/selenium/TestRunner.ftl (revision 0) +++ framework/webtools/webapp/webtools/selenium/TestRunner.ftl (revision 0) @@ -0,0 +1,176 @@ + + + + + + + + + + Selenium Functional Test Runner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + +
    +

    Selenium TestRunner +

    +
    +
    + Execute Tests + +
    + + + + +
    + +
    Fast
    +
    Slow
    +
    +
    +
     
    +
     
    +
    + +
    + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Elapsed:00.00
    TestsCommands
    0run0passed
    0failed0failed
    0incomplete
    + +
    + Tools + + + + +
    + +
    +
    + +
    + + + Index: framework/webtools/webapp/webtools/selenium/SeleniumHome.ftl =================================================================== --- framework/webtools/webapp/webtools/selenium/SeleniumHome.ftl (revision 0) +++ framework/webtools/webapp/webtools/selenium/SeleniumHome.ftl (revision 0) @@ -0,0 +1,26 @@ + + +
      +<#list testSuites as ts> +
    • + ${ts} +
    • + +
    \ No newline at end of file Index: framework/webtools/webapp/webtools/WEB-INF/actions/selenium/testList.bsh =================================================================== --- framework/webtools/webapp/webtools/WEB-INF/actions/selenium/testList.bsh (revision 0) +++ framework/webtools/webapp/webtools/WEB-INF/actions/selenium/testList.bsh (revision 0) @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import java.util.Iterator; +import java.util.List; +import java.util.LinkedList; + +import org.ofbiz.base.component.ComponentConfig; +import org.ofbiz.base.config.GenericConfigException; +import org.ofbiz.base.config.ResourceHandler; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilXml; +import org.ofbiz.testtools.ModelTestSuite; +import org.ofbiz.testtools.SeleniumTest; +import org.ofbiz.base.util.UtilMisc; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javolution.util.FastList; + +String module = "selenium.bsh"; + +List seleniumTests = FastList.newInstance(); +List testSuiteInfoList = ComponentConfig.getAllTestSuiteInfos(); +Iterator testSuiteInfoIter = testSuiteInfoList.iterator(); +List modelTestSuiteList = FastList.newInstance(); +String suiteName = ""; +suiteName = request.getParameter("suite"); +while (testSuiteInfoIter.hasNext()) { + ComponentConfig.TestSuiteInfo testSuiteInfo = (ComponentConfig.TestSuiteInfo) testSuiteInfoIter.next(); + + ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler(); + try { + Document testSuiteDocument = testSuiteResource.getDocument(); + Element documentElement = testSuiteDocument.getDocumentElement(); + ModelTestSuite modelTestSuite = new ModelTestSuite(documentElement); + if(modelTestSuite.getSuiteName().equals(suiteName)){ + List webTestList = modelTestSuite.getWebTestList(); + Iterator webTestListItr = webTestList.iterator(); + while(webTestListItr.hasNext()){ + webTest = webTestListItr.next(); + if(webTest instanceof SeleniumTest){ + seleniumTests.add(UtilMisc.toMap("caseName", webTest.getCaseName(), "casePath", webTest.getTestPath())); + } + } + } + } catch (GenericConfigException e) { + String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]"; + Debug.logError(e, errMsg, module); + } +} +context.put("seleniumTests",seleniumTests); +context.put("suiteName",suiteName); Index: framework/webtools/webapp/webtools/WEB-INF/actions/selenium/getRegressionTest.bsh =================================================================== --- framework/webtools/webapp/webtools/WEB-INF/actions/selenium/getRegressionTest.bsh (revision 0) +++ framework/webtools/webapp/webtools/WEB-INF/actions/selenium/getRegressionTest.bsh (revision 0) @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import java.util.Iterator; +import java.util.List; +import java.util.LinkedList; + +import org.ofbiz.base.component.ComponentConfig; +import org.ofbiz.base.config.GenericConfigException; +import org.ofbiz.base.config.ResourceHandler; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilXml; +import org.ofbiz.testtools.ModelTestSuite; +import org.ofbiz.testtools.SeleniumTest; +import org.ofbiz.base.util.UtilMisc; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javolution.util.FastList; + +String module = "selenium.bsh"; + +List testSuiteInfoList = ComponentConfig.getAllTestSuiteInfos(); +Iterator testSuiteInfoIter = testSuiteInfoList.iterator(); +List modelTestSuiteList = FastList.newInstance(); +String suiteName = ""; +suiteName = request.getParameter("suiteName"); +String caseName = ""; +caseName = request.getParameter("caseName"); +while (testSuiteInfoIter.hasNext()) { + ComponentConfig.TestSuiteInfo testSuiteInfo = (ComponentConfig.TestSuiteInfo) testSuiteInfoIter.next(); + ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler(); + try { + Document testSuiteDocument = testSuiteResource.getDocument(); + Element documentElement = testSuiteDocument.getDocumentElement(); + ModelTestSuite modelTestSuite = new ModelTestSuite(documentElement); + if(modelTestSuite.getSuiteName().equals(suiteName)){ + List webTestList = modelTestSuite.getWebTestList(); + Iterator webTestListItr = webTestList.iterator(); + while(webTestListItr.hasNext()){ + webTest = webTestListItr.next(); + if(webTest instanceof SeleniumTest){ + if(webTest.getCaseName().equals(caseName)){ + context.put("casePath", webTest.getTestPath()); + } + } + } + } + } catch (GenericConfigException e) { + String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]"; + Debug.logError(e, errMsg, module); + } +} Index: framework/webtools/webapp/webtools/WEB-INF/actions/selenium/selenium.bsh =================================================================== --- framework/webtools/webapp/webtools/WEB-INF/actions/selenium/selenium.bsh (revision 0) +++ framework/webtools/webapp/webtools/WEB-INF/actions/selenium/selenium.bsh (revision 0) @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import java.util.Iterator; +import java.util.List; +import java.util.LinkedList; + +import org.ofbiz.base.component.ComponentConfig; +import org.ofbiz.base.config.GenericConfigException; +import org.ofbiz.base.config.ResourceHandler; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilXml; +import org.ofbiz.testtools.ModelTestSuite; +import org.ofbiz.testtools.SeleniumTest; +import org.ofbiz.base.util.UtilMisc; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javolution.util.FastList; + +String module = "selenium.bsh"; + +List testSuites = FastList.newInstance(); +List testSuiteInfoList = ComponentConfig.getAllTestSuiteInfos(); +Iterator testSuiteInfoIter = testSuiteInfoList.iterator(); +List modelTestSuiteList = FastList.newInstance(); +while (testSuiteInfoIter.hasNext()) { + ComponentConfig.TestSuiteInfo testSuiteInfo = (ComponentConfig.TestSuiteInfo) testSuiteInfoIter.next(); + + ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler(); + try { + Document testSuiteDocument = testSuiteResource.getDocument(); + Element documentElement = testSuiteDocument.getDocumentElement(); + ModelTestSuite modelTestSuite = new ModelTestSuite(documentElement); + if(modelTestSuite.getWebTestList().size()>0){ + testSuites.add(modelTestSuite.getSuiteName()); + modelTestSuiteList.add(modelTestSuite); + } + } catch (GenericConfigException e) { + String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]"; + Debug.logError(e, errMsg, module); + } +} +context.put("testSuites",testSuites); \ No newline at end of file Index: framework/webtools/webapp/webtools/WEB-INF/controller.xml =================================================================== --- framework/webtools/webapp/webtools/WEB-INF/controller.xml (revision 515882) +++ framework/webtools/webapp/webtools/WEB-INF/controller.xml (working copy) @@ -517,6 +517,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -589,5 +623,15 @@ + + + + + + + + + + Index: framework/webtools/webapp/webtools/main.ftl =================================================================== --- framework/webtools/webapp/webtools/main.ftl (revision 515882) +++ framework/webtools/webapp/webtools/main.ftl (working copy) @@ -121,6 +121,8 @@
  • ${uiLabelMap.WebtoolsPerformanceTests}

  • ${uiLabelMap.WebtoolsEntityEngine}
  • +
  • ${uiLabelMap.WebtoolsRegressionTests}

    +
  • ${uiLabelMap.WebtoolsSelenium}
  • <#if security.hasPermission("SERVER_STATS_VIEW", session)>
  • ${uiLabelMap.WebtoolsServerHitStatisticsTools}

  • ${uiLabelMap.WebtoolsStatsSinceServerStart}
  • Index: framework/webtools/testdef/webtests.xml =================================================================== --- framework/webtools/testdef/webtests.xml (revision 0) +++ framework/webtools/testdef/webtests.xml (revision 0) @@ -0,0 +1,26 @@ + + + + + + + Index: framework/testtools/src/org/ofbiz/testtools/SeleniumTest.java =================================================================== --- framework/testtools/src/org/ofbiz/testtools/SeleniumTest.java (revision 0) +++ framework/testtools/src/org/ofbiz/testtools/SeleniumTest.java (revision 0) @@ -0,0 +1,66 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.testtools; + +import java.io.IOException; +import java.util.List; + +import javax.xml.parsers.ParserConfigurationException; + +import javolution.util.FastList; + +import org.ofbiz.base.util.UtilXml; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import junit.framework.TestResult; + +public class SeleniumTest extends TestCaseBase { + + public static final String module = SeleniumTest.class.getName(); + + protected String testPath=null; + + /** + * @param modelTestSuite + */ + public SeleniumTest(String caseName, ModelTestSuite modelTestSuite, Element mainElement) { + super(caseName, modelTestSuite); + this.testPath = mainElement.getAttribute("url"); + } + + public int countTestCases() { + return 1; + } + + public void run(TestResult result) { + // TODO Auto-generated method stub + } + + public String getTestPath(){ + return this.testPath; + } + + public String getCaseName(){ + return this.caseName; + } +} \ No newline at end of file Index: framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java =================================================================== --- framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java (revision 515882) +++ framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java (working copy) @@ -50,6 +50,7 @@ protected LocalDispatcher dispatcher; protected List testList = FastList.newInstance(); + protected List webTestList = FastList.newInstance(); public ModelTestSuite(Element mainElement) { this.suiteName = mainElement.getAttribute("suite-name"); @@ -96,6 +97,8 @@ this.testList.add(new EntityXmlAssertTest(caseName, this, childElement)); } else if ("jython-test".equals(nodeName)) { this.testList.add(new JythonTest(caseName, this, childElement)); + } else if ("selenium-test-suite".equals(nodeName)) { + this.webTestList.add(new SeleniumTest(caseName, this, childElement)); } } } @@ -115,4 +118,8 @@ List getTestList() { return testList; } + + List getWebTestList() { + return webTestList; + } } Index: framework/testtools/dtd/test-suite.xsd =================================================================== --- framework/testtools/dtd/test-suite.xsd (revision 515882) +++ framework/testtools/dtd/test-suite.xsd (working copy) @@ -96,4 +96,13 @@ + + + + + + + + +