Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the community-preferred Ruby unit testing framework?

Tags:

In the Java space, JUnit is predominately used and in .NET I believe nUnit is very popular. Is a community agreed upon unit testing framework for the Ruby world?

Background: I ask because I am new to Ruby and want to practice TDD at same time as I learn Ruby. So far I've only played with Test::Unit.

like image 314
Jon Homan Avatar asked Sep 25 '09 20:09

Jon Homan


People also ask

What is the testing framework for Ruby?

RSpec is a popular BDD framework for testing Ruby/Rails applications. Depending on your project type (Ruby or Rails), use the rspec or rspec-rails gem.

Which framework is used for unit testing?

For performing unit tests on Java-based applications, developers often use two frameworks: JUnit and NUnit. Developed by Erick Gamma and Kent Beck, JUnit is the preferred choice for automating unit tests for Java-based applications. It was developed with the sole intention of writing and running repeatable tests.

Can we use selenium for unit testing?

For most testing scenarios, Selenium Automation Testing is considered an ideal option. But, when it comes to unit testing, developers need a modern automated unit testing framework that can create automated unit test cases and quickly integrates with Selenium.


2 Answers

You can stick to Test::Unit or you can have nice extensions to it using Shoulda or some cool contexts using Context.

On the other side, if you prefer BDD then you can safely stick to RSpec.

As for for acceptance testing use Cucumber .

like image 146
khelll Avatar answered Sep 29 '22 23:09

khelll


See also What’s the most commonly used unit testing framework for different types of Ruby applications? question.

like image 33
Kaitsu Avatar answered Sep 29 '22 23:09

Kaitsu