At TestZeus, we're pushing the boundaries of open source software testing stack by combining the power of innovations with cutting-edge AI technologies. Today, we’re excited to share how you can leverage Deepseek R1 for generating both UI and API tests, and seamlessly execute them using Hercules, the world’s first open-source testing agent.
The Open-Source Advantage
Open-source tools have revolutionized the software industry, offering transparency, flexibility, and significant cost savings. Deepseek R1, released under the permissive MIT license, harnesses advanced AI capabilities to generate high-quality test cases for both UI and API scenarios. With its Mixture of Experts (MoE) architecture, Deepseek R1 excels in logical inference, mathematical problem-solving, and real-time decision-making, ensuring comprehensive and effective test generation.
Hercules, our groundbreaking open-source testing agent, empowers teams to execute these tests efficiently, delivering unparalleled automation capabilities. By leveraging these tools, you not only accelerate your testing process by up to 70-80%, but also reduce dependencies on proprietary solutions that can come with hidden costs and security vulnerabilities.
Example Prompts for Test Generation with Deepseek R1
Deepseek R1 simplifies test generation by using natural language prompts. Here are a few examples to get you started:
Generating UI Tests:
Prompt:Act as an expert QA Analyst with deep expertise in Behavior-Driven Development (BDD) and Gherkin syntax. Your task is to analyze the provided **Functional Requirement Document (FRD)** and generate comprehensive **positive and negative functional test scenarios** in Gherkin format. Follow these guidelines: 1. **Input Processing**: - Parse the FRD to identify **all functional requirements**, including user stories, acceptance criteria, edge cases, and error-handling rules. - Extract preconditions, user actions, system responses, and postconditions. 2. **Test Scenario Generation**: - For each requirement, generate **at least 1 positive test** and **2–3 negative tests** covering diverse failure modes. 3. **Gherkin Structure**: - Use the
Feature,
Scenario,
Given,
When,
Thensyntax. - Include a **descriptive title** and **purpose** for each test. - Use **data tables** and **examples** where applicable for parameterization. - Ensure scenarios are atomic, independent, and executable. 4. **Output Format**:
gherkin Scenario: <Positive Test Title> Given <precondition> When <action> Then <expected outcome> Feature: <Feature Name> Scenario: <Negative Test Title> Given <precondition> When <invalid/edge-case action> Then <system should handle error with [specific message/behavior]>
5. **Examples**: - *FRD Requirement*: "User must log in with a valid email and password." - *Generated Tests*:
gherkin Scenario: Successful login with valid credentials Given the user is on the homepage When they click on the search icon And enter the "search term" Then they should be shown the relevant search results. Feature: User Login Scenario: Login attempt with invalid password Given the user is on the login page When they enter "test@example.com" and "WrongPass" And click the "Login" button Then the system should display "Invalid credentials" And the user remains on the login page
6. **Validation**: - Ensure all FRD requirements are mapped to tests. - Avoid redundancy; prioritize clarity and coverage. - Include error messages, boundary values, and security checks for negative tests. Return **only the Gherkin code**, organized by feature and test type, with no additional commentary."
Generating API Tests:
Prompt:Create API test cases for the attached OpenAPI Spec. Test scenarios should be in Gherkin format, to be consumed in a REST client.
These prompts unleash Deepseek R1’s ability to create structured, detailed, and executable test cases for both UI and API layers.
Sample Gherkin Tests Generated by Deepseek R1
UI Test Case:
`Feature: Login functionality testing
Scenario: Successful login with valid credentials
Given the user is on the login page
When the user enters valid credentials
And clicks the login button
Then the user should be redirected to the dashboard
Scenario: Unsuccessful login with invalid credentials
Given the user is on the login page
When the user enters invalid credentials
And clicks the login button
Then an error message "Invalid credentials" should be displayed`
API Test Case:
`Feature: Payment Gateway API Testing
Scenario: Successful payment
Given the payment gateway is active
When a valid payment request is sent
Then the response code should be 200
And the response body should contain "payment_status: success"
Scenario: Payment with invalid card details
Given the payment gateway is active
When a payment request is sent with invalid card details
Then the response code should be 400
And the response body should contain "error: Invalid card details"`
Running Tests with Hercules
Hercules makes executing these Gherkin-based tests effortless. Here’s a quick primer:
Step 1: Setup Hercules
Clone the open-source Hercules repository from GitHub and set up the environment by following the installation guide.
Step 2: Prepare Your Test Files
Save the Gherkin test cases into .feature files and place them in the specified directory.
Step 3: Execute Tests
Run the following command to execute your tests:
testzeus-hercules --input-file opt/input/test.feature --output-path opt/output --test-data-path opt/test_data --llm-model gpt-4o --llm-model-api-key sk-proj-k.......
Step 4: View Results
Hercules generates detailed execution logs and test reports, making it easy to review the outcomes and identify any issues.
Cost Savings and Security Benefits of an Open-Source Stack
Lower Costs: By using open-source tools like Deepseek R1 and Hercules, you eliminate licensing fees and significantly reduce your testing expenses.
Enhanced Security: Open-source tools are transparent and community-vetted, enabling quicker identification and resolution of vulnerabilities. Also, you can deploy them in an air gapped fashion at your end.
Flexibility and Customization: Tailor the tools to fit your specific testing needs, avoiding the one-size-fits-all limitations of proprietary software.
Community Support: Benefit from a vibrant community of developers and contributors who constantly improve the tools.
Conclusion
Deepseek R1 and Hercules represent the future of software testing by combining AI-driven test generation with robust, open-source test execution capabilities. Deepseek R1’s advanced reasoning and problem-solving abilities ensure comprehensive test coverage, while Hercules provides an efficient and effective test automation solution. You can find the full video here: Youtube
Whether you're a small team or a large enterprise, this powerful duo can help you achieve higher efficiency, lower costs, and improved software quality. Ready to transform your testing strategy? Join the open-source revolution with TestZeus, and experience the power of intelligent, efficient, and affordable software testing.
Check out the open source solution here, and drop us a star or a line: World's first open source testing agent
Top comments (0)