How to Use ZenTest with Ruby
If you're interested in learning more about refactoring, grab a copy of Refactoring: Improving the Design of Existing Code and take a look at www.refactoring.com. For more information about unit testing, please see c2.com/cgi/wiki?UnitTest www.junit.org/index.htm and www.extremeprogramming.org/rules/unittests.html.
The latest information about Test::Unit and ZenTest can be found on theirs home pages, testunit.talbott.ws and www.zenspider.com/ZSS/Products/ZenTest.
-- -pate http://on-ruby.blogspot.com
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- RSS Feeds
- Readers' Choice Awards
- Tech Tip: Really Simple HTTP Server with Python
- BASH script to log IPs on public web server
1 hour 29 min ago - DynDNS
5 hours 5 min ago - Reply to comment | Linux Journal
5 hours 37 min ago - All the articles you talked
8 hours 1 min ago - All the articles you talked
8 hours 4 min ago - All the articles you talked
8 hours 5 min ago - myip
12 hours 30 min ago - Keeping track of IP address
14 hours 21 min ago - Roll your own dynamic dns
19 hours 34 min ago - Please correct the URL for Salt Stack's web site
22 hours 46 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Concatenate strings with << instead
Avoid concatenating strings using += because it duplicates the receiver string that will remain unused in memory until the GC starts. You should rather use << that modifies the receiver by appending the given string to it. It's also quite faster.
... continuation of the above comment discussing the << operator
(sorry for the truncated comment above) ... You should rather use the double "lower than" operator (cannot be written here or the comment gets cut) that modifies the receiver appending the given string to it and returns the string to allow chained calls. It's also quite faster.
Note that Ryan has moved Zentest to RubyForge...
....right here.
Yours,
Tom
Re: How to Use ZenTest with Ruby
I don't think assert(1) is a good thing. That test should fail, imo. Maybe raising something like NotImplementedError would be better.
A pleasant article, anyway, now I'm wondering how cool an integration of ZenTest with FreeRIDE (and the included Refactoring-Browser plugin) could be..
Re: How to Use ZenTest with Ruby
Great idea for another article or two!
Re: How to Use ZenTest with Ruby
ooh -- ZenTest, rrb, and FreeRIDE together? that sounds really good! Rich, Ryan? are you guys listening?
Re: How to Use ZenTest with Ruby
you can try it yourself :)
I wrote a simple test generation plugin long time ago (see DumbTestBuilder on the FR wiki) in an hour, and I had never used the FreeRIDE/FreeBASE api before..
Re: How to Use ZenTest with Ruby
the assert(1) test set my alarm bells ringing, but I see your point...
Test::Unit is Another Good Reason To Use Ruby, but I always find myself copying an existing testsuite and editing because I cant' remember syntax worth a damn, so anything that bootstraps a test*rb creation is worth its weight in gold..
Re: How to Use ZenTest with Ruby
Excellent. I always wondered what was the easiest way of adding unit tests and what you show here is really simple and straightforward. I love it.
Re: How to Use ZenTest with Ruby
Hey, that's excellent! Thanks for the article.
--Gavin Sinclair
Re: How to Use ZenTest with Ruby
Never used ZenTest before, but it seems like a good way to get started with adding unit testing to those old project I started before I learned how to write decently tested code.
I always like helpers that save me a step or two.
Re: How to Use ZenTest with Ruby
I had never looked into ZenTest, but now that I realize it creates Test::Unit tests for you, it does sound like a great way to deal with legacy (i.e., "not written test-first", in TDD parlance) code.
Re: How to Use ZenTest with Ruby
ZenTest is bidirectional, so it is also a great way to do test-first. Write the tests, run them... throw exceptions galore because the classes referenced do not exist. ZenTest will fill in those blanks for you as well.
Re: How to Use ZenTest with Ruby
Very cool article. I often scan over the code with my eyes and see what I am missing and try to do the refactoring manually. I had never heard of Zentest before this article. I will have to check it out....it looks like it'll make my life easier and less error prone. ;)
Re: How to Use ZenTest with Ruby
Wow! ZenTest looks like a really cool way to generate the unit testing scaffolding code. Looks like it takes the tedium out of unit testing.
Very informative.
It would be great to see more Ruby articles like this as well.
thanks for great article,
thanks for great article, will try zentest
just to point out typo, in last assertion here, no closing paren
def test_name=
aCustomer = Customer.new("Fred Jones")
assert_equal("Fred Jones",aCustomer.name)
aCustomer.name = "Freddy Jones"
assert_equal("Freddy Jones",aCustomer.name
end
can testers use this for functional testing
can testers use this for functional testing?.
(or)
Developers can use it...
pls let me know.if tester can use this, what are the things he wants to know