For the time being, I released the application on AWS the other day, leaving the test and implementation of the detailed security part as an issue.
That's why I released it safely, but I still have to implement the test, so I investigated the test.
As a result of my research, I came to the conclusion that it is more efficient to learn RSpec first.
The contents of the investigation are listed below.
--What is a test? --What is the testing framework implemented in Rails? --A brief overview of the three testing frameworks found on the net ――What is the most popular testing framework?
In order for an application to run on a production server, the application's code must be working as specified and without defects (bugs).
Testing is the process of verifying that the application's code is working as specified and finding bugs.
By finding a bug, we fix (debug) it.
Reference: [https://ja.wikipedia.org/wiki/Software Testing](https://ja.wikipedia.org/wiki/%E3%82%BD%E3%83%95%E3%83%88 % E3% 82% A6% E3% 82% A7% E3% 82% A2% E3% 83% 86% E3% 82% B9% E3% 83% 88)
The tests are run on what is called a testing framework.
There are various testing frameworks used in Rails applications.
Below is a list of some testing frameworks, along with an overview and features.
Minitest is a testing framework that comes standard with Ruby.
It comes standard so you can test it without having to add gems.
The documentation is available in the Rails Guides (https://railsguides.jp/testing.html) (English version).
Reference: https://railsguides.jp/testing.html
RSpec is a testing framework for Behavior-Driven Development tools for Ruby.
Documentation can be found at rspec-rails.
Reference: https://relishapp.com/rspec
test-unit is an xUnit unit test framework for Ruby.
The documentation is available in Unit Testing Framework for Ruby.
Reference: https://test-unit.github.io/ja/index.html
I've found three, but for engineers, it's necessary to determine the amount of knowledge on the net and what the de facto standard is, and what is appropriate to use. With that said, I tried to find out which one is the most used under the following conditions.
--Qiita is the number of articles searched in the format of "Minitest tag: rails" --GitHub uses Ruby as the language and the number of repositories searched --Results as of writing (October 6, 2020).
Testing framework | Qiita | GitHub |
---|---|---|
Minitest | 366 | 955 |
RSpec | 2151 | 11306 |
test-unit | 428 | 921 |
The table above isn't absolute, but RSpec seems to be the most used.
Certainly, I often see the word RSpec, so I was convinced.
The differences and features of each testing framework, what the BDD and xUnit systems are, etc. have not been clarified yet, but this time I will dig deeper into this detail and quit.
RSpec seems to be the most used testing framework, so I'd like to actually use it first and accumulate knowledge about what it looks like.
Even if you actually use all of them and compare them, it is inefficient.
So, it was a story that came to the conclusion that we will proceed with learning RSpec first.
Recommended Posts