# How to run a single test method

**URL:** <https://www.ruby-forum.com/t/how-to-run-a-single-test-method/149939>\
**Category:** Ruby\
**Created:** [October 1, 2008, 11:56am UTC](https://www.ruby-forum.com/t/how-to-run-a-single-test-method/149939 "2008-10-01T11:56:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliangall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@juliangall](https://www.ruby-forum.com/u/juliangall)\
**Post date:** [October 1, 2008, 11:56am UTC](https://www.ruby-forum.com/t/how-to-run-a-single-test-method/149939/1 "2008-10-01T11:56:55Z")

</div>

Is there a way of running a single test in the Ruby testrunner  
environment? I currently run all of the tests in my test class and suite  
with:

Test::Unit::UI::Console::TestRunner.run(TC\_my\_test)

or:

Test::Unit::UI::Console::TestRunner.run(TC\_my\_suite)

I would like to be able to run a single test method from TC\_my\_test. I  
notice that JUnit has runSingleMethod but can’t find an equivalent for  
Ruby.

N.B. This has to be run from the Google Sketchup Ruby command line as I  
am writing code in this environment. i.e. I have access to what is  
effectively an irb interface but not the ruby command (where I could add  
–name test\_my\_test for the test name).

Thanks for any help.

Julian

---

<div class="post-metadata">

**Author:** ![juliangall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@juliangall](https://www.ruby-forum.com/u/juliangall)\
**Post date:** [October 13, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/how-to-run-a-single-test-method/149939/2 "2008-10-13T19:46:49Z")

</div>

I am using:

Test::Unit::UI::Console::TestRunner.run(TC\_my\_test.new(‘test\_me’))

where test\_me is the name of the single test you wish to execute.

---

<div class="post-metadata">

**Author:** ![juliangall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@juliangall](https://www.ruby-forum.com/u/juliangall)\
**Post date:** [October 13, 2008, 8:16pm UTC](https://www.ruby-forum.com/t/how-to-run-a-single-test-method/149939/3 "2008-10-13T20:16:53Z")

</div>

Dear unknown,

You are a genius! Thank you very much. That is just what I was looking  
for.

Julian
