GSoC final report

 

Overview

The idea of this GSoC project was to implement new Domain-Specific language for LibreOffice to be used in UI testing by logging the user interactions with LO applications then generate the python code needed for the python UI framework which will make testing easier. Also, the project aims to improve the logger that logs all the user interaction to be logged in the new DSL syntax to be more readable. Then we can use this replaying all the user interactions as a UI test.

Achievements

  • Grammar of new DSL done for

    • starter_commands
    • uno_commands
    • dialog_commands 
    • General_commands  Grammar that are general for all application.
    • UI_Object_commands This support:
      • ButtonUIObject
      • EditUIObject
      • CheckBoxUIObject
      • RadioButtonUIObject 
      • ListBoxUIObject 
      • ComboBoxUIObject
      • SpinUIObject 
      • TabControlUIObject
    • Special_commands This is for the logging of different applications actions:
      • Writer
        • Type
        • Select
        • GOTO page
      • Calc
        • Type
        • Select cell or range
        • launch AutoFill
      •  Impress
        • Type
      • Math
        • element selector
        • Type
    • Rewrite all the logging messages with the new syntax.

      Some of these events was already supported to be logged while working by the old logger so for this part I change all the logging message by writing message that can be read with the new compiler and has enough data to be converted to UItest.
    • The log Compiler [ dsl_core.py ] 

      This python file is the implementation of the compiler this compiler is defined in the class : ul_compiler . It works by making an object from this class and it start read the log file that is already created and each line represent a type from commands. While reading these lines this class start calling the handler of each line depending on it's type and the handler is just a function that take information from line and start to convert it to python line that do the same action but can be run with the python UI framework.
    • log More Events

      after finishing the implementation of all of these I worked on adding support foe unsupported events from different applications. for any new event I add the grammar then the handler then added the part in the code that log this event.
      for example the new supported events are: 
      • Writer
        • Create Table
        • Copy Text
        • Cut Text
        • Paste Text
        • Insert Break Page
      • Calc
        • select sheet 
        • Delete Cells
        • Remove Content of a cell
        • Insert new Cells
        • Cut Cells 
        • Copy Cells
        • Paste Cells
        • Merge Cells
        • Unmerge Cells
      •  Impress
        • Insert New Slide
        •  Delete Slide
        • Duplicate Slide
        •  Rename Slide
      • Draw
        • Type
        • Insert New Page
        • Delete Page
        • Rename Page

    for more details you can see this post in the same blog: ui logger

    Code

      I was working on in the start in this branch : private/EL-SHREIF/ui_logger So most of the coding and solving bugs can be found on it in this link.

      all my merged patches can be found here : merged patches

      For more details :
      1. uitest: Rewrite all the logger statements with the new grammar syntax
      2. uitest: new logger DSL grammar 
      3. uitest: update the DSL grammar 
      4. uitest: just update zoom statement 
      5. uitest: Some new features in ui_logger project 
      6. uitest: change small parts of the grammar and dialog logger 
      7. uitest: start the implementation of the new DSL compiler 
      8. uitest: add DSL compiler support for more UI items 
      9. uitest: implement the missing part of the dialog compiler 
      10. uitest: add special commands of writer app implementation 
      11. uitest: add more DSL commands 
      12. uitest: add general functions to remove redundunt lines 
      13. uitest: solve some bugs in the ui logger 
      14. uitest: log more events 
      15. uitest: update UI logger grammar 
      16. uitest: start logging draw events 
      17. uitest: add more events to ui logger 
      18. uitest: log more events 
      19. uitest: log more events in Calc: 
      20. uitest: solve problem with un-named parents 
      21. uitest: add footer line support 
      22. uitest: replace tabs with spaces 
      23. uitest: use prefix for names that has conflict with python's keywords 
      24. uitest: ignore the logging part of the QuerySaveDialog while closing the app 
      25. uitest: add the SideBar implementation
      26. uitest: Reformat the python script of the Compiler 
      27. uitest: Fix typos


      Using the logger

      First you should update the master branch:

      1) Launch LibreOffice like
      LO_COLLECT_UIINFO="test.log" SAL_USE_VCLPLUGIN=gen instdir/program/soffice

      2) Simulate what you want to do with the mouse
      3) Close LibreOffice

      4) Open the resulting file in instdir/uitest/test.log

      5) Enter the UI logger directory with this Command:
      cd uitest/ui_logger_dsl/

      6) Use the following Command
      python dsl_core.py <path_to_log_file> <path_to_a_new_python_file>
      
      <path_to_log_file> should be replaced with something like SourceDirectory/core/instdir/uitest/test.log
      and <path_to_a_new_python_file> can be a location of your choice where you would like to see the generated code.
      Also, old Reports has a video doing these steps.

      Remaining Tasks

      Mainly thier is no remaining task for my project. But I made this section as a idea about how to extend the project in the future. It can be done by start adding more events to be logged in LO apps. This can be happend by read this project description and start add new grammar for new event and log it with new syntax by same methods. Also we have some limitations that the UI python framework doesn't support everything so it will be better to extend it first.

      Thank You!

      Thank you for giving me the opportunity to work on this project. I learned a lot from this project. I will definitely like to spend more time with LibreOffice community in future. I like to thank also my mentors they help me and guide me to learn a lot and the community was always active and helpfull.

      Comments

      Post a Comment

      Popular posts from this blog

      UI Logger

      Week 8 Report