API
API Testing Database Testing
Key Concepts Key Concepts
API Types: Types of Databases:
REST APIs: Representational State Transfer, uses HTTP requests. SQL Databases: Structured Query Language, e.g., MySQL, PostgreSQL.
SOAP APIs: Simple Object Access Protocol, uses XML for messaging. NoSQL Databases: Non-relational, e.g., MongoDB, Cassandra.
GraphQL: A query language for APIs.
SQL Queries:
HTTP Methods:
DML (Data Manipulation Language): SELECT, INSERT, UPDATE, DELETE.
GET: Retrieve data from the server. DDL (Data Definition Language): CREATE, ALTER, DROP.
POST: Send data to the server.
PUT: Update existing data. ACID Properties:
DELETE: Remove data.
Atomicity: Transactions are all-or-nothing.
Status Codes: Consistency: Transactions lead to a valid state.
Isolation: Transactions are processed independently.
2xx: Success (e.g., 200 OK, 201 Created). Durability: Completed transactions persist even after a crash.
4xx: Client errors (e.g., 400 Bad Request, 401 Unauthorized).
5xx: Server errors (e.g., 500 Internal Server Error). Testing Methods
Authentication: Schema Testing: Validate database schema, tables, columns, keys.
Data Integrity Testing: Ensure data accuracy and consistency.
API Keys: Simple key-based authentication. Performance Testing: Assess database performance under various loads.
OAuth: Token-based authentication. Stored Procedures Testing: Verify the functionality of stored procedures, triggers, and functions.
JWT: JSON Web Tokens for secure data transmission.
Tools
Testing Methods
SQL Server Management Studio (SSMS): For managing SQL Server databases.
Functional Testing: Verify the API works as expected. Toad for Oracle: For Oracle database management.
Integration Testing: Ensure the API interacts correctly with other components. MongoDB Compass: For MongoDB management.
Load Testing: Assess the API’s performance under heavy load. DBeaver: Universal database management tool.
Security Testing: Check for vulnerabilities like SQL injection, XSS.
Best Practices
Tools
Test Data Management: Use realistic and representative test data.
Postman: For designing, testing, and documenting APIs. Automated Testing: Implement automated scripts for repetitive tests.
SoapUI: For testing SOAP and REST APIs. Backup and Recovery Testing: Verify data backup and recovery processes.
Swagger: For designing and documenting APIs. Validation of Transactions: Ensure transactions meet ACID properties.
JMeter: For performance testing.
Best Practices
Test Coverage: Ensure all endpoints and methods are tested.
Data Validation: Check response data for accuracy and structure.
Error Handling: Verify proper error responses and status codes.
Security Checks: Test for security vulnerabilities and proper authentication.