TS 60 Ruby

Ruby Test Specification for NetBeans 6.0

Authors: Radim Roska, Martin Schovanek, Jiri Skrivanek
Version: 1.0
Last update: 18-th May 2007
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)

  • Tools -> Update Center
  • Click Next
  • Select,add ruby module (HINT: write ruby and press down arrow, ruby module should be selected now)
  • Click Next
  • Accept all licenses
  • Click Next and Finish


  1. </span>testcase New Project wizard</span>
    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. Finish the wizard
    6. Check a new Ruby project is created and opened, there are Source Files and Test Files, main_TS_60_Ruby.rb and Rakefile.rb under Source Files, main_TS_60_Ruby.rb is opened in the editor.
    7. Right-click the project node and choose 'Delete Project'
    8. Click Yes button in the 'Delete Project' dialog box (do not check 'Delete Sources' checkbox)
    9. Open New Project wizard again
    10. Select 'Ruby Project with Existing Sources'
    11. Click Next two times
    12. Click upper 'Add Folder...' button and browse for sources from previously deleted project (i.e. c:\work\RubyApplication1\lib)
    13. Click lower 'Add Folder...' button and browse for tests from previously deleted project (i.e. c:\work\RubyApplication1\test)
    14. Finish the wizard
    15. Check project is created and opened, there are Source Files and Test Files, main_TS_60_Ruby.rb and Rakefile.rb under Source Files.
    • </span>result EXPECTED RESULT: All actions are executed sucessfully.</span>
  2. </span>testcase New File wizard</span>
    1. Open New File wizard
    2. Select Ruby category
    3. Select Ruby Class file
    4. Click Next and finish the wizard
    5. Repeat for all available file types (Empty Ruby Script, Ruby Module, Rakefile, Ruby Unit Test Suite, Ruby Unit Test, Empty RHTML (Embedded Ruby) file).
    • 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_60_Ruby.rb as Main Script
      2. Write something in Arguments field
    3. Select Sources category
      1. Add/Remove new Source folder
      2. Add/Remove new Test folder
    4. Type puts ARGV in new_main_TS_60_Ruby.rb and run project
    • EXPECTED RESULT: All changed parameters are stored and taken into account. new_main_TS_60_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 Build and Clean Project and check both tasks are executed (issue 100805)
    3. Call Clean Project and check clean task is executed
    4. Call Generate RDoc for Project and check documentation is generated and opened in default browser (issue 100801)
    5. Call Run Project and check main_TS_60_Ruby.rb is executed
    6. 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
    7. Call Move Project, select different location, confirm the dialog and check project is moved
    8. Call Copy Project, confirm the dialog and check project is copied and opened in IDE
    9. Call Close Project and check project is not shown in Projects view
    10. Open project again using File|Open Recent Project main menu item
    11. 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_60_Ruby.rb in the editor
    2. Call context menu Run file
    3. Select main_TS_60_Ruby.rb node
    4. Call main menu Run|Run File|Run "main_TS_60_Ruby.rb"
    5. Select main_TS_60_Ruby.rb node
    6. Press Shift+F6
    7. Call Run File action on main_TS_60_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_60_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 editor call 'Navigate|Go to Test' context menu
    6. Check it opens new_class.rb
    7. Call main menu Run|Run File|Test "new_class.rb" (Ctrl+F6)
    8. Check it executes new_class_test.rb
    9. In editor call 'Navigate|Go to Test' context menu
    10. 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_60_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. Interactive Ruby Shell
    1. Click main menu item 'Window|IRB - Interactive Ruby Shell'
    2. Type some statements in (e.g. x=1 Enter y=2 Enter puts(x+y) Enter)
    3. Use Up and Down arrow keys for command history
    • EXPECTED RESULT: Commands are executed succesfully.
  5. {{{1}}}
    1. Open Tools|Option
    2. Click Miscellaneous category
    3. Expand Ruby Installation node
    4. Click Browse button and select your Ruby executable (Ruby Download)
    5. Click OK in Options dialog (issue 101380)
    6. Add -v to Ruby options in project properties
    7. Run a single Ruby file and check correct Ruby version is printed to console
    • EXPECTED RESULT: It is possible to change Ruby instalation.
  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. Select for example rake gem and click Update button
    4. Wait until rake is updated and close update dialog
    5. Click 'Proxy Settings...' button if you need to adjust your setting
    6. Call 'Build Project' action on project node
    7. It should fail because rake is uninstalled (issue 101292)
    8. Open again Ruby Gems dialog
    9. Click 'Install New...' button
    10. Wait until list of available gems is populated
    11. Click Refresh button
    12. Type rake into Filter text field and click Filter button
    13. Select rake and click Install button
    14. Click OK in 'Gem Installation Settings' dialog
    15. Wait until rake gem is installed and close all dialogs
    16. Call 'Build Project' on project node to verify rake gem is installed
    • EXPECTED RESULT: It is possible to install and uninstall gems.
  7. Ruby Platform Manager
    1. NOT YET IMPLEMENTED - it should be replacement for Options|Ruby Installation
    • EXPECTED RESULT:
  8. Java-JRuby projects support
    1. NOT YET IMPLEMENTED
    • EXPECTED RESULT:


Test suite: Editing Support

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

  1. Syntax highlighting and semantic syntax highlighting
    1. paste into main_TS_60_Ruby.rb contain of this file
    2. check if highlighting is ok, compare to the attached picture_TS_60_Ruby.png
    • {{{1}}}), instance variables ( green }}), strings, numbers ( pink }}), comments and unused variables ( grey }}), plain text and statements ( black }}) and methods variables ( ochre }}).}}
  2. String and RDoc support
    1. check highlighting of strings at the end of file
      1. diferences between "string" and 'string', escape code \n
      2. variables and references in strings
      3. code inside strings
    2. check comments
      1. directives are highlighted
      2. tags are highlighted
    3. compare to the attached picture_TS_60_Ruby.png
    • EXPECTED RESULT: every element is highlighted correctly
  3. Code Completion
    1. create new ruby class file
    2. click at line 4
    3. press ctrl+space,type req and press enter -> require is written
    4. type space and '
    5. now press ctrl+space again
    6. type da and press enter -> date
    7. at new line press ctrl + space, type Date , look at rdoc, press enter, type . so Date. is written, press ctrl+space, type to , press enter
    8. 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 )
    9. at new line type "\ and press ctrl+space , you have some choices
    10. at new line type / ( /this_is_regular_expression/ )
    11. press ctrl+space and code completion will help you with regular expressions syntax
    12. by typing $ and pressing ctrl+space code completion remember you what dollar variables you can use
    • EXPECTED RESULT: everything works correctly
  4. Go To Declaration
    1. click on date at 4th line
    2. go to declaration using:
      1. alt+g
      2. right click on date -> go to -> declaration
      3. press ctrl + left click on date
    • EXPECTED RESULT: data.rb source file is opened
  5. Navigator
    1. data.rb file is opened in editor
    2. open navigator (ctrl + 7 or Window->Navigator)
    3. try to use all filters ( show fields, static member , 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 -> sort by name || sort by sources (issue 101385)
    • EXPECTED RESULT: all actions were performed correctly
  6. Code folding
    1. open main_TS_60_Ruby.rb again
    2. fold classes and methods
    3. move mouse cursor on folded methods or classes and see hidden code
    • EXPECTED RESULT: all actions were performed correctly
  7. Code Formatting (TODO - PrettyPrinter)
    1. select class Classs and press tab few times
    2. select method to_s and do the same
    3. break formatting as you wish
    4. also break formatting of comments
    5. format code
      1. right click -> reformat code
      2. ctrl+shift+f
    • EXPECTED RESULT: code is formatted
  8. Instant Rename
    1. click at 19th line on variable name -> at 18th line name is highlighted too
    2. press ctrl+r or right click->r
    3. both highlighted words are blue
    4. type new name for variable
    • EXPECTED RESULT: variable is renamed everywhere
  9. Smart Indent
    1. add some lines to the methods, classes ( by hitting return :)
    2. if you type "end" at the beginning of a line, it will reindent the line such that the end is aligned with the corresponding opening statement
    • EXPECTED RESULT: every new line is intented correctly
  10. Smart Selection
    1. click at line 20 on number 123
    2. by pressing alt+shift+uparrow you select larger and larger block of code (123, line,method block, class block,..whole file
    3. by pressing alt+shilf+downarrow effect is reversed
    • EXPECTED RESULT: worked as discribed
  11. Pair Matching
    1. check that editor automatically highlights matching parentheses, braces, brackets, string delimiters, regular expression delimiters, etc.
    2. type def , 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
  12. Mark Occurrences
    1. write following code :

var = 2 var2 = var var2 = var var2 = var

def method(foo)

 foo = "hi"

end

def method(foo, foo2)

 foo = "hi"
 foo2 = "you fool"

end

method(foo) method(foo2) method(foo, foo2) method(foo3, foo2)

    1. click on var, all 4 occurences of var variable are highlighted
    2. click on method at last line method(foo3, foo2) , 3 right methods are highlighted (those with 2 parametres)
    • EXPECTED RESULT: worked as discribed
  1. Error parsing
    1. write some wrongly syntaxed code , it should be marked as an error
    • EXPECTED RESULT: all errors are marked as errors
  2. Code Templates
    1. create a new empty Ruby script
    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.
  3. TODO - Refactoring (find usages, rename, extract class) - not implemented yet


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 Next and Update Rails
    6. Finish the wizard
    7. Delete project but don't delete sources
    8. Open New Project wizard again
    9. Select Ruby On Rails Project From Existing Sources
    10. Click Next
    11. Choose Project Folder from deleted project
    12. Finish the wizard (issue 102153)
    • EXPECTED RESULT: Check a new Ruby On Rails project is created and opened, there are Controllers, Helpers, Models, Views, Components, Configuration, Database Migrations, Libs, Logs, Public, Unit Tests, Functional Tests, Test Fixtures, Test Mocks, Test Integration and Vendor folders
  2. Project properties
    1. Open RoR Project Properties
    2. Change the Run > Server Port
    3. Run the project
    • EXPECTED RESULT: Check project is running on the selected port.
  3. Project actions
    1. Call 'Run Rake Target|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 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
    4. Call Move Project, select different location, confirm the dialog and check project is moved
    5. Call Copy Project, confirm the dialog and check project is copied and opened in IDE
    6. Call Close Project and check project is not shown in Projects view
    7. Open project again using File|Open Recent Project main menu item
    8. Call Delete Project, check 'Delete Sources' checkbox, confirm the dialog and verify project is closed and deleted (issue 102201)
    • EXPECTED RESULT: All actions are executed sucessfully.
  4. 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 'Install New Gem' 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
  5. 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
    17. Check it is removed from the list
    18. Switch to 'Settings' tab
    19. Click 'Configure Proxies...' button and check Options dialog appears
  6. Run single file
    1. Open myview.rhtml in the editor
    2. Call context menu Run file
    3. Select main_TS_60_Ruby.rb node
    4. Call main menu Run|Run File|Run "main_TS_60_Ruby.rb"
    5. Select main_TS_60_Ruby.rb node
    6. Press Shift+F6
    • EXPECTED RESULT: WEBrick server is started and default browser is opened at myapp1/myview1 context.
  7. Go To Rails Action/View
    1. Open myview.rhtml file in the editor
    2. Call context menu 'Go To| Rails Action/View'
    3. Check myapp_controller.rb is opened in the editor
    4. Call context menu 'Go To| Rails Action/View'
    5. Check myview.rhtml is opened in the editor
    • EXPECTED RESULT: Action is available and works correctly.
  8. RHTML files
    1. Open myview.rhtml in the editor
    2. Type
      <%= link_to 'Action', :action => 'myview' %>
    3. Check syntax highlighting
    4. You can look at one of tutorials for bigger RHTML file
    5. Type
      <%= Date.to
    6. Press CTRL+Space to invoke code completion
    7. Check it offers
      today
    8. Type
      <table border="<%= Tim
    9. Invoke code completion and check it (issue 104246)
    10. Complete code to this state
      <table border="<%= Time.now.sec %>" cellpa
    11. Invoke HTML code completion
    12. Check it offers
      cellpadding
    13. Complete code
      <table border="<%= Time.now.sec %>" cellpadding="1">
    14. Check syntax coloring (issue 104242)
    15. TODO - check folds and hyperlinking in embedded Ruby code - not yet implemented (issue 98367)
    • EXPECTED RESULT: Everything works correctly.
  9. Unit Tests
    1. Open myapp_controller_test.rb from Functional Tests
    2. Run this file (try all 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 "main_TS_60_Ruby.rb" (Ctrl+F6)
    6. Check it executes myapp_controller_test.rb (issue 91468)
    • 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