This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 157577 - Rails Rake test:functionals abnormal results with invalid test names
Summary: Rails Rake test:functionals abnormal results with invalid test names
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Testing (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-28 21:30 UTC by xlash911
Modified: 2009-02-19 23:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Only 5 tests run!!!! out of 6 (72.84 KB, image/png)
2009-01-28 21:49 UTC, xlash911
Details
Now all 6 tests are ran (73.90 KB, image/png)
2009-01-28 21:50 UTC, xlash911
Details

Note You need to log in before you can comment on or make changes to this bug.
Description xlash911 2009-01-28 21:30:25 UTC
Hi,

incorrectly named tests, like having a column, slash, dash etc. gives out no errors, but is not being run at all through
the IDE rake test:functionals command.

Runs fine through a console promnt.

To reproduce

  test "name that : wont work" do
    assert false
  end

Test results 0/0 from IDE 100% success
             0/1 from console rake call


Very annoying, and if one isn't paying attention, will get a 100% success on his tests, deploy, then have production
issues...
Comment 1 xlash911 2009-01-28 21:48:03 UTC
Sorry,

it is not related to the characters, not able to determine the root cause. Doesn't seem to be the length either...


the following is not tested correctly  if the following contains a dash : (see screens shot)
  test "post comment do comment on a new web site with invalid comment" do  ==> works
  test "post comment do comment on a - new web site with invalid comment" do  ==> doesn't work

require 'test_helper'
#FIXME 2009-01-28 GuillaumeNM Invalid tests names (with :, - or / are screwing up the tests so much!!!!! with netbeans
run_test only.
#FIXME 2009-01-28 GuillaumeNM can we get new object from Test db in functionals test??? am i forced to used
assigns(:weburl) instead of @weburl ???
class WeburlControllerTest < ActionController::TestCase
  # Replace this with your real tests.
  test "get_list_unauthentified" do
    get :list
    assert_response :success
    #assert assigns.empty?
    assert !@response.has_flash_object?(:error)
    assert !@response.has_flash_object?(:notice)
    #assert !@response.has_flash_object?(:warning)
  end

  test "get_list_authentified" do
    get :list , {}, {'user_id' => $BASIC_USER}
    assert_response :success
    #assert assigns.empty?
    assert !@response.has_flash_object?(:error)
    assert !@response.has_flash_object?(:notice)
    assert !@response.has_flash_object?(:warning)    
  end
  
  test "post comment do comment on a new web site" do
    url = 'http://urlquinexistepas.mais.pasdutout'
    commentaire = 'Voici un premier commentaire insignifiant pour un test insignifiant'
    
    post :comment ,{:url => url, :comment => commentaire}, {:user_id => $BASIC_USER}
    assert_response :redirect
    assert_redirected_to :controller => 'weburl', :action => 'list'
    #assert assigns.empty?
    assert !@response.has_flash_object?(:error)
    assert @response.has_flash_object?(:notice)
    assert !@response.has_flash_object?(:warning)
    #weburl = Weburl.find(:first,:conditions => {:url=>url})
    assert_instance_of Weburl, assigns(:weburl) , 'Database does not contain my save weburl object'
    assert_equal  url, assigns(:weburl).url , 'Saved url is not my expected url'
    assert_equal  $BASIC_USER, assigns(:weburl).user.id , 'Save user id is not my expected user_id'
    assert_instance_of Comment, assigns(:weburl).comments[0] , 'Weburl does not contain my save comment'
    assert_equal  commentaire, assigns(:weburl).comments[0].comment , 'Save comment is not my expected comment'
  end
  
  test "post comment do comment on a new web site with invalid comment" do
    url = 'http://urlquinexistepas.mais.pasdutout2'
    comment = ''
    
    post :comment ,{:url => url, :comment => comment}, {:user_id => $BASIC_USER}
    assert_response :redirect
    assert_redirected_to :controller => 'weburl', :action => 'list'
    #assert assigns.empty?
    assert @response.has_flash_object?(:error)
    assert !@response.has_flash_object?(:notice)
    assert !@response.has_flash_object?(:warning)
    weburl = Weburl.find(:first,:conditions => {:url=>url})
    assert_instance_of nil.class, weburl , 'Database does not contain my save weburl object'
  end
  
  test "post comment do comment - on a new web site with invalid url" do
    url = ''
    comment = 'Voici un premier commentaire insignifiant pour un test insignifiant'
    
    post :comment ,{:url => url, :comment => comment}, {:user_id => $BASIC_USER}
    assert_response :redirect
    assert_redirected_to :controller => 'weburl', :action => 'list'
    #assert assigns.empty?
    assert @response.has_flash_object?(:error)
    assert !@response.has_flash_object?(:notice)
    assert !@response.has_flash_object?(:warning)
    weburl = Weburl.find(:first,:conditions => {:url=>url})
    assert_instance_of nil.class, weburl , 'Database does not contain my save weburl object'
  end

  test "post comment do comment on a comment" do
    replyto = Comment.find(1)
    comment = 'Voici un 2e commentaire insignifiant en reponse a un commentaire insignifiant'

    xml_http_request :post, :comment ,{:replyto_id => replyto.id, :replyto_type => replyto.class.to_s, :comment =>
comment}, {:user_id => $BASIC_USER}
    assert_response :success

    commentObj = Comment.find(:all,:conditions => {:comment => comment})
    assert_equal 1, commentObj.length, 'there isnt 1 object in the array as expected'
    assert_instance_of Comment, commentObj[0] , 'Weburl does not contain my save comment'
    assert_equal  comment, commentObj[0].comment , 'Save comment is not my expected comment'
    assert_equal  replyto, commentObj[0].commentable , 'Save commentable is not my expected commentable'
    assert_equal  $BASIC_USER, commentObj[0].user.id , 'Save user id  is not my expected user id'

    assert_template('weburl/comment.rjs')
    assert_select_rjs :replace_html, "discussion_thread_container"
  end

end
Comment 2 xlash911 2009-01-28 21:49:52 UTC
Created attachment 76324 [details]
Only 5 tests run!!!! out of 6
Comment 3 xlash911 2009-01-28 21:50:20 UTC
Created attachment 76325 [details]
Now all 6 tests are ran
Comment 4 Erno Mononen 2009-01-29 08:35:39 UTC
Thanks for the report, I will look at this ASAP.
Comment 5 Erno Mononen 2009-01-29 12:34:43 UTC
Should be fixed now in changeset 1cf96965a515. There'll be an automated notification here (with a download link) when 
the fix has been integrated, could you then plese verify that it works for you too? If it does, the fix can be 
delivered in the next update patch for 6.5.
Comment 6 Quality Engineering 2009-01-30 08:46:39 UTC
Integrated into 'main-golden', will be available in build *200901300228* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1cf96965a515
User: Erno Mononen <emononen@netbeans.org>
Log: #157577: Rails Rake test:functionals abnormal results with invalid test names