Forum Discussion

mamatahegde's avatar
mamatahegde
New Contributor
4 years ago
Solved

How to create Frame work and How to call all functions in one main?

We started using Test complete but not very clear on how to create a framework. Went through the Training materials available, but couldn’t understand. Could you please help us on below  questions: 

 

  1. 1. How to design a framework?
  2. 2. As of now our QA team created separate scripts for all function/features and all the scripts contains “main “, wondering is it possible to call all that functions in One “Main” if so how can we link back to all the functions?

Appreciate your help 

 

Thanks

Mamata

 

 

  • 1.1 How to design a framework.

    This is a tough one and can't be fully explained in forum message, need a real worksop because depends a lot of you, your goal, your team, your business, ..

    But in a quick guidance view, below my way of doing :

    - Have technical object to manage things not related to business/TC (e.g. Services, Cmd, System, DB, ..).

    - Have one object dedicated to one app;

            - Build this object as OOP as you can

            - Build it with at least 3 layers; base function not linked to business, base business function and complex business function.

           - Think about useful properties (e.g. Performance or Functiunal exec mode, log level, base path, ..)

           - Use documentation framework (i use jsdoc style comments and a tweaked jsdoc module of nodejs)

           - Include self test in your object

     

    2.2 Usage

    Several techniques,  pseudo-class, closure, useunit, modules ...  depends again of multiples things.

    Personnally i use a closure object method and 2 units (one for global keys mappings/variables, one for business object/methods). And the call from tests cases is made by //USEUNIT

2 Replies

  • BenoitB's avatar
    BenoitB
    Community Hero

    1.1 How to design a framework.

    This is a tough one and can't be fully explained in forum message, need a real worksop because depends a lot of you, your goal, your team, your business, ..

    But in a quick guidance view, below my way of doing :

    - Have technical object to manage things not related to business/TC (e.g. Services, Cmd, System, DB, ..).

    - Have one object dedicated to one app;

            - Build this object as OOP as you can

            - Build it with at least 3 layers; base function not linked to business, base business function and complex business function.

           - Think about useful properties (e.g. Performance or Functiunal exec mode, log level, base path, ..)

           - Use documentation framework (i use jsdoc style comments and a tweaked jsdoc module of nodejs)

           - Include self test in your object

     

    2.2 Usage

    Several techniques,  pseudo-class, closure, useunit, modules ...  depends again of multiples things.

    Personnally i use a closure object method and 2 units (one for global keys mappings/variables, one for business object/methods). And the call from tests cases is made by //USEUNIT

  • jkrolczy's avatar
    jkrolczy
    Regular Contributor

    Is this for a Browser based app ?  
    You want to do Key word or Script based fwk?

     

    Think of your framework as pieces of a puzzle (pieces of functionality)

    i.e.
      function to start up browser and login

      per web page you are on - functions for actions you want to do here

         i.e  fill in a text box, grab a value, click a button, verify a page label

     

    Object Spy comes in handy here to know how to find your web elements

    You need to create some finder functions 

     

    Also be sure with your app using Object Spy that your developerd have ID'd your web elements

    appropriately to help make automation easier for you on creating functions.

     

    Web element fields that are helpful to find and element are:

    contentText

    idStr

    ObjectType

    ObjectIdentifer

    className

     

    Static IDs are better than dynamic ones that change on you as you navigate around.

    (Wildcards are useful '*')

     

    Once you have your various code modules,

    then per a test script put the pieces together:

     

    You Main() in my sense is what I call my test script name

    function testcase1234()

    {

      function to start up browser and log in

      function to be sure web page opened

      function to obtain my page Object for use with my functions

      functions dealing with web page you are on

      .   Click a button

      .   Check a value

      .   Set a radio button

      .   etc.

      function to logout of web page

      function to close browser 

    }

     

    Eventually you would have a collection scripts that you can then setup a package\group in Test Items to run.

    These could be Smokes, Regression, etc.

     

    There is so much flexibility here when creating a framework with TestComplete and what you can do per you vision of automation and what you are trying to test.