Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

Project Goal

The goal of this project is to deliver an automated functional testing framework for the OFBiz. This framework assist developers to add/remove/run test cases which simulate real users' behaviors.

Design and Implementation

The system basically consists of five basic components, they are :

A page is a collection of any number of those five components:

In order to separate the core implementation layer and business layer, package hierarchy is designed as below:

A testcase is constructed by two portions: the expected outcome and scripts of action. The expected outcome can be deduced by comparison of page's title, appearance of one pop up, content of an error message, etc. The latter specifies sequences of action: input a string into one text field, then tick a box, select a radio button, click a button, etc.

The project would be run via The Jenskin. The Jenskin will start one job called OFBIZ_FT, this job will have 2 tasks executed sequentially:

  • task 1 : start one OFBIZ instance.
  • task 2 : run test cases according to some configuration files(which case and how many cases to run).

Documentation

  • Notes

    • 07/05/2012 - 11/05/2012:
      • download Jenkins and get familiar with it.
      • how to ask Jenkins to start one OFBIZ instance
      • install the Gradle plug-in for Jenkins
      • write a build.gradle file to grasp all dependencies.
      • write one test case(test to pass) of log-in page
      • setup project repository using Github
      • Difficulties:
        1. Configure jenkin to start on a different port compared to that of the OFBiz
        2. Connect local repository and remote repository
    • 14/05/2012 - 15/05/2012:
      • Refine Gradle build script
      • Jar the project
      • Configure jenkin to start an instance of OFBiz and run the test via the jar
      • Difficulties:
        1. decide which approach is easy to maintain and extend: go by page(one page contain many test cases) or go by case(one case cover a single scenario). The first approach requires a few huge classes. The second approach requires great pool of tiny classes, yet easy to distribute cases.
    • 16/05/2012 - 17/05/2012:
      • Decide to move on with the second approach which is implementing one test case as an individual file.
      • Come up with first draft XML template of test case:
        • Header (Title, description of test case)
        • Input (describe what page is tested, what page needs to fill in before reaching the desired page, and the input for each field)
        • Output (describe what is expected, with/without error, content of error message(if any), or one event(pop up of one dialog))
      • Difficulties:
        1. So many variables to control, perhaps try to come up with one template first, then refine it time after time.
        2. Answer the question: It is fine if user enter test case via Java code, but how does he/she do it if go for XML approach ? Or I would tackle the Java case first, then slowly change it to XML.
        3. Let say if there is huge number of test cases, how to effectively manage them ? Yes, by assigning each test case/class to proper package, but still it is discrete.
    • 21/05/2012 - 24/05/2012:
      • Update wiki page
      • Extend testing on Log-in page
      • Difficulties:
        1. How to verify test-to-pass case: for example in log-in page, after user enter correct information, title of the next page remains unchanged. Now this case is covered by checking no error message.
        2. A number of element in the OFBIZ have not the ID attribute, for example, the DIV component for error message. Therefore, instead of one method call (find element by its id), a few must be executed (get a list of DIV component, check the class attribute of each, then grasp the correct element)
    • 25/05/2012 - 29/05/2012:
      • Separate logic layer and business layer of components
      • Restructure packages
      • Update wiki page
      • Add 10 test cases
    • 30/05/2012 - 31/05/2012:
      • Add test cases for Locales page and Catalog Manager page
      • Note:
        • When accessing to "language", the title of page is host:port/catalog/control/ListLocales
    • 01/06/2012 - 04/06/2012:
      • Add test cases for ForgotPassword page
      • Revise structure again
      • Difficulties:
        1. While keeping the idea of separating logic and business layers, it is difficult to implement that approach as in compile
          time, you must indicate the source of all classes, while in some cases it is only decided in run-time.
    • 01/06/2012 - 04/06/2012:
      • Solve the version compatibility between WebDriver and Firefox 13
      • Move business components from util package to test.cases package to utilize the re-usability and cleanliness.
      • Introduce Helper class where keep all common methods for test cases in one page.
    • 05/06/2012 - 08/06/2012:
      • Fix build script to include all properties from different pages.
    • 05/06/2012 - 08/06/2012:
      • Add test cases for main page
      • Difficulties:
        1. Intermittent failure as by the time WebDriver checked on the element(for example error container), it is not ready yet. Therefore, instead of receiving an expected message, it returned empty.
    • 11/06/2012 - 14/06/2012:
      • Add test cases for main page
      • Implementing mouseOver action to get popup list
    • 15/06/2012 - 19/06/2012:
      • Add test cases for main page
      • Add in function "Wait For Element" under Util.java
    • 20/06/2012 - 25/06/2012:
      • Add test cases for main page
  • Others

    • Project source code can be checked out at : git@github.com:luvinhthinh/OFBIZ_FT.git
    • How to start up an OFBiz instance with Jenkins:
      1. Start up the Jenkins
      2. Create a new free-style job, give it any name you'd like: OFBIZ_FT
      3. Under the Build, click 'Add Build Step', select 'Invoke Ant'
      4. Click 'Advance', enter Targets as 'run-install run' and Build File as "'The location you store the OFBIZ'/build.xml"
      5. Click Save
      6. Go to home page of Jenkins, you would see your new job added, click the icon at the right most of that row. This will start up the OFBIZ instance.
    • In case you run this project in Linux environment, doing "apt-get install gradle" will get you the latest build along with Groovy version 1.8.3, and this might not work. To solve the problem, please try to downgrade to Gradle version 0.9.2 and Groovy version 1.7.
    • How to create a test case

    • How to run all test case:
      1. Open command prompt, go to OFBIZ project
      2. execute command line "gradle test"
    • How to obtain test report:
      • Compiled test report can be read in: build/reports/tests/index.html
    • How to create a test case cover a scenario (For example: login --> go to Order Application --> create an order and pay):
      • Prerequisite:
        • Main page has been implemented.
      • Steps:
        • Create a new page named "App_Order" (if it didn't exist)
        • Implement the Helper class as per usual.
        • When overiding the method gotoPage():
          • Call gotoPage() from test.cases.pages.main.components.Helper
        • Implement all neccessary methods of classes under test.cases.pages.App_Order.components
        • Create one test class named "createNewOrder"
        • Implement the class "createNewOrder" and call implemented classes in that components package.
  • End of GSOC 2012
    **It has been approaching the fourth month since I started working for the OFBiz-Webdriver project. Having a look at what was written in the proposal, and as I have been working on a testing framework, why not have it described in a “test report” way:


6 Comments

  1. Mono,

    you're missing the links in the components.

    For starting OFBiz, the OFBiz instance should be started through the tests and not manually. this way, you have only to start the tests. The test framework will handle starting and stopping OFBiz.

    1. Thank you for pointing it out,
      Page updated.

  2. A bit more detailed title than "Implementation Documentation" would be better (wink)

    1. Thanks for your feedback, Jacques (smile)
      Hope the new title is more informative.

  3. Mono,

    You said "A number of element in the OFBIZ have not the ID attribute, for example, the DIV component for error message. Therefore, instead of one method call (find element by its id), a few must be executed (get a list of DIV component, check the class attribute of each, then grasp the correct element)"

    What you can do is start a thread on the mailing-list to discuss this, and suggest to change the actual behavior. Adding an id or a name is one of the web best practices, and so, this should be added where missing.

    Cheers,