Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:57:53+00:00 2026-05-30T03:57:53+00:00

I am testing some Ruby code and have a failing Test::Unit::TestCase. Unfortunately, the failure

  • 0

I am testing some Ruby code and have a failing Test::Unit::TestCase. Unfortunately, the failure report only gives me the top error, not a full stack trace. Specifically, it says:

 1) Failure:
test_tp_make(TestScripts::TestTpMake) [test/test_scripts.rb:73]:
Exception raised:
<#<NoMethodError: undefined method `[]' for nil:NilClass>>.

The line number referenced (73) is the start of an assert_nothing_raised code block in my test case, which in turn starts another code block, which in turn calls in to a large library.

I have tried running the test with the –verbose flag, unfortunately this does not change the exception output. I tried consulting the Test::Unit documentation, but it does not seem to enumerate the available options (for example, there’s nothing useful here). Searching the web and StackOverflow surfaced some answers on how to enable stack tracing in Rails, but this is non-Rails ruby code.

I could extract the failing code from the test and run it outside of Test::Unit, enabling me to see all the output. But it will be a pain to do this every time I have a failing test.

Does anyone know how to get Test::Unit to give me a full stack trace?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:57:55+00:00Added an answer on May 30, 2026 at 3:57 am

    Looking through the code of Test::Unit in Ruby 1.8, it seems all the errors go through the Test::Unit::Error object which filters the backtrace in its #long_display method. There is no configuration and all runners will use the same filtered trace.

    Brute force monkey patch to get the whole trace: (I put this in my single test case file; perhaps you could put it in a test helper)

    require 'test/unit/util/backtracefilter'
    
    module Test::Unit::Util::BacktraceFilter
      def filter_backtrace(backtrace, prefix=nil)
        backtrace
      end
    end
    

    And monkey patch for Ruby 1.9 (which uses minitest)

    def MiniTest.filter_backtrace(bt)
      bt
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have been testing some very basic things in ruby and discover the
Hello I have a trouble with Ruby unit testing, I'm new to it so
We're starting to standardise on a Ruby-based testing framework, having had some very good
I am testing some weird-looking CSS code that I wrote (I'm using a mix
Hi I'm testing some CRUD operations in Nhibernate. I have 3 tests in this
I have some concerns related to the fact of testing some functions containing the
I have just started out with testing some php mvc framework In it, it
I have a ASP.NET MVC site using Membership Provider. I have trouble testing some
Code and preview: <html> <head> <title>Testing some CSS</title> <style type=text/css> .dDay { font-size:205% }
I'm trying to do some scripted GUI testing in Windows using Ruby. I'm leveraging

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.