Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Robot framework

1

  • Be the first to comment

Robot framework

  1. 1. Robot Framework 2.5<br />Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD).<br />by Usov Borys<br />
  2. 2. Features:<br />Enables easy-to-use tabular syntax for creating test cases in a uniform way.<br />Allows using keyword-driven, data-driven and behavior-driven (BDD) approaches.<br />Provides easy-to-read reports and logs in HTML format.<br />Is platform and application independent.<br />Provides a simple library API for creating customized test libraries.<br />Implemented with Python.<br />Provides support for Selenium for web testing.<br />
  3. 3. Test application: login.py<br />Command<br />> pythonsut/login.pyloginnobody P4ssw0rd<br />Access Denied<br />> pythonsut/login.pycreate fredinvalid<br />Creatinguserfailed: Passwordmustbe a combinationoflowercase anduppercase letters and numbers<br />> pythonsut/login.pycreate fred P4ssw0rd<br />SUCCESS<br />> pythonsut/login.pyloginfred P4ssw0rd<br />Logged In<br />Status<br />
  4. 4. High-level test cases<br />
  5. 5. Simple tabular syntax for test cases<br />Keyword<br />
  6. 6. User-defined keywords (tabular view)<br />Function from user-defined library<br />
  7. 7. Robot Framework Libraries<br /><ul><li>BuiltIn Libraries
  8. 8. Adding Libraries</li></ul>***Settings***<br />Library /testlib/LoginLibrary.py<br />Library OperatingSystem<br />Library Screenshot<br />#Test Setup Create File <br />#Test Teardown Take Screenshot<br />
  9. 9. User-defined Libraries<br />classLoginLibrary:<br />def__init__(self):<br />#Initialising class with path to our application<br />self._status = ''<br /> <br />defcreate_user(self, username, password):<br />self._run_command('create', username, password)<br /> <br />defattempt_to_login_with_credentials(self, username, password):<br />self._run_command('login', username, password)<br /> <br />defchange_password(self, username, old_pwd, new_pwd):<br />self._run_command('change-password', username, old_pwd, new_pwd)<br /> <br />defstatus_should_be(self, expected_status):<br /> if expected_status != self._status:<br /> raise AssertionError("Error")<br /> <br />def_run_command(self, command, *args):<br />#Function runs command and sets result status to<br /> #self._status variable<br />
  10. 10. Plain text presentation of user-defined keywordsand variables<br />***Keywords***<br />#High-level test cases.<br />Given a user has a valid account<br /> Create valid user ${USERNAME} ${PASSWORD}<br />When he changes hispassword<br /> Change password ${USERNAME} ${PASSWORD} ${NEW PASSWORD}<br />Then he can log in with the new password<br /> Login ${USERNAME} ${NEW PASSWORD}<br />And he cannot use the old password anymore <br /> Attempt to login with credentials ${USERNAME} ${PASSWORD}<br /> Status should be Access Denied<br />***Variables***<br />${USERNAME} busov<br />${PASSWORD} P4s5wo0rd<br />${NEW PASSWORD} e0D3n4J<br />${PWD INVALID LENGTH} Password must be 7-12 characters long<br />
  11. 11. Plain text test cases presentation<br />***Test Cases***<br />User can create an account and log in<br /> Create Valid User fred P4ssw0rd<br /> Attempt to Login with Credentials fred P4ssw0rd<br /> Status Should Be Logged In<br />User cannot log in with bad password<br /> Create Valid User betty P4ssw0rd<br /> Attempt to Login with Credentials betty wrong<br /> Status Should Be Access Denied<br />
  12. 12. Report in html format<br />
  13. 13. Log file in html format<br />
  14. 14. RIDE Robot Framework IDE<br />
  15. 15. For more information<br />Project Pages<br />The main information hub<br />http://code.google.com/p/robotframework<br />User Guide<br />Detailed information about all features of the framework<br />http://code.google.com/p/robotframework/wiki/UserGuide<br />
  16. 16. Thanks. Questions<br />

×