Skip to content

Fix/test_sanitize#4803

Draft
stepanLav wants to merge 3 commits intodevfrom
fix/test_sanitize
Draft

Fix/test_sanitize#4803
stepanLav wants to merge 3 commits intodevfrom
fix/test_sanitize

Conversation

@stepanLav
Copy link
Member

@stepanLav stepanLav commented Sep 29, 2025

Description

In that PR we added stryker to analyse our unit-tests, based on generated report we removed some tests, which is not found any mutants

Report:
mutation-report.html
mutation-report.json

Added a script to analyse that reports, and then removed all tests which is not covered any changes in codebase

Summary:

### 📊 **Key Findings**

**Overall Mutation Score: 0.94%** - This is extremely low and indicates that your tests are not effectively catching bugs.

### 📈 **Statistics Summary**
- **Total Mutants Tested**: 67,153
- **Killed Mutants**: 633 (0.94%)
- **Survived Mutants**: 190 (0.28%)
- **No Coverage Mutants**: 66,310 (98.74%)
- **Timeout Mutants**: 20
- **Files Analyzed**: 1,599

### 🔴 **Critical Issues (1,566 files with 0% mutation score)**
These files have **NO test coverage** and should be **deleted or completely rewritten**:
- All main process files (`src/main/`)
- Most renderer components and business logic
- Most aggregates and domain models
- Most UI components

### 🟠 **Poor Test Coverage (6 files with 0-30% score)**
These need **major refactoring**:
- `src/renderer/shared/lib/utils/functions.ts` (4.6%)
- `src/renderer/shared/i18n/lib/constants.ts` (6.7%)
- `src/renderer/shared/lib/utils/strings.ts` (9.5%)
- `src/renderer/shared/di/helpers.ts` (20.0%)
- `src/renderer/shared/api/price-provider/lib/constants.ts` (20.0%)
- `src/renderer/shared/api/chain-verification/service/verificationService.ts` (26.9%)

### 🟡 **Fair Test Coverage (15 files with 30-70% score)**
These need **minor improvements**:
- Various utility functions and services
- Some API services and data processing functions

### 🟢 **Good Test Coverage (12 files with 70%+ score)**
These are **performing well** and should be kept:
- `src/renderer/shared/lib/hooks/useClickOutside.ts` (70.6%)
- `src/renderer/features/assets/AssetsSearch/model/assets-search-model.ts` (75.0%)
- `src/renderer/shared/lib/utils/createAsyncTaskPool.ts` (75.4%)
- And 9 more files with good coverage

## 📋 **Action Plan**

### 1. 🔴 **DELETE** tests for 1,566 files with 0% mutation score
These tests provide no value and are just maintenance overhead.

### 2. 🟠 **COMPLETELY REWRITE** tests for 6 files with poor coverage
Focus on strengthening assertions and adding edge case testing.

### 3. 🟡 **IMPROVE** tests for 15 files with fair coverage
Add more comprehensive test scenarios and error condition testing.

### 4. ✅ **KEEP** and maintain the 12 files with good coverage
These are your examples of well-written tests.

## 🎯 **Focus Areas for Improvement**

1. **Strengthen assertions** to catch more edge cases
2. **Add tests for error conditions** and boundary values
3. **Ensure tests validate actual business logic**, not just happy paths
4. **Consider adding integration tests** for complex business logic
5. **Focus on the 33 files** (6 poor + 15 fair + 12 good) that actually have some test coverage

## 📄 **Reports Generated**

- **HTML Report**: `reports/mutation/mutation-report.html` (detailed interactive report)
- **Analysis Script**: `correct-analysis.js` (reusable analysis tool)
- **Stryker Config**: `stryker.conf.js` (configuration for future runs)

The mutation testing reveals that your current test suite is largely ineffective. Focus on either deleting the ineffective tests or completely rewriting them with proper assertions and edge case coverage.
``

@github-actions
Copy link
Contributor

github-actions bot commented Sep 29, 2025

Unit Test Results

  1 files   39 suites   2s ⏱️
210 tests 208 ✅ 2 💤 0 ❌
226 runs  224 ✅ 2 💤 0 ❌

Results for commit 094c6ba.

♻️ This comment has been updated with latest results.

@stepanLav stepanLav marked this pull request as draft September 29, 2025 19:28
@stepanLav stepanLav linked an issue Sep 30, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up old unit-tests

1 participant