From 2aa6d52a162c3a7fb9c3ea881e45a403815f2f34 Mon Sep 17 00:00:00 2001 From: pranjalg1331 <121032858+pranjalg1331@users.noreply.github.com> Date: Thu, 21 Aug 2025 11:16:03 +0530 Subject: [PATCH 1/3] Create gsoc25_refactor_analyzer_tests.md --- Blogs/gsoc25_refactor_analyzer_tests.md | 88 +++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Blogs/gsoc25_refactor_analyzer_tests.md diff --git a/Blogs/gsoc25_refactor_analyzer_tests.md b/Blogs/gsoc25_refactor_analyzer_tests.md new file mode 100644 index 0000000..b1d6dde --- /dev/null +++ b/Blogs/gsoc25_refactor_analyzer_tests.md @@ -0,0 +1,88 @@ +# Migrating IntelOwl Analyzer Tests: From Monkeypatching to a Structured Unit Testing Framework + +For IntelOwl, which integrates dozens of analyzers to process a wide range of observables, maintaining robust and reliable tests is crucial. This summer, during my GSoC project, I worked on **migrating IntelOwl’s analyzer tests** from a **monkeypatch-heavy approach** to a **structured, maintainable unit testing framework** using Python’s built-in `unittest` module. + +The goal was to improve reliability, reduce code duplication, and provide contributors with a simpler way to write and extend tests. + +--- + +## 🌱 Pre-GSoC Contributions + +Before being selected for GSoC, I was already actively contributing to IntelOwl and its ecosystem. These contributions not only helped me understand the codebase deeply but also demonstrated my commitment to the project. + +Here are some of my notable pre-GSoC deliverables: + +- **IntelOwl analyzers**: + - [UltraDNS Analyzer (#2620)](https://github.com/intelowlproject/IntelOwl/pull/2620) + - [Nuclei Analyzer (#2697)](https://github.com/intelowlproject/IntelOwl/pull/2697) + - [Alter DNS Malicious Detector (#2753)](https://github.com/intelowlproject/IntelOwl/pull/2753) + - [Spamhaus IPv6 and ASN Support (#2761)](https://github.com/intelowlproject/IntelOwl/pull/2761) + - [ShellCheck Analyzer (#2775)](https://github.com/intelowlproject/IntelOwl/pull/2775) + - [Malshare Ingestor (#2804)](https://github.com/intelowlproject/IntelOwl/pull/2804) + +- **IntelOwl Integrations & SDKs**: + - [GreedyBear Ingestor (#2709)](https://github.com/intelowlproject/IntelOwl/pull/2709) + - [Playbook Support (#70)](https://github.com/intelowlproject/go-intelowl/pull/70) + - [Pre-commit hooks for SDK (#71)](https://github.com/intelowlproject/go-intelowl/pull/71) + - [Job List Error Fix (#263)](https://github.com/intelowlproject/pyintelowl/pull/263) + - [Pages Flag for Listing Jobs (#265)](https://github.com/intelowlproject/pyintelowl/pull/265) + - [HealthCheck URL Correction (#266)](https://github.com/intelowlproject/pyintelowl/pull/266) + +These early contributions gave me strong familiarity with IntelOwl’s analyzers, ingestors, SDKs, and testing setup. Naturally, this became the foundation for my GSoC work on **refactoring analyzer tests**. + +--- + +## 🔎 The Problem + +Previously, IntelOwl relied heavily on **monkeypatching** for testing analyzers. While it worked, it came with drawbacks: + +- Limited flexibility for adding **custom tests** for complex analyzers. +- Harder for new contributors to extend or debug. + +We needed a **systematic, scalable approach**—one that could: +1. Cover all analyzers with all supported observable types. +2. Reduce duplication by leveraging reusable test classes. +3. Support both automated and custom tests. +4. Make future contributions easier. + +--- + +## 🛠 My GSoC Work + +I approached the migration in clear phases: + +- **Framework Design:** Built a reusable superclass for analyzer tests, eliminating duplication and replacing monkeypatch-heavy logic. +- **Expanding Coverage:** Extended the framework to cover all analyzers, ensuring they worked with all supported observable types. +- **Documentation:** Wrote contributor-friendly guidelines to help future maintainers and contributors easily extend tests. +- **Polishing:** Final refinements, debugging, and optimization to make the framework stable and efficient. + +By the end of GSoC, IntelOwl’s analyzers are now backed by a **clean, extensible, and fully documented unit testing framework**. + +👉 Related PRs from my GSoC work: +- [IntelOwl: Refactor Analyzer Tests (#2886)](https://github.com/intelowlproject/IntelOwl/pull/2886) +- [Docs: Updated Testing Documentation (#38)](https://github.com/intelowlproject/docs/pull/38) +--- + +## 🚀 The Outcome + +Key achievements: +- ✅ **100% analyzer coverage** with unit tests. +- ✅ **Monkeypatching eliminated** (where unnecessary). +- ✅ **Custom analyzer tests** applicable for complex cases. +- ✅ **Contributor-friendly documentation** for future maintainers. + +--- + +## 💭 Reflections + +Being part of GSoC with IntelOwl has been a truly rewarding journey. From my first pre-GSoC contributions to completing a full-scale migration of the testing framework, I’ve grown both technically and personally. It was an incredible learning experience—improving my skills in Python testing, open-source collaboration, and large-scale project design. + +More than anything, I feel proud to have contributed to making IntelOwl more reliable and sustainable for the community. This journey has reinforced my passion for open source. + +--- + +## 🙌 Acknowledgements + +A huge thanks to the IntelOwl maintainers for guidance and feedback throughout the migration process. + +--- From effde33471ed7caa55c9de44688d4d5cfbab0fc7 Mon Sep 17 00:00:00 2001 From: pranjalg1331 <121032858+pranjalg1331@users.noreply.github.com> Date: Tue, 26 Aug 2025 00:57:49 +0530 Subject: [PATCH 2/3] Update gsoc25_refactor_analyzer_tests.md --- Blogs/gsoc25_refactor_analyzer_tests.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Blogs/gsoc25_refactor_analyzer_tests.md b/Blogs/gsoc25_refactor_analyzer_tests.md index b1d6dde..3fe0be8 100644 --- a/Blogs/gsoc25_refactor_analyzer_tests.md +++ b/Blogs/gsoc25_refactor_analyzer_tests.md @@ -1,3 +1,8 @@ +title: Migrating IntelOwl Analyzer Tests +date: 2025-08-25 +cover: /images/gsoclogo.png +author: Pranjal Gupta + # Migrating IntelOwl Analyzer Tests: From Monkeypatching to a Structured Unit Testing Framework For IntelOwl, which integrates dozens of analyzers to process a wide range of observables, maintaining robust and reliable tests is crucial. This summer, during my GSoC project, I worked on **migrating IntelOwl’s analyzer tests** from a **monkeypatch-heavy approach** to a **structured, maintainable unit testing framework** using Python’s built-in `unittest` module. From 766ed6d21e86fb354fa9b92d56644bee304b24b2 Mon Sep 17 00:00:00 2001 From: pranjalg1331 <121032858+pranjalg1331@users.noreply.github.com> Date: Tue, 26 Aug 2025 00:58:06 +0530 Subject: [PATCH 3/3] Update Blogs/gsoc25_refactor_analyzer_tests.md Co-authored-by: Federico Gibertoni <152909479+fgibertoni@users.noreply.github.com> --- Blogs/gsoc25_refactor_analyzer_tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Blogs/gsoc25_refactor_analyzer_tests.md b/Blogs/gsoc25_refactor_analyzer_tests.md index 3fe0be8..94b6d74 100644 --- a/Blogs/gsoc25_refactor_analyzer_tests.md +++ b/Blogs/gsoc25_refactor_analyzer_tests.md @@ -74,7 +74,7 @@ Key achievements: - ✅ **100% analyzer coverage** with unit tests. - ✅ **Monkeypatching eliminated** (where unnecessary). - ✅ **Custom analyzer tests** applicable for complex cases. -- ✅ **Contributor-friendly documentation** for future maintainers. +- ✅ **Contributor-friendly documentation** for future maintainers and contributors. ---