Sunday, 16 June 2013

Silk Test [OPAT] Framework

[Defining a Framework for Web Applications - UI Automation Testing]

The OPAT framework

Components of the Framework
[ObjectRepository]
[ProjectFunctionLibrary]

[ApplicationFunctionLibrary]
[Test Script / Plan / Suite]



    [ObjectRepository] (*.inc)

        Object Repository is the collection of all UI elements required for testing.
        It can be defined as an Include File (*.inc).
        Capture the UI elements using the "Locator Spy".
        Edit the captured XPath if required to define a unique locator.

        Silk has predefined DOM library for most of the UI elements like DOMTextField, DOMButton,
        DOMRadioButton, DOMCheckBox, etc. The SuperCalss for all these classes is DoMElement.
        If the UI has some customised control, it can be captured as a "DomElement"
               
        Sample,
       
        DomTextField userName
            locator "//DomTextField[@id='username']"
        DomElement imageButton
            locator "//DomElement[@class='imageBtn']"
       

    [ProjectFunctionLibrary] (*.inc)

        ProjectFunctionLibrary is the collection of functions (methods) that are independent of the Web Application(s) to be tested using the Framework.

        This includes methods used for Database Connectivity, Data Reading modules, Report Writing, etc.

        This can also include any customized methods / definitions of silk library. Silk provides the advantage of inheriting and overriding the default library.

        For Instance,

        You can Inherit the DomTextField class and customize it with your requirements.
        You can also override the Default silk methods like ScritpEnter(), ScriptExit(), TestcaseEnter(), TestCaseExit(), etc. 
       
    [ApplicationFunctionLibrary] (*.inc)

        ApplicationFunctionLibrary is an exclusive collection of functions (methods) that performs the UI Actions on the Web Application to be tested.

        You can define UI actions that are repeated while testing a web application as methods.

        For Instance,

        Void LogIn()
               
            // Note : Browser, ApplicationWindow and UI elements like (userName, password and SignInButton) are declared in "ObjectRepository"
           
            Browser.ApplicationWindow.userName.SetText("admin")
            Browser.ApplicationWindow.password.SetText("adminpwd")
            Browser.ApplicationWindow.SignInButton.DomClick()       

    [Test Script / Plan / Suite]
   
        [TestScript] (*.t)
       
            TestScript is the collection of TestCases. TestCases can be defined by utilizing the ApplicationFunctionLibrary, ProjectFunctionLibrary and ObjectRepository if required.

            Sample,
           
            use "ApplicationFunctionLibrary.inc"
            use "ProjectFunctionLibrary.inc"
            use "ObjectRepository.inc"


            testcase TestLogin()
                    ReadTestData()     // this method belongs to ProjectFunctionLibrary
                    Login()     // belongs to ApplicationFunctionLibrary
                    verify(actual,expected,"Message on Fail")

            on Executing this Scripts, the results are recorded in a *.res file.

        [TestPlan] and [TestSuites]

            - will give a detailed explanation on TestCase management, Defining Function Library, Data Reading Mechanisms in my next Post.
            Thank you viewing this Post. Please write back your comments.
                   

No comments:

Post a Comment