The WikiEducation Dashboard?
The Wiki Education Dashboard or Dashboard is a project under Wiki Education, a spin-off of the Wikimedia Foundation. Wiki Education engages students and academics to improve Wikipedia by integrating Wikipedia into coursework for educators in Canada and the United States.
The Dashboard allows instructors or program leaders to create a "course" page, which participants can join. It gathers information about the edits made by these users and the articles they have worked on, creating a dashboard for each course. This helps instructors and others quickly view key information about the work of student editors.
The Dashboard supports two main sites:
Wikipedia Student Program Dashboard: This version of the Dashboard engages students and professors across various disciplines to improve Wikipedia while learning about their subject areas. Participants gain knowledge about how information is created and how to research and write educational articles for an encyclopedia.
Programs & Events Dashboard (P&E Dashboard): This open version of the Dashboard system is used by the global Wikimedia community. Known as the P&E Dashboard (or Peony Dashboard), it is used by thousands of program organizers worldwide to support over 10,000 events across about 300 different wikis. It is the most widely used tool for organizing edit-a-thons, Wikipedia classroom projects, and other newcomer-focused wiki programs.
The Wiki Education Dashboard codebase is a Ruby on Rails application with a server-rendered frontend that incorporates React and Redux. The codebase includes a comprehensive suite of tests. However, the current test suite frequently fails and takes approximately 30 to 35 minutes to run on GitHub CI. It is also fragile, with intermittent test failures.
My project, Improving the Wiki Education Dashboard Test Suite, aims to enhance the reliability, maintainability, and developer experience of the entire application. This work is mainly divided into the following aspects:
1. Optimizing the RSpec Test Suite
This involves:
Identifying and Resolving Intermittent Failures:
Intermittent failures are tests that sometimes pass and sometimes fail. These failures are typically caused by factors like, Interactions with external APIs that may not be available at the moment, Connectivity issues.Reducing Test Execution Time:
The current test suite takes an average of 35 minutes to execute on the CI pipeline. Certain aspects of the test suite contribute significantly to this runtime. My task involves identifying these slow components and finding strategic ways to optimize them.Improving Test Coverage and Refactoring:
There are areas in the code with significant gaps in test coverage. Additionally, some tests are outdated, difficult to understand, or in need of refactoring or rewriting. Since the project has been running for over 10 years, there have been significant modifications and improvements to the application's features that are not yet reflected in the test suite. Also, many tools used for writing these tests have been updated, which makes refactoring a necessity.
2. Workflow Optimizations on the CI/CD Pipeline
Currently, when the test suite fails on the CI pipeline, developers lack detailed information about the failure or the state of the page at the time of the failure. This makes debugging challenging. My work in this area involves:
Enhancing Debugging Tools: Improving CI pipeline workflows to ensure detailed logs and page states are available when tests fail and implementing more effective debugging methods to save developer time and effort
Ensuring Test Reliability:
The project aims to achieve a test suite that can pass 20 consecutive runs on CI without failuresReducing Execution Time:
The goal is to reduce the test suite execution time to under 20 minutes, making the CI pipeline more efficient for developers
Tools and Technologies
The Wiki Education Dashboard test suite leverages a variety of tools and frameworks to ensure the codebase is reliable, maintainable, and thoroughly tested. Here's an overview of the key tools:
1) RSpec
A testing tool for Ruby used for unit and feature tests. RSpec provides a clean and readable syntax for writing tests and integrates seamlessly with other tools in the suite, such as Capybara and Selenium WebDriver, for end-to-end testing.
2) Capybara and Selenium WebDriver
Capybara is used for writing end-to-end tests for the Ruby on Rails application, simulating user interactions in the browser. Combined with Selenium WebDriver, it allows for seamless browser automation and interaction.
3) WebMock and VCR
These tools are used to mock external API calls, reducing intermittent test failures caused by connectivity issues.
WebMock: Prevents real HTTP connections by intercepting them and returning predefined responses.
VCR: Records API responses into cassettes and replays them during tests to avoid redundant API calls, ensuring consistent and faster tests.
4) SimpleCov
A test coverage monitoring tool that provides insights into which parts of the codebase are tested and which are not. By highlighting gaps in test coverage, SimpleCov helps maintain a robust test suite.
5) FactoryBot and Shoulda Matchers
FactoryBot: Simplifies the creation of test data by providing a standardized way to define and generate objects.
Shoulda Matchers: Adds concise and readable one-liner tests for Rails models, making it easier to validate associations, validations, and scopes
Conclusion
Improving the Wiki Education Dashboard test suite ensures more reliable tests, enhanced developer experience, and better maintainability. This work boosts developer productivity and ensures the Dashboard remains a dependable tool for educators and students worldwide