daily pastebin goal
59%
SHARE
TWEET

Testability Driver example test

a guest Jan 31st, 2012 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Example test for Unity 2D with Testability Driver.
  2. #
  3. # Reference: http://i.imgur.com/psi7m.png
  4. #
  5. # Note: this probably won't succeed on your installation. Only works
  6. # on unity-2d trunk *right now*, something that will change soon.
  7.  
  8. require 'tdriver'
  9. include TDriverVerify
  10.  
  11. # Establish connection to 'qttasserver' on target
  12. @sut = TDriver.connect_sut(:Id => 'sut_qt')
  13.  
  14. # Execute the application to test, supplying '-testability' flag
  15. @app = @sut.run( :name => 'unity-2d-launcher',
  16.                  :arguments => '-testability' )
  17.  
  18.  
  19. # ------------- Start of Testing Code ----------------
  20.  
  21.  
  22. # Check Launcher is 65 pixels wide
  23. verify_true(1, 'Launcher is not 65 pixels wide') {
  24.   @app.LauncherView()['width'] == '65'
  25. }
  26.  
  27.  
  28.  
  29. # Check that Terminal tile is using correct icon source
  30. verify_true(1, 'Terminal icon in Launcher is wrong') {
  31.   @app.LauncherList( :name => 'main' ) \
  32.       .QDeclarativeItem( :name => 'Terminal' ) \
  33.       .QDeclarativeImage( :name => 'icon' )['source'] == 'image://icons/utilities-terminal'
  34. }
  35. # this is a bad test, as the name "Terminal" can be localised, meaning a fail if
  36. # you're using a non-English installation. Choosing good objectNames is important.
  37.  
  38.  
  39. # ------------------- Clean up -----------------------
  40.  
  41.  
  42. # This closes (kills actually) the launcher when we're done.
  43. @app.kill
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top