TS 61 Ruby

Ruby Test Specification for NetBeans 6.1

Authors: Radim Roska, Martin Schovanek, Jiri Skrivanek
Version: 2.0
Estimated time: ??
Default IZ component(s): ruby/projects, ruby/rails
Last update: 26-th March 2008
Introduction: This is test specification of Ruby scripting language support in NetBeans IDE.
Comments: Ruby development documentation can be found here.

Documentation:


Contents


Test suite: Project Support

Purpose: Test project support (http://wiki.netbeans.org/wiki/view/RubyProjects).
Setup: Get IDE Ruby or install Ruby module (http://wiki.netbeans.org/wiki/view/RubyInstallation).

  1. New Project wizard
    1. Open New Project wizard
    2. Select Ruby category
    3. Select Ruby Application project
    4. Click Next and browse for project location (e.g. c:\work)
    5. Click Manage and open Gem Manager
    6. Close both Ruby Gems and Ruby Platform Manager windows
    7. Check all your ruby platforms are listed in Ruby Platform combo box
    8. Finish the wizard
    9. Check a new Ruby project is created and opened, there are Source Files and Test Files, main_TS_61_Ruby.rb under Source Files, Rakefile.rb in project root, main_TS_61_Ruby.rb is opened in the editor.
    10. Right-click the project node and choose 'Delete Project'
    11. Click Yes button in the 'Delete Project' dialog box (do not check 'Delete Sources' checkbox)
    12. Open New Project wizard again
    13. Select 'Ruby Application with Existing Sources'
    14. Click Next two times
    15. Click upper 'Add Folder...' button and browse for sources from previously deleted project (i.e. c:\work\RubyApplication1\lib)
    16. Click lower 'Add Folder...' button and browse for tests from previously deleted project (i.e. c:\work\RubyApplication1\test)
    17. Finish the wizard
    18. Check project is created and opened, there are Source Files and Test Files, main_TS_61_Ruby.rb under Source Files.
    • EXPECTED RESULT: All actions are executed sucessfully.
  2. New File wizard
    1. Open New File wizard
    2. Select Ruby category
    3. Select Ruby Class file
    4. Type something into In Module text field
    5. Type something into Extends text field
    6. Click Finish to finish the wizard
    7. Check module and extends parameters are taken into account
    8. Repeat for all available file types (RHTLM File, ERB File, Ruby File, Ruby Module, Rakefile, Ruby Unit Test Suite, Ruby Unit Test).
    • EXPECTED RESULT: Check appropriate file is created in given location and it is opened in the editor.
  3. Project properties
    1. Open Properties on project node
    2. Change parameters for Run category
      1. Browse for new_main_TS_61_Ruby.rb as Main Script
      2. Write something in Arguments field
      3. Click New button and type something in Create New Profile dialog
      4. Try to change configuration
    3. Select Sources category
      1. Add/Remove new Source folder
      2. Add/Remove new Test folder
    4. Type puts ARGV in new_main_TS_61_Ruby.rb and run project
    • EXPECTED RESULT: All changed parameters are stored and taken into account. new_main_TS_61_Ruby.rb is executed when you run project and arguments are printed to the console.
  4. Project actions
    1. Open Rakefile.rb and type some tasks in:
  desc "Default task" 
  task :default do
    puts "Default"
  end
  
  task :clean do
    puts "Clean"
  end
  
    1. Call Build Project and check default task is executed
    2. Call Clean and Build Project and check both tasks are executed
    3. Call Clean Project and check clean task is executed
    4. Call Run Rake Task|Refresh List
    5. Call Run Rake Task|default and check task is executed
    6. Call Generate RDoc for Project and check documentation is generated and opened in default browser
    7. Call Run Project and check main_TS_61_Ruby.rb is executed
    8. Call Set Configuration|Customize and add a new configuration
    9. Call Set Configuration|your new configuration
    10. Call Rename Project
      1. Change name in Rename Project dialog and click Rename
      2. Check project is renamed
      3. Repeat action but check 'Also Rename Project Folder' checkbox and click Rename
      4. Check project is renamed and folder as well
    11. Call Move Project, select different location, confirm the dialog and check project is moved
    12. Call Copy Project, confirm the dialog and check project is copied and opened in IDE
    13. Call Close Project and check project is not shown in Projects view
    14. Open project again using File|Open Recent Project main menu item
    15. Call Delete Project, check 'Delete Sources' checkbox, confirm the dialog and verify project is closed and deleted (issue 99928)
    • EXPECTED RESULT: All actions are executed sucessfully.
  1. Run single Ruby file
    1. Open main_TS_61_Ruby.rb in the editor
    2. Call context menu Run
    3. Select main_TS_61_Ruby.rb node
    4. Call main menu Run|Run File|Run "main_TS_61_Ruby.rb"
    5. Select main_TS_61_Ruby.rb node
    6. Press Shift+F6
    7. Call Run File action on main_TS_61_Ruby.rb node (issue 91402)
    8. Go to output view and click double arrow button to rerun file
    9. Add 'sleep(10)' to main_TS_61_Ruby.rb, run it and click stop button in output view
    • EXPECTED RESULT: It is possible to execute single file all possible ways.
  2. Unit Tests
    1. On Test Files node choose 'New|Ruby Unit Test'
    2. Type NewClassTest in the Class text field and finish the wizard
    3. Run this file (try all ways of single file execution)
    4. Click on every hyperlink in ouput window and check whether it jumps to proper line in editor
    5. In Ruby Test Results window call 'Go to Source', 'Run Again' and 'Debug' on both NewClassTest and test_foo nodes.
    6. In editor call 'Navigate|Go to Tested Class' context menu
    7. Check it opens new_class.rb
    8. Call main menu Run|Run File|Test "new_class.rb" (Ctrl+F6)
    9. Check it executes new_class_test.rb
    10. In editor call 'Navigate|Go to Test' context menu
    11. Check it opens new_class_test.rb
    • EXPECTED RESULT: Tests are executed and results are printed to the console.
  3. Output Window hyperlinking
    1. Open main_TS_61_Ruby.rb file
    2. Change puts method name to putsX
    3. Run file (Shift+F6)
    4. Click hyperlink in output window
    • EXPECTED RESULT: Error message appears in output window and click on hyperlink goes to correct line number in editor.
  4. Ruby Shell (IRB)
    1. Click main menu item 'Window|Other|Ruby Shell (IRB)'
    2. Type some statements in (e.g. x=1 Enter y=2 Enter puts(x+y) Enter)
    • EXPECTED RESULT: Commands are executed succesfully.
  5. Ruby Platform Manager
    1. Open Tools|Ruby Platforms
    2. Check all your ruby platforms are in the list
    3. Select a platform and click Remove button
    4. Click Autodetect Platforms and check removed platform is added
    5. Click Add Platform
    6. Browse for different platform
    7. Check platform is added
    8. Click Add button to add gem path
    9. Browse for empty dir
    10. Confirm gem repository creation
    11. Select added gem path and click Remove button
    12. Open project properties
    13. Select Run category
    14. Choose other platform in the Ruby Platform combo box
    15. Add -v to Ruby options
    16. Close properties dialog box
    17. Run main_TS_61_Ruby.rb file and check correct ruby platform is displayed
    18. Change platform in project properties, run main_TS_61_Ruby.rb and check again
    • EXPECTED RESULT: All actions are executed sucessfully.
  6. Ruby Gems Manager (http://wiki.netbeans.org/wiki/view/RubyGems)
    1. Open 'Tools|Ruby Gems'
    2. Wait until list of installed gems gets populated
    3. Go to Settings tab
    4. Click 'Configure Proxies...' button if you need to adjust your setting
    5. Go to Installed tab
    6. Select for example rake gem and click Uninstall button
    7. Wait until rake is uninstalled and close dialog
    8. Call 'Build Project' action on project node
    9. It should fail because rake is uninstalled
    10. Open again Ruby Gems dialog
    11. Go to New Gems tab
    12. Click Reload Gems button
    13. Click Install Local and check you can browse for locally stored gem
    14. Type rake into Search text field and press Enter
    15. Select rake and click Install button
    16. Select last but one version and click OK in 'Gem Installation Settings' dialog
    17. Wait until rake gem is installed
    18. Go to Updated tab
    19. Select rake gem and click Update button
    20. Wait until rake gem is updated
    21. Click Update All, wait until it is finished and close all dialogs
    22. Call 'Build Project' on project node to verify rake gem is installed
    23. Repeat for different platform
    • EXPECTED RESULT: It is possible to install and uninstall gems.


Test suite: Editing Support

Purpose: Test editing support (http://wiki.netbeans.org/wiki/view/RubyEditing).
Setup: create new ruby project, main_TS_61_Ruby.rb is opened

  1. Syntax highlighting and semantic syntax highlighting
    1. paste into main_TS_61_Ruby.rb content of Main_TS_61_Ruby.rb (attached to this page)
    2. check if highlighting is ok, compare to the attached highlighting_TS_61_Ruby.png
    • EXPECTED RESULT: Every element is highlighted correctly.
  2. Code Completion
    1. create new ruby class file
    2. remove everything
    3. type req , press ctrl+space and press enter -> require is written
    4. type da , press ctrl+space again and press enter twice-> date
    5. at new line type Da , press ctrl + space, select Date , look at rdoc, press enter, type . so Date. is written, press ctrl+space, type to , press enter, press backspace, press enter -> Date.today()
    6. at new line type  % and press ctrl+space, you can choose from several letters ( for example %x(ls) execute in linux external command ls and return its result )
    7. at new line type "\ and press ctrl+space , you have some choices
    8. at new line type / ( /this_is_regular_expression/ )
    9. press ctrl+space and code completion will help you with regular expressions syntax
    10. by typing $ and pressing ctrl+space code completion remember you what dollar variables you can use
    • EXPECTED RESULT: everything works correctly
  3. Go To Declaration
    1. click on date
    2. go to declaration using:
      1. CTRL + B
      2. right click on date and call Navigate|Go to Declaration
      3. press CTRL + left click on date
    • EXPECTED RESULT: data.rb source file is opened.
  4. Navigator
    1. data.rb file is opened in editor
    2. open navigator (ctrl + 7 or Window|Navigating|Navigator)
    3. try to use all filters (show fields, static members, non public members)
    4. navigate by clicking on elements (classes, methods, variables) in navigator
    5. expand and collapse class Date
    6. right click on navigator and call Sort by Name or Sort by Source
    7. check items are sorted accordingly
    • EXPECTED RESULT: all actions were performed correctly
  5. Code folding
    1. data.rb file is opened in editor
    2. call View|Code Folds|Collapse All
    3. move mouse cursor on folded methods or classes and see hidden code
    4. call View|Code Folds|Expand All and check all is expanded
    5. collapse or expand fold in editor clicking plus or minus sign
    • EXPECTED RESULT: all actions are performed correctly
  6. Code Formatting
    1. open main_TS_61_Ruby.rb or any other ruby file
    2. break formatting as you wish (e.g. press CTRL+A and then Shift+Tab several times)
    3. call Format context menu in editor (Alt+Shift+F)
    • EXPECTED RESULT: code is formatted.
  7. Instant Rename
    1. open main_TS_61_Ruby.rb
    2. click arg1 variable name and second occurence is highlighted too
    3. call Rename context menu item in editor (or press Ctrl+R)
    4. both highlighted words are blue
    5. type new name for variable and press enter
    • EXPECTED RESULT: variable is renamed everywhere
  8. Smart Selection
    1. open date.rb
    2. click inside a method
    3. by pressing Alt+Shift+Period (.) you select larger and larger block of code until whole file is selected
    4. by pressing alt+shilf+Comma (,) the effect is reversed
    • EXPECTED RESULT: works as expected
  9. Pair Matching
    1. check that editor automatically highlights matching parentheses, braces, brackets, string delimiters, regular expression delimiters, etc.
    2. type def hello , press enter end is automaticaly written
    3. type ( , automaticaly () is written, if you type closing ) , it removes the previous )
    4. that works for { too
    5. type for something press enter, an "end" statement is automatically inserted
    • EXPECTED RESULT: worked as discribed
  10. Mark Occurrences
    1. open main_TS_61_Ruby.rb
    2. click on localvar and check all occurences are highlighted
    3. click hello(1) and check all occurencies of hello method with one parameter are highlighted
    4. click hello(1, 2) and check all occurencies of hello method with two parameters are highlighted
    5. click &block in hello1 method and check &block in method body is also highlighted (issue 129606)
    • EXPECTED RESULT: works as expected
  11. Code Templates
    1. create a new Ruby file
    2. open Tools|Options
    3. select Editor category
    4. switch to Code Templates tab
    5. select Ruby in Language combo box and try each template in editor
      1. type abbreviation (e.g. begin) and press Tab
      2. type new value for selected text and press enter
      3. repeat until you go through all modificable parts
    6. select other Ruby options in Language combo box and again try each template in editor
    • EXPECTED RESULT: Generated code is correct.
  12. Refactoring
    1. open main_TS_61_Ruby.rb
    2. call Find Usages context menu item on hello method in editor
    3. click Find button in Find Usages dialog and check results in Usages output tab
    4. double-click every occurence and check it opens appropriate position in editor
    5. call Refactor|Rename context menu item on hello method in editor
    6. type hello_new in Rename Method dialog and click Preview button
    7. check changes in Refactoring preview window and click Do Refactoring button
    8. check changes in editor
    9. call
      Refactor|Undo [Rename]
      context menu item in editor
    10. create a new ruby class
    11. call Refactor|Rename on class node
    12. type NewClass1 in Rename Class dialog and click Preview button
    13. click Cnacel button in preview and renaming should be cancelled
    14. call Refactor|Rename on class node again
    15. click Do Refactoring button and check class is renamed both in editor and projects view
    • EXPECTED RESULT: Everything works as expected.


Test suite: Ruby on Rails

Purpose: Test Ruby on Rails (http://wiki.netbeans.org/wiki/view/RubyOnRails).
Setup:

  1. New RoR Project wizard
    1. Open New Project wizard
    2. Select Ruby category
    3. Select Ruby On Rails Application project
    4. Click Next and fill the Project Name
    5. Click Manage and close Ruby Platform Manager
    6. Click Next twice and Update Rails (issue 130496)
    7. Click Install JRuby OpenSSL Support
    8. Click Proxy Settings and close options
    9. Finish the wizard
    10. Delete project but don't delete sources
    11. Open New Project wizard again
    12. Select Ruby On Rails Application with Existing Sources
    13. Click Next
    14. Choose Project Folder from deleted project
    15. Finish the wizard
    • EXPECTED RESULT: Check a new Ruby On Rails project is created and opened, there are Controllers, Helpers, Models, Views, Configuration, Database Migrations, Libs, Logs, Public, RSpec, Unit Tests, Functional Tests, Test Fixtures, Test Mocks, Integration Tests, Scripts, Documentation and Vendor folders
  2. New RoR Project wizard - Database Connection (http://wiki.netbeans.org/RubyDatabaseIntegration)
    1. Open New Project wizard
    2. Select Ruby category
    3. Select Ruby On Rails Application project
    4. Click Next twice to get to Database Configuration panel
    5. Click Create DB button
    6. Fill path to start DB (e.g. MySQL Server 5.0\bin\mysqld.exe) and path to stop DB (e.g. MySQL Server 5.0\bin\mysqladmin.exe with -u root shutdown parameters)
    7. Type database name in Create Database dialog and click OK
    8. Confirm New Database Connection dialog and finish the wizard
    9. Check database is created and parameters in database.yml are correct
    10. Open new wizard at Database Configuration panel again
    11. Pick Specify Database Information Directly radio button
    12. Fill in text fields and finish the wizard
    13. Check parameters in database.yml are correct
    14. Repeat again but check Access Dataabse Using JDBC check box
    15. Finish wizard and check parameters in database.yml
  3. Project properties
    1. Open RoR Project Properties
    2. Click Manage and close Ruby Platform Manager
    3. Click New button and type something in Create New Profile dialog
    4. Try to change configuration
    5. Change Server Port
    6. Run the project
    7. Check project is running on the selected port.
    8. Click red button in output tab to stop WEBrick server
    • EXPECTED RESULT: Properties are correctly set.
  4. Project actions
    1. Call 'Run Rake Task|log|clear' and check target is executed
    2. Call 'Migrate Database|To Current Version' and check target is executed. It can fail if database is not configured but that is not matter of test.
    3. Call 'Rails Console' and check you can write commands like a = 5 into the console
    4. Click red stop button and close Rails console
    5. Call Rename Project (issue 104068)
      1. Change name in Rename Project dialog and click Rename
      2. Check project is renamed
      3. Repeat action but check 'Also Rename Project Folder' checkbox and click Rename
      4. Check project is renamed and folder as well
    6. Call Move Project, select different location, confirm the dialog and check project is moved
    7. Call Copy Project, confirm the dialog and check project is copied and opened in IDE
    8. Call Close Project and check project is not shown in Projects view
    9. Open project again using File|Open Recent Project main menu item
    10. Call Delete Project, check 'Delete Sources' checkbox, confirm the dialog and verify project is closed and deleted
    • EXPECTED RESULT: All actions are executed sucessfully.
  5. Rails Generator
    1. Call 'Generate' popup action on Controllers node, check 'Rails generator' dialog is opened and 'controller' is selected in combo box
    2. Click 'Install Generators...' button and check 'Ruby Gems' dialog is opened
    3. Close the dialog
    4. Type myapp in the Name text field
    5. Check 'Preview Changes only' check box and click OK
    6. Check preview is printed to console but nothing is created
    7. Open Rails Generator again
    8. Uncheck Preview check box
    9. Type myapp in the Name text field and myview in View text field
    10. Click OK and check myview.rhtml, myapp_helper.rb, myapp_controller_test.rb and myapp_controller.rb files are created and opened in editor
  6. Rails Plugins
    1. Call 'Rails Plugins...' on project node
    2. Switch to 'New Plugins' tab
    3. Select tztime, click Install button and finish installation
    4. Switch to 'Installed' tab and click 'Reload Plugins' button
    5. tztime should appear in the list
    6. Click Update/Update All and check it is possible to update it
    7. Click 'Uninstall' and finish uninstallation
    8. Switch to 'New plugins' tab and click 'Reload Plugins' button
    9. Check tztime is again in the list
    10. Switch to 'Repositories' tab
    11. Click 'Find New' button, wait until list is populated and select one repository to be added
    12. Check the repository is in the list
    13. Click 'Add URL...' button and add some fake URL
    14. Check the URL is added to the list
    15. Click 'Reload Repositories' and check it refreshes the list
    16. Select fake URL repository and click 'Unregister' button
    1. Check it is removed from the list
    2. Switch to 'Settings' tab
    3. Click 'Configure Proxies...' button and check Options dialog appears
  1. Run single file
    1. Open Configuration|environment.rb
    2. Put
       config.frameworks -= [:active_record ] 
      under Rails::Initializer.run block
    3. Open myview.html.erb in the editor
    4. Call context menu Run in editor
    5. Go to Services view, expand Servers node, expand WEBrick node, call Stop action on RailsApplication
    6. Select Views|myapp|myview.html.erb node
    7. Call main menu Run|Run File|Run "myview.html.erb"
    8. Select Views|myapp|myview.html.erb node
    9. Press Shift+F6
    10. Click x button in progress bar and confirm Cancel Running Task dialog to stop WEBrick server
    • EXPECTED RESULT: WEBrick server is started and default browser is opened at myapp/myview context.
  2. Go to Rails Action or View
    1. Open myview.html.erb file in the editor
    2. Call context menu 'Navigate|Go to Rails Action or View'
    3. Check myapp_controller.rb is opened in the editor
    4. Call context menu 'Navigate|Go to Rails Action or View'
    5. Check myview.html.erb is opened in the editor
    • EXPECTED RESULT: Action is available and works correctly.
  3. RHTML files
    1. Open myview.html.erb in the editor
    2. Type lia and press Tab to expand
    3. Type Refresh , press enter, type myview , press enter
    4. It should look like Type
      <%= link_to "Refresh", :action => "myview" %>
    5. Check syntax highlighting
    6. You can look at one of tutorials for bigger RHTML file
    7. Type
      <%= Date.to
    8. Press CTRL+Space to invoke code completion
    9. Check it offers
      today
    10. Type
      <table border="<%= Tim
    11. Invoke code completion and check it (issue 104246)
    12. Complete code to this state
      <table border="<%= Time.now.sec %>" cellpa
      (issue 130009)
    13. Invoke HTML code completion
    14. Check it offers
      cellpadding
    15. Complete code
      <table border="<%= Time.now.sec %>" cellpadding="1">
    16. Check syntax coloring
    17. Hold Ctrl and click Time to go to declaration
    18. Select from options and check it is opened in editor
    • EXPECTED RESULT: Everything works correctly.
  4. Unit Tests
    1. Open myapp_controller_test.rb from Functional Tests
    2. Run this file (try all possible ways of single file execution)
    3. It fails if you don't have database connection set
    4. Select myapp_controller.rb script under Controllers
    5. Call main menu Run|Run File|Test "myapp_controller.rb" (Ctrl+F6)
    6. Check it executes myapp_controller_test.rb
    • EXPECTED RESULT: Tests are executed and results are printed to the console.



Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo