CoolFace
Modelpublic

metindeder/test-master-unit-test-model-GGUF

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
0likes19downloads
Model Card

TestMaster-7B-GGUF: Resource-Efficient Polyglot Unit Test Generator

Model Architecture Quantization Testing

TestMaster-7B is a specialized Large Language Model (LLM) fine-tuned for generating robust, industrial-grade unit tests across multiple programming languages. Built upon Qwen2.5-Coder-7B-Instruct and fine-tuned using Unsloth, this model is optimized for logic reasoning, edge-case detection, and mock architecture simulation.

This repository contains the 4-bit Quantized (GGUF - Q4_K_M) version, designed to run efficiently on consumer hardware (e.g., NVIDIA RTX 3070, 8GB VRAM) with minimal performance loss compared to the FP16 baseline.

๐Ÿš€ Key Features

  • โ€”Resource Efficient: Runs on ~4.5 GB of VRAM/RAM.
  • โ€”Polyglot Capabilities: Master-level performance in C, Java, Go, Python, C++, JavaScript, and even ROS2.
  • โ€”Advanced Reasoning: Capable of handling complex scenarios like:
  • โ€”Memory Safety (Null pointer checks in C).
  • โ€”Concurrency (Goroutines/WaitGroups in Go).
  • โ€”Reflection & Retry Logic (Java).
  • โ€”Async/Promise Mocking (JavaScript/Jest).
  • โ€”ASTER Methodology: Trained with principles inspired by Automated Software Testing & Error Remediation, focusing on compilability and behavioral correctness.

๐Ÿ“Š Performance Evaluation

The model has been rigorously tested across various programming languages and complex testing scenarios. Below is the updated summary of its performance:

LanguageTest CategoryDifficultySuccess RateKey Observation
PythonMocking & AsyncIO๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ100%Flawless usage of AsyncMock, IsolatedAsyncioTestCase and assert_awaited.
JavaJUnit 5 & Mockito๐Ÿ”ฅ๐Ÿ”ฅ100%Correctly migrated to JUnit 5 (ExtendWith); perfect Negative Testing & Verification logic.
JavaScriptJest & API Mocking๐Ÿ”ฅ๐Ÿ”ฅ100%Proactively used axios-mock-adapter instead of manual mocks; clean async/await flow.
C#xUnit & Moq๐Ÿ”ฅ๐Ÿ”ฅ100%Clean "Arrange-Act-Assert" structure; correct usage of It.IsAny and Attribute injection.
GoInterface Mocking๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ95%Correct usage of testify/mock embedding; handled struct-interface relationships well.
C++Google Test/Mockโš™๏ธ98%Updated to modern MOCK_METHOD syntax; correctly managed memory (pointers) in SetUp/TearDown.
RustTraits & Mockall๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ95%Successfully navigated ownership rules; correct usage of Box<dyn> and #[automock].
PHPBackend Testing๐Ÿ”ฅ๐Ÿ”ฅ100%Chose industry-standard Mockery library over basic PHPUnit methods for better readability.
CMemory Safety๐Ÿ”ฅ๐Ÿ”ฅ100%Proactively prevents SegFaults using sizeof and null checks.

<details> <summary>๐Ÿ“‹ Click to Show All Training Data (Log)</summary>

StepLoss
50.850300
100.857600
150.889200
200.849300
250.845600
300.801700
350.776000
400.811000
450.744900
500.742400
550.701500
600.728600
650.695400
700.631200
750.668300
800.602800
850.628700
900.657700
950.595500
1000.592900
1050.634900
1100.665500
1150.616500
1200.615300
1250.584500
1300.622000
1350.606700
1400.577100
1450.611500
1500.579300
1550.562100
1600.595000
1650.599200
1700.547900
1750.598000
1800.566500
1850.576300
1900.543700
1950.533000
2000.575800
2050.585400
2100.555400
2150.599300
2200.528900
2250.560100
2300.579700
2350.557400
2400.518200
2450.541800
2500.534200
2550.538100
2600.570400
2650.518400
2700.527300
2750.550300
2800.536100
2850.550300
2900.551200
2950.558500
3000.529000
3050.567800
3100.530300
3150.545600
3200.529100
3250.511600
3300.538000
3350.569400
3400.524100
3450.535100
3500.573300
3550.544000
3600.547900
3650.544900
3700.533300
3750.540300
3800.543000
3850.563800
3900.514600
3950.549900
4000.562600
4050.539200
4100.580100
4150.557300
4200.555000
4250.525200

</details>

๐Ÿ’ป Usage

Prompt Format (ChatML)

This model uses the ChatML template. Strict adherence to this format is recommended for optimal results.

text
<|im_start|>system
You are an expert software tester. Your goal is to write a comprehensive unit test.<|im_end|>
<|im_start|>user
Instruction:
Write a unit test for the following [Language] code...

Input:
[Source Code Here]
<|im_end|>
<|im_start|>assistant

Running with LM Studio / Ollama

  1. 1.Download the .gguf file from this repository.
  2. 2.Load it into your preferred GGUF runner (LM Studio, Ollama, etc.).
  3. 3.System Prompt: Set the system prompt to: "You are an expert programmer and unit test generator."
  4. 4.Context Window: Recommended set to 4096 or 8192.

Running with Python (llama-cpp-python)

python
from llama_cpp import Llama

llm = Llama(
    model_path="./unit-test-model-q4_k_m.gguf",
    n_ctx=4096,
    n_gpu_layers=-1, # Offload all layers to GPU
    verbose=False
)

prompt = """<|im_start|>system
You are an expert unit test generator.<|im_end|>
<|im_start|>user
Write a Python unit test for a function that divides two numbers.<|im_end|>
<|im_start|>assistant"""

output = llm(
    prompt,
    max_tokens=1024,
    stop=["<|im_end|>"],
    echo=False
)

print(output['choices'][0]['text'])

โš ๏ธ Limitations & Bias Python Imports: In very complex Python scenarios involving obscure libraries, the model might occasionally miss an import statement or hallucinate a mock path.

Context Window: While optimized, extremely large source code files might exceed the context window. It is recommended to test modular functions or classes.

Self-Healing: For dynamic languages (Python, JS), we recommend using this model in a "Self-Healing" loop (Execution -> Error Capture -> Repair) for 100% reliability.

๐Ÿ“œ License This model is a fine-tune of Qwen2.5-Coder and is licensed under Apache 2.0.

๐Ÿค Acknowledgments Fine-tuned using Unsloth (2x faster training).

Base model by Qwen Team.

Dataset curated for ASTER (Automated Software Testing & Error Remediation) research.