Automated test case generation tool for WSO2 products-GSOC

  1. Introduction

  2. is the component for the WSO2 Test automation framewrok. It let developed and specially for non-technical people to test the WSO2 Carbon based product. It used the natural language instead java or other Programming language.

  3. Project Architecture


    Component Diagram

    Main Library

    • Main Library is responsible to provide the frequently use functions to the test cases. This component is contain the libraries that can be used in test cases. In the this Library it provide Authentication, axis client as libraries.
    • Also it provides the libraries that can be used to assert the expected outcomes and Object creating libraries.


    • It provide the configuration data to the Libraries. Configurations are store in in the context.xml file.

    Library Generator

    • Library generator is responsible to generate Client libraries. libraries need to be generated should be include in the service.xml file based on the stub information.
    • It use service.xml and extract the stub information to retrieve the service operation and service related information from the related WSDL file.
    • Generator use the predefined template to generate the libraries. For that template is defined using java String Template[1] group file.

    Robot Library

  5. How to install tool

    • Download the latest version of the tool from Git hub
    • Before you build the tool you have to install maven dependencies.
    • Simply go to the tool directory and run sh on Linux or mvn-setup.bat on windows.
    • Next in the tool root directory run mvn clean install
    • After the successful build tool will install to the local maven repository.
  6. Create integration test module

  7. Test module structure is as below and should define configuration files as below.




    Define the parent integrate test module pom file
    • Identify the parent pom file and add the parent definition and project definition as follow


    <name>WSO2 Carbon - Robot  test module for AS</name>

    Define the robot maven plugin
    • Then define the robot maven plugin as below

    <executions> <execution> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>

    Add the dependency tool
    • Next you have to add the  tool as dependency.
    • After you build the tool, find the correct dependency details like version.
    • Then add the definition as follow.


    Example pom file is here.


    • It contain the server configuration details.
                        /Sample-Robot-Test  </location>

    • example Automation.xml for AS is here.

    • Define the logger properties.


    • It contain the details of the wso2 carbon admin services.
    • But it not required unless use add new admin services.
    • It contain the service elements with format
                  <service  stub=”” name=”” wsdl=”” lib=”” />
    • Also you can get the latest service.xml file from here.


    • It the template file to generate Library for admin services.
    • It is not required unless you generate libraries.
    • Also you can get the latest templateR.stg file from here.
  8. How to add test cases


    • Test cases are written in natural language and it should be .txt files (tested only on .txt).
    • All the .txt text cases are should be inside the  “test/main/resources/robotframwork/libraries/tests”.
    • Test cases related libraries should be kept inside “test/main/resources/robotframework/libraries” folder.
    • “taflibrary.txt” is default library for every test case written in this tool.
    • Latest taflibrary.txt is available on this link.
    • It should be kept inside the library folder.

    Format and structure of the robot script

    • Robot script is written in natural language and it should be standard text(.txt) file. Test script have several region to provide space to specify keyword and write testing keyword. most common region are as below,

    *** Settings ***

    1. setting region is used to import libraries into the robot script. there is two keyword that can used to import libraries.
    2. using Library keyword
      • can import library by specifying library name
      • Library should be inside the test/main/resources/robotframework/libraries Directory
      • ex:  Library      Selenium2Library
    3. using Resource keyword
      • can import resources into the test scripts.
      • Resources could be any test script file, Libraries or keyword libraries
      • ex:  Resource taflibrary.txt

    *** Variables ***

    • In this region users can define the variables
    • variable declaration format is as ${variable-name}=[tab]value
    • ex:  ${brower}=           firefox
    • Any way variable can be declare at any point of the script

    *** Test Cases ***

    • In this region where implement test cases
    • Use keywords, Variables to implement test cases

    *** Keywords ***

    • Use this region to define custom Keywords
    • Can use existing keywords and external libraries keywords

    How to write test cases

    • Create a .txt file inside the testes folder
    • Before you start the test cases you have to import default library first as “Resource  taflibrary.txt”.
    • Then you can define the test method.
    • Just after the test method name define the your command
    • Note that command should start after the tab space.

    How to run the test cases.

    • Start the testing product (ex. ESB, AS)
    • Go to the project root from the terminal
    • Then type the mvn clean install

    Result of the test run

    • Tool generate the related report inside the target folder of project root directory. inside the target/robotframework directory contain the test related report.
  10. Extending the library

  11. Generate service stub based libraries

    • update the service.xml with required details of the service.
    • Then run the ClientGenerator class by providing the package name as parameter.
    • There is two ways you can generate Libraries
      1. Generate Libraries and build the tool
        • generate the libraries and build the tool with the new libraries
      2. Generate libraries after tool build
        • you can generate libraries and use them even after you build the tool. generate the libraries inside the test module and import them into test script.
    • Use the to generare libraries on Linux and generate.bat on windows
      1. run [packagename] ex: sample.lib
      2. for the help run -help
    • Using maven exec plugin to generate the Libraries
      run mvn exec:java  -Dexec.mainClass="client.genration.ServiceStubClientGeneratorr"  -Dexec.args="package_name"                        

    Define you own Library

    • If you need to define your own library, You can use define it using java classes.
    • Create java class inside /java/src/main/
    • Import them into the test case as below
    • Ex: Library  Example

    Define your own keyword library

    • Create .txt file inside library.
    • At the top define the region as keyword by ***keyword*** tag
    • Then define the keyword name
    • Then define the list of existing command
    • Then import it to the test cases at the top.
    • ex:  resources             mykeywordslibrary
    • Example keyword library file is here

    Using 3rd party libraries

    • You can use the 3rd party library with this tool.
    • Download the library file and place inside the library folder.
    • Then import them into the test file
    • Extra text file is import to the test file at beginning of the follow as below
    • ex: Library  SeleniumLibrary
  12. references


    [1]T. Parr, “Introduction - StringTemplate 4 - Confluence,” Introduction - StringTemplate 4 - Confluence, 06-Aug-2012. [Online]. Available: [Accessed: 20-Aug-2014].

    “Robot Framework User Guide,” Robot Framework User Guide, 17-Jun-2014. [Online]. Available: [Accessed: 21-Aug-2014].