00:00:28.960
Welcome back, everyone! We're going to start our next speaker now. He is Masafumi Okura, the organizer of RubyConf Taiwan and the author of a project called Ela Elba J. Today, he will talk about writing a Minitest clone in just 30 minutes.
00:00:58.920
Welcome! I'll be sitting most of the time during this talk because I plan to do some live coding. Let's get started! This talk is about Minitest. Please raise your hand if you have used Minitest before. Oh, really? I expected a much lower percentage of users!
00:01:10.000
That's great! For those who haven't used it, I'd like to show some features first because it will be easier for you to understand what’s going on. Minitest is simpler compared to other testing frameworks like RSpec. With Minitest, you only need to remember classes, methods, and assertions. It’s straightforward—there's no complex DSL to learn. It’s fast, and though I haven't benchmarked it yet, I believe it's faster than RSpec, and it has a clean and readable style, which is important to me.
00:01:51.240
As we implement a clone of Minitest, we need to focus on keeping it simple. I created a meme to illustrate the comparison, showing that Minitest’s source code length is much smaller than RSpec’s. Who can guess how many lines of code there are in Minitest? The source code length is about 10,000 lines, while RSpec has around 7,800 lines. It’s essential to acknowledge that Minitest is easier to understand and work with.
00:03:03.920
Before diving into the code, let me introduce myself. My name is Masafumi Okura, and I am originally from Tokyo. I work as a freelancer, and my activities include contributions to RubyConf and creating open-source projects, such as helping with Ruby language learning resources. For this talk, I aim to write a simple testing framework based on Minitest. Although it's challenging to fully implement it in 30 minutes, I will try to represent its core functionality.
00:05:10.960
I'll be using my development environment during the talk. I use a text editor that might provide you with new insights about coding. I want to illustrate how to set up a basic test framework and go through the essential aspects of running and executing tests together.
00:06:12.720
So, let's start by reviewing the code. Remember, Minitest already exists, but I’ve slightly changed its name to Minitest Taiwan to indicate my version. It has a setup method that runs before each test. When initiating the test framework, we define how we can manage test cases and their execution. We'll discuss how to deal with potential failures and how to capture these exceptions properly to ensure our test suite works as intended. Through this, we’ll also explore implementation strategies for handling assertions and managing expected outcomes versus actual results.
00:32:59.840
In conclusion, I encourage everyone to enjoy coding and to continuously learn, as I have learned so much during the preparation for this talk. I created two Ruby pull requests to fix documentation issues, and I've enjoyed the process. Overall, coding is a fun and rewarding endeavor!
00:37:45.260
Thank you so much for your attention! If you have any questions, please feel free to ask. Remember that while making a Minitest clone, nuances about assertion behaviors are crucial. I appreciate your engagement and hope you found this session valuable. Now, let’s take a break and prepare for the next speaker.