docs-testing

Document integration and unit test setups for Kotlin/Ktor projects.

Updated Jun 26, 2022
One-click install
npx skills add https://github.com/evengul/mc-org --skill docs-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docs-testing
Source: https://github.com/evengul/mc-org/tree/main/.claude/skills/docs-testing
Command: npx skills add https://github.com/evengul/mc-org --skill docs-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive reference for writing effective integration and unit tests within the MC-ORG project, ensuring code quality and maintainability.

Core Features & Use Cases

  • Test Setup Guidance: Learn how to configure testApplication, mock authentication with WithUser, and leverage DatabaseTestExtension for database integration tests.
  • Request/Assertion Patterns: Discover best practices for making HTTP requests and asserting on responses, including status codes, body content, and redirects.
  • Use Case: A new developer needs to add a feature that interacts with the database and requires authentication. They can consult this Skill to understand the correct testing patterns and setup required for their new integration tests.

Quick Start

Use the docs-testing skill to understand how to set up an integration test with database access and authentication.

Frequently Asked Questions about docs-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up integration tests with database access in Kotlin Ktor?

Integration tests in Kotlin Ktor use `testApplication` for server setup and `DatabaseTestExtension` to manage database access, providing a standardized and reproducible testing environment for HTTP requests.

How does authentication mocking work in Ktor testApplication setups?

Authentication mocking in Ktor testApplication setups uses `WithUser` to simulate authenticated users, allowing integration tests to verify request and assertion strategies without requiring real authentication mechanisms.

What is the best way to structure unit tests and integration tests in a Kotlin Ktor project?

The best way to structure unit tests and integration tests in a Kotlin Ktor project is to use `testApplication` for integration setups and `DatabaseTestExtension` for database tests, ensuring robust and reproducible methodologies.

Can I use DatabaseTestExtension for test isolation in Kotlin Ktor integration tests?

Yes, `DatabaseTestExtension` can be used for test isolation in Kotlin Ktor integration tests, managing database state to ensure reproducible and robust testing methodologies across different test cases.

Why are my Ktor testApplication requests not maintaining the authenticated user state?

Ktor testApplication requests may not maintain authenticated user state if `WithUser` is not properly configured, which is required for mocking authentication and ensuring accurate request and assertion strategies.