Testing frameworks for web, mobile, API, and unit testing
Provides testing framework recommendations and code examples for web, mobile, API, and unit testing scenarios.
npx claudepluginhub davincidreams/atlas-agent-teamsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Best for: Cross-browser testing, legacy applications
// Java Selenium example
WebDriver driver = new ChromeDriver();
driver.get("https://example.com");
WebElement element = driver.findElement(By.id("username"));
element.sendKeys("testuser");
driver.quit();
Best for: Modern web applications, fast feedback
// Cypress example
describe('Login', () => {
it('should login successfully', () => {
cy.visit('/login');
cy.get('#username').type('testuser');
cy.get('#password').type('password');
cy.get('#login').click();
cy.url().should('include', '/dashboard');
});
});
Best for: Modern web applications, cross-browser testing
// Playwright JavaScript example
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.fill('#username', 'testuser');
await page.click('#login');
await browser.close();
})();
Best for: Chrome/Chromium testing, scraping
// Puppeteer example
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.type('#username', 'testuser');
await page.click('#login');
await browser.close();
})();
Best for: React, Node.js, general JavaScript testing
// Jest example
describe('Calculator', () => {
test('adds 1 + 2 to equal 3', () => {
expect(add(1, 2)).toBe(3);
});
test('async operation', async () => {
const result = await fetchData();
expect(result).toEqual({ data: 'test' });
});
});
Best for: Flexible testing needs, Node.js
// Mocha example with Chai
const { expect } = require('chai');
const sinon = require('sinon');
describe('UserService', () => {
it('should return user data', async () => {
const user = await userService.getUser(1);
expect(user).to.have.property('id', 1);
});
});
Best for: Vite projects, fast modern testing
// Vitest example
import { describe, it, expect } from 'vitest';
describe('Math', () => {
it('should add numbers', () => {
expect(add(1, 2)).toBe(3);
});
});
Best for: Traditional JavaScript testing
// Jasmine example
describe('Calculator', () => {
it('should add numbers', () => {
const result = add(1, 2);
expect(result).toBe(3);
});
});
Best for: Python applications, flexible testing
# pytest example
def test_addition():
assert add(1, 2) == 3
@pytest.fixture
def user_data():
return {'id': 1, 'name': 'Test User'}
def test_user(user_data):
assert user_data['name'] == 'Test User'
Best for: Standard library, traditional testing
# unittest example
import unittest
class TestCalculator(unittest.TestCase):
def test_addition(self):
result = add(1, 2)
self.assertEqual(result, 3)
Best for: Extending unittest
Best for: Java applications, standard testing
// JUnit 5 example
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class CalculatorTest {
@Test
void testAddition() {
assertEquals(3, add(1, 2));
}
}
Best for: Advanced testing needs
// TestNG example
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public class CalculatorTest {
@Test
public void testAddition() {
assertEquals(add(1, 2), 3);
}
}
Best for: Mocking in Java
// Mockito example
import static org.mockito.Mockito.*;
List<String> mockList = mock(List.class);
when(mockList.get(0)).thenReturn("first");
assertEquals("first", mockList.get(0));
verify(mockList).get(0);
Best for: Cross-platform mobile testing
// Appium Java example
AppiumDriver driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), capabilities);
driver.findElement(By.id("username")).sendKeys("testuser");
driver.quit();
Best for: Android native testing
// Espresso example
onView(withId(R.id.username))
.perform(typeText("testuser"))
.check(matches(withText("testuser")));
Best for: iOS native testing
// XCUITest example
let app = XCUIApplication()
app.textFields["username"].tap()
app.textFields["username"].typeText("testuser")
Best for: Manual and automated API testing
// Postman test script
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Response has data", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.data).to.exist;
});
Best for: Java API testing
// REST Assured example
given()
.header("Content-Type", "application/json")
.body("{\"name\":\"test\"}")
.when()
.post("/api/users")
.then()
.statusCode(201)
.body("name", equalTo("test"));
Best for: Node.js API testing
// Supertest example
const request = require('supertest');
const app = require('./app');
describe('API', () => {
it('should create user', async () => {
const res = await request(app)
.post('/api/users')
.send({ name: 'test' })
.expect(201);
expect(res.body.name).toBe('test');
});
});