1 00:00:00,000 --> 00:00:05,900 [Treehouse Presents - Quick Tips: How to Run Tests in Ruby on Rails with Jason Seifer] 2 00:00:05,900 --> 00:00:12,570 Hi, I'm Jason. In this Treehouse quick tip, we're going to talk about how to run tests in Ruby on Rails. 3 00:00:12,570 --> 00:00:19,470 Tests are small, automated Ruby programs that automatically test different parts of our applications. 4 00:00:19,470 --> 00:00:25,420 After writing some tests, you can run them using the rake command-line application. 5 00:00:25,420 --> 00:00:29,690 Now let's take a look at how to run all of the tests in our application. 6 00:00:29,690 --> 00:00:36,800 If we wanted to run the tests in our application, we would type the word "rake" followed by the word "test." 7 00:00:36,800 --> 00:00:44,440 This would go through and run the different unit, functional, and integration test in our application. 8 00:00:44,440 --> 00:00:52,970 We can also omit the word "test" and just type "rake." By typing "rake" by itself, that will run the default rake task, 9 00:00:52,970 --> 00:00:56,960 which usually just happens to be test. 10 00:00:56,960 --> 00:01:07,890 If we wanted to run just the unit test, we could say "rake test:units." The same thing happens with functional and integration tests. 11 00:01:07,890 --> 00:01:14,920 There's one other interesting rake test command, which is "rake test:uncommitted." 12 00:01:14,920 --> 00:01:20,050 This will go through and run the test for any uncommitted files in your project. 13 00:01:20,050 --> 00:01:26,910 This is useful when you're working with other developers and don't want to commit that hasn't been tested. 14 00:01:26,910 --> 00:01:32,160 Finally, if you just want to run a single test, you can do that with Ruby command. 15 00:01:32,160 --> 00:01:38,630 Make sure to include the test directory and then type out the path to the test you want to run. 16 00:01:38,630 --> 00:01:42,660 I'm going to run the user test here. And there you go. 17 00:01:42,660 --> 00:01:49,010 As you can see, Rails makes it pretty easy to run our applications tests using the rake command. 18 00:01:49,010 --> 00:01:52,010 Thanks for watching this Treehouse quick tip.