Changes between Version 7 and Version 8 of DeveloperGuidelines/Testing/EdenTest/WriteTestcase


Ignore:
Timestamp:
06/08/14 06:40:33 (8 years ago)
Author:
Arnav Sharma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Testing/EdenTest/WriteTestcase

    v7 v8  
    3636{{{
    3737*** Settings ***
    38 Library    Selenium2Library
     38Library    Selenium2Library #imports library
    3939Variables    ../../execution/config.py #contains the local settings
    4040Test Teardown    Close Browser #close the browser after running the test
     
    4242*** Test Cases ***
    4343Login with valid email and valid passwd should be successful #name of the testcase.
    44     Open Browser        http://${SERVER}/eden/default/user/login   
    45     Input Text      auth_user_email     admin@example.com
    46     Input Text      auth_user_password      testing
    47     Click Button        xpath=//input[@class='btn' and @value='Login']
    48     Page Should Contain     Logged in
     44    Open Browser  http://${SERVER}/eden/default/user/login #opens the browser to the argument url   
     45    Input Text  auth_user_email  admin@example.com #puts arg2 in textbox(arg1)
     46    Input Text  auth_user_password  testing
     47    Click Button  xpath=//input[@class='btn' and @value='Login'] #Clicks the submit button
     48    Page Should Contain  Logged in #Checks if the text 'Logged in' is there or not
    4949
    5050}}}
    5151
    52 Note: Please make sure that the various arguments are separated by two spaces at least.
     52Note: Please make sure that the various arguments are separated by two spaces.
    5353[[BR]]
    5454
     
    6464=== Understanding the testcase ===
    6565
    66 [Ignore the `*** Settings ***` section for the time being.]
    6766[[BR]]
    68 As you can see, the name of the testcase is very descriptive and describes the objective. '''Open Browser''', '''Input Text''', '''Click Button''' and '''Page Should Contain''' are all keywords (functions) implemented in Selenium2Library. The beauty of writing tests this way is that they are easy to read and understand, thus eliminating the need to explain them. 
     67* The testcase is in a separate file and has two sections - `*** Setttings ***` and `*** Test Cases ***` itself.
     68* As you can see, the name of the testcase is very descriptive and describes the objective.
     69* '''Open Browser''', '''Input Text''', '''Click Button''' and '''Page Should Contain''' are all keywords (functions) implemented in Selenium2Library.
     70
     71The beauty of writing tests this way is that they are easy to read and understand and that is one of aims as well, that even someone without the technical know-how can read and write tests.
    6972
    7073If you have understood how the above above testcase is written, try writing the testcase '''Login with invalid email and valid passwd should fail'''. It should be fairly simple.