WorksheetsTesting in Ruby
Total questions: 15
Worksheet time: 10mins
What is the process of evaluating a piece of software to determine whether it meets specified requirements and to identify any defects?
What does TDD stand for?
Test-Driven Development
Test-Defined Development
Test-Driven Design
What is the purpose of unit testing?
Identify bugs early
Ensure code reliability
Facilitate code changes
What are the benefits of using unit testing?
Catches issues early in development
Simplifies debugging
Provides documentation for code
Enhances code maintainability
What command is used to run the test in RSpec?
rspec greeter_spec.rb
run greeter_spec.rb
test greeter_spec.rb
What does benchmarking measure?
How fast your code runs
How much memory your code uses
How many bugs are in your code
What is the purpose of profiling?
Identify parts of your code that need optimization
Measure how fast your code runs
Check for bugs in your code
What Ruby feature allows jumping out of loops conditionally?
Return
Raise
Catch and Throw
Exit
What is the purpose of a breakpoint in the Ruby debugger?
To speed up code
To end execution
To pause code and inspect state
To handle exceptions
What is the first step in Test-Driven Development (TDD)?
Write the code
Deploy the app
Write the test
Run the test
Which command is used to run tests written in RSpec?
ruby spec_test.rb
run greeter_test
rspec greeter_spec.rb
run rspec_test.rb
Which Ruby library helps find memory/time bottlenecks?
MiniTest
RubyProf
Faker
ActiveRecord
What is the purpose of RDoc in Ruby?
Running unit tests
Profiling code performance
Generating HTML documentation from Ruby source code
Debugging syntax errors
What command is used to generate documentation using RDoc?
ruby doc.rb
rdoc
generate doc
rspec
How do you write a comment in RDoc for a class?
// This is a class
/* Class comment */
# This is a class
## Class: ClassName
