Skip to content

Dave-Vermeulen/QA-Testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 Learning Objectives

  • Manual testing using TestRail
  • Unit testing with Jest
  • Integration testing
  • End-to-End (E2E) testing
  • Test-Driven Development (TDD)
  • API testing
  • Frontend testing

📁 Project Structure

```bash
qa-testing-project/
├── src/
│ └── api/
│ └── productAPI.js # Product management logic
├── tests/
│ ├── unit/
│ │ └── productAPI.test.js # Unit tests
│ └── integration/
│ └── productWorkflow.test.js # Integration tests
├── public/
│ └── index.html # Frontend interface
├── server.js # Express server
├── package.json
└── README.md

🚀 Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm (comes with Node.js)

Installation

  1. Clone the repository:

    git clone https://github.com/Dave-Vermeulen/QA-Testing.git
    cd qa-testing-project
    
  2. Install dependencies:

    npm init -y
    npm install express jest @babel/core @babel/preset-env
    
  3. Add test script to package.json:

    {"scripts": {
    "test": "jest",
    "test:watch": "jest --watch",
    "start": "node server.js"
       }
    }
    
    
  4. Create Jest config file (jest.config.js):

    module.exports = {
        testEnvironment: 'node',
        verbose: true
    };
    

Running the Application

  1. Start the server:
    npm start
    
  2. Visit http://localhost:3000 in your browser.

Running Tests

  1. Run all tests:
    npm test
    npm run test:watch 
    

📝 Testing Approach

  1. Manual Testing with TestRail
  • Use TestRail Free Acc.
  • Test cases cover:
    • Product creation
    • Input validation
    • Error handling
    • UI responsiveness
  1. Unit Tests

Located in ./tests/unit/productAPI.test.js:

  1. Integration Tests

Located in tests/integration/productWorkflow.test.js:

🧪 Jest Testing Guide

Basic Test Structure

```bash
describe('Group description', () => {
    test('test description', () => {
    // Arrange
    const input = {};

    // Act
    const result = someFunction(input);

    // Assert
    expect(result).toBe(expected);
    });
});

Common Jest Assertions

```bash
expect(value).toBe(other)           // Strict equality
expect(value).toEqual(other)        // Deep equality
expect(value).toHaveProperty('key') // Object has property
expect(fn).toThrow()                // Function throws

expect(value).toBeTruthy() // Value is truthy expect(array).toContain(item) // Array contains item

Test Hooks

```bash
beforeAll(() => {})    // Runs once before all tests
afterAll(() => {})     // Runs once after all tests
beforeEach(() => {})   // Runs before each test
afterEach(() => {})    // Runs after each test

📚 Learning Path

Start with Manual Testing:

Move to Unit Testing:

  • Study productAPI.test.js
  • Add new test cases
  • Learn Jest assertions

Progress to Integration Testing:

  • Study productWorkflow.test.js
  • Test multiple operations together
  • Handle async operations

Advanced Topics:

  • Add E2E tests with Cypress/Selenium
  • Implement test coverage reporting
  • Practice TDD

🤝 Contributing

Feel free to submit issues and enhancement requests!

📖 Additional Resources

📋 TODO List

  • Add E2E tests
  • Implement test coverage reporting
  • Add more complex product validation
  • Create API documentation
  • Add authentication system

About

The noobs guide to testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published