ruby_test_student_grader
A Ruby gem for generating academic test reports in HTML format. Initially designed for automated grading of university programming assignments, with flexibility to adapt to different testing frameworks.
Current Status: Early Development (Beta)
Primary Use: Automated evaluation of academic coding tasks
Future Goal: Modular system for diverse testing scenarios
Installation
Local Development
Add to your Rails Gemfile:
gem 'ruby_test_student_grader', path: '/path/to/gem/directory'
Then run:
bundle install
From RubyGems (Once Published)
gem install ruby_test_student_grader
Basic Usage
Configure in your test helper:
test/test_helper.rb
require 'ruby_test_student_grader'
Minitest.after_run do
RubyTestStudentGrader::Reporter.new(
total_score, # Calculated score
max_score, # Maximum possible score
failed_tests, # Array of failed test names
automated_feedback # Generated feedback summary
).generate
end
Report will be generated at:
A Ruby gem for generating academic test reports in HTML format. Initially designed for automated grading of university programming assignments, with flexibility to adapt to different testing frameworks.
Current Status: Early Development (Beta)
Primary Use: Automated evaluation of academic coding tasks
Future Goal: Modular system for diverse testing scenarios
Installation
Local Development
Add to your Rails Gemfile:
gem 'ruby_test_student_grader', path: '/path/to/gem/directory'
Then run:
bundle install
From RubyGems (Once Published):
gem install ruby_test_student_grader
Basic Usage
Configure in your test helper:
test/test_helper.rb
require 'ruby_test_student_grader'
Minitest.after_run do
RubyTestStudentGrader::Reporter.new(
total_score, # Calculated score
max_score, # Maximum possible score
failed_tests, # Array of failed test names
automated_feedback # Generated feedback summary
).generate
end
Report will be generated at:
public/test_report.html
Evaluated Data
- Test results (pass/fail)
- Score calculations
- Execution metadata
- Custom feedback
- Detailed error traces
Development Current Features
- HTML Report Generation
- Academic Grading System
- Detailed Error Analysis
- Customizable Templates
Planned Features
- PDF/CSV Export
- LMS Integration
- Code Similarity Detection
- AI-Powered Feedback
Academic Configuration
RubyTestStudentGrader.configure do |config|
config.grading_scale = {
passing: 4.0,
excellence: 5.5
}
config.rubric = {
code_quality: 30%,
coverage: 20%,
functionality: 50%
}
end
Architecture
lib/
├── ruby_test_student_grader/
│ ├── reporter.rb # Core logic
│ ├── template.html.erb # HTML template
├── ruby_test_student_grader.rb # Main module
Contributing
We welcome contributions for:
- New report formats
- Additional framework support
- Code analysis improvements
- AI integration modules
License
MIT License - See LICENSE. Requires attribution in academic materials using this software.
Educational assessment tool - Adaptable for diverse pedagogical needs.
Note: This project is in very early stage and could have major bugs
Try the new features
See README_PROBAR.md
for a step-by-step guide. Quick summary:
# HTML and CSV
reporter = RubyTestStudentGrader::Reporter.new(5.2, 6.0, ["test_model"], "Good job", course_name: "IIC2143")
reporter.generate
reporter.generate_csv("public/test_report.csv")
# PDF (optional, requires prawn)
reporter.generate_pdf("public/test_report.pdf")
# Multiple students
students = [ { id: 1, name: "Alice", total_score: 5.2, max_score: 6.0, failed_tests: ["test_model"], feedback: "OK" } ]
RubyTestStudentGrader::ClassReporter.new(students, course_name: "IIC2143", output_dir: "public/reports").generate_all
# Similarity
RubyTestStudentGrader::Similarity.jaccard("def a;1;end", "def b;1;end", k: 5)
Demo script
Use the demo script to verify everything end-to-end.
- Path:
scripts/demo.rb
- It will:
- Generate HTML and CSV in
public/
- Try to generate PDF (if
prawn
is installed) - Create per-student reports and an index under
public/reports/
- Print a code similarity score
- Generate HTML and CSV in
Run:
bundle exec ruby scripts/demo.rb
Optional (for PDF):
bundle add prawn
Tip: set a course name for the report via env var (optional):
export COURSE_NAME="IIC2143"
Extras
- CSV export:
RubyTestStudentGrader::Reporter#generate_csv("public/test_report.csv")
- PDF export (optional, requires prawn):
RubyTestStudentGrader::Reporter#generate_pdf("public/test_report.pdf")
- Course name in HTML/CSV/PDF: pass
course_name: "IIC2143"
to the constructor or setCOURSE_NAME
in your environment.
Reports for multiple students
students = [
{ id: 1, name: "Alice", total_score: 5.2, max_score: 6.0, failed_tests: ["test_model"], feedback: "Good job" },
{ id: 2, name: "Bob", total_score: 3.9, max_score: 6.0, failed_tests: ["test_controller"], feedback: "Check controllers" }
]
RubyTestStudentGrader::ClassReporter.new(students, course_name: "IIC2143", output_dir: "public/reports").generate_all
Basic similarity detection
RubyTestStudentGrader::Similarity.jaccard(code_a, code_b, k: 5) # => 0.0..1.0