Skip to content

erdncyz/testgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Test Project Generator πŸš€

GitHub npm Node.js Downloads

Interactive CLI tool for generating test automation projects with different programming languages and frameworks.

πŸ“¦ Installation

npm install -g test-project-generator

πŸš€ Quick Start

testgen

✨ Features

  • 🌐 Multiple Programming Languages: Java, Python, Ruby, TypeScript
  • ⚑ Test Frameworks: Selenium, Appium, Playwright, Karate API
  • πŸ₯’ BDD Support: Cucumber/Gherkin integration
  • 🎯 Interactive CLI: Easy-to-use command-line interface
  • πŸ“ Project Templates: Pre-configured project structures
  • πŸ”§ Auto Configuration: Dependencies and build tools setup
  • πŸ“š Documentation: Ready-to-use README and examples
  • πŸ“Š Advanced Reporting: Allure Reports, HTML reports, Coverage reports
  • ⚑ Parallel Execution: Multi-threaded test execution support
  • πŸ”„ CI/CD Ready: GitHub Actions, Jenkins, GitLab CI templates
  • πŸ“ Logging: Log4j2, Winston, Python logging integration
  • πŸ› οΈ Configuration Files: .gitignore, testng.xml, pytest.ini, jest.config.js
  • πŸ“Έ Screenshot & Video: Automatic failure screenshots and video recording
  • 🌐 Cross-Browser: Chrome, Firefox, Safari, Edge support
  • πŸ“± Mobile Testing: iOS and Android device configurations
  • πŸ—„οΈ Database Testing: Database connection utilities
  • πŸ“§ Email Testing: Email validation and testing support

πŸš€ Quick Start

Step 1: Clone the Repository

git clone https://github.com/erdncyz/testgen.git
cd testgen

Step 2: Install Dependencies

npm install

Step 3: Global Installation (Recommended)

npm link

Step 4: Create Your First Project

testgen

πŸ“– Detailed Usage Guide

Method 1: Global Installation (Recommended)

Step 1: Clone and Setup

# Clone the repository
git clone https://github.com/erdncyz/testgen.git
cd testgen

# Install dependencies
npm install

# Install globally
npm link

Step 2: Create a Project

# Run the generator
testgen

# Follow the interactive prompts:
# 1. Select programming language
# 2. Select test framework
# 3. Choose BDD support (Cucumber)
# 4. Enter project name and path

Step 3: Start Development

# Navigate to your new project
cd your-project-name

# Install dependencies (language-specific)
# For Java: mvn clean install
# For Python: pip install -r requirements.txt
# For Ruby: bundle install
# For TypeScript: npm install

# Run tests
# For Java: mvn test
# For Python: pytest
# For Ruby: rspec
# For TypeScript: npm test

Method 2: Local Usage

Step 1: Clone and Setup

git clone https://github.com/erdncyz/testgen.git
cd testgen
npm install

Step 2: Run Locally

# Run the generator
npm start
# or
node index.js

🎯 Interactive Flow

The generator will guide you through these steps:

1. Select Programming Language

? Which programming language would you like to use?
❯ Java
  Python
  Ruby
  TypeScript

2. Select Test Framework

? Which test framework would you like to use?
❯ Selenium WebDriver
  Appium (Mobile Testing)
  Playwright

3. Choose BDD Support

? Do you want to use Cucumber for BDD (Behavior Driven Development)?
❯ Yes
  No

4. Project Details

? What is your project name?
> my-awesome-tests

? Where should the project be created?
> /Users/username/projects

πŸ“ Generated Project Structure

Java Project (Maven)

my-awesome-tests/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/java/
β”‚   └── test/java/
β”‚       └── SampleTest.java
β”œβ”€β”€ src/test/resources/features/
β”‚   └── sample.feature
β”œβ”€β”€ pom.xml
└── README.md

Python Project

my-awesome-tests/
β”œβ”€β”€ src/
β”œβ”€β”€ tests/
β”‚   └── test_sample.py
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ sample.feature
β”‚   └── steps/
β”‚       └── sample_steps.py
β”œβ”€β”€ requirements.txt
└── README.md

Ruby Project

my-awesome-tests/
β”œβ”€β”€ lib/
β”œβ”€β”€ spec/
β”‚   └── sample_spec.rb
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ sample.feature
β”‚   └── steps/
β”‚       └── sample_steps.rb
β”œβ”€β”€ Gemfile
└── README.md

TypeScript Project

my-awesome-tests/
β”œβ”€β”€ src/
β”œβ”€β”€ tests/
β”‚   └── sample.test.ts
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ sample.feature
β”‚   └── steps/
β”‚       └── sample_steps.ts
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

πŸ› οΈ Framework Support

Selenium WebDriver

  • Web application testing
  • Cross-browser support (Chrome, Firefox, Safari, Edge)
  • Multiple language bindings
  • Grid support for distributed testing
  • WebDriverManager integration (automatic driver management)

Karate API Testing (Java)

  • REST API testing with simple syntax
  • BDD-style API test scenarios
  • Built-in assertions and validations
  • Environment management (dev, staging, prod)
  • Data-driven testing with JSON/CSV
  • Parallel execution support
  • Beautiful HTML reports

Requests API Testing (Python)

  • REST API testing with Python requests
  • pytest integration for test execution
  • JSON validation and assertions
  • Environment configuration support
  • Parallel execution with pytest-xdist
  • HTML and JSON reports

Supertest API Testing (TypeScript)

  • REST API testing with Supertest
  • Jest integration for test execution
  • Express.js testing support
  • Async/await syntax
  • Parallel execution with Jest
  • Coverage reports

Appium

  • Mobile application testing
  • iOS and Android support
  • Native, hybrid, and web apps
  • Desktop application testing

Playwright

  • Modern web testing
  • Fast and reliable
  • Auto-wait and retry mechanisms
  • Cross-browser testing

πŸ₯’ BDD with Cucumber

When you choose Cucumber support, the generator will:

  1. Add Cucumber dependencies to your project
  2. Create feature files with Gherkin syntax
  3. Generate step definitions for your language
  4. Set up the necessary configuration

Example Feature File

Feature: Sample Feature
  As a user
  I want to test the application
  So that I can ensure it works correctly

  Scenario: Login to the application
    Given I am on the homepage
    When I click on the login button
    Then I should see the login page

πŸ“¦ Dependencies

The generator automatically installs the latest stable versions:

Java Projects

  • Selenium: 4.15.0
  • WebDriverManager: 5.6.2 (automatic driver management)
  • Appium: 8.5.1
  • Playwright: 1.40.0
  • Karate: 1.4.1 (API testing)
  • JUnit: 5.9.3
  • TestNG: 7.8.0 (parallel execution)
  • Allure: 2.24.0 (advanced reporting)
  • Log4j2: 2.20.0 (logging framework)
  • Cucumber: 7.14.0

Python Projects

  • Selenium: 4.15.0
  • Appium: 3.1.0
  • Playwright: 1.40.0
  • Requests: 2.31.0 (API testing)
  • pytest: 7.4.3
  • pytest-html: 4.1.1 (HTML reports)
  • pytest-xdist: 3.3.1 (parallel execution)
  • allure-pytest: 2.13.2 (Allure reports)
  • pytest-cov: 4.1.0 (coverage reports)
  • behave: 1.2.6

Ruby Projects

  • selenium-webdriver: ~> 4.15
  • appium_lib: ~> 12.0
  • playwright: ~> 1.40
  • rspec: ~> 3.12
  • cucumber: ~> 8.0

TypeScript Projects

  • selenium-webdriver: ^4.15.0
  • webdriverio: ^8.15.0
  • @playwright/test: ^1.40.0
  • supertest: ^6.3.3 (API testing)
  • express: ^4.18.2 (API framework)
  • jest: ^29.7.0 (parallel execution support)
  • winston: ^3.11.0 (logging framework)
  • allure-jest: ^2.0.0 (Allure reports)
  • @cucumber/cucumber: ^8.11.0

🎯 Example Scenarios

Scenario 1: Java + Selenium + Cucumber

testgen
# Selections:
# - Language: Java
# - Framework: Selenium WebDriver
# - Cucumber: Yes
# - Project Name: java-selenium-bdd
# - Path: /Users/username/projects

Scenario 2: Python + Playwright + Traditional

testgen
# Selections:
# - Language: Python
# - Framework: Playwright
# - Cucumber: No
# - Project Name: python-playwright-tests
# - Path: /Users/username/projects

Scenario 3: TypeScript + Appium + Cucumber

testgen
# Selections:
# - Language: TypeScript
# - Framework: Appium (Mobile Testing)
# - Cucumber: Yes
# - Project Name: mobile-app-tests
# - Path: /Users/username/projects

πŸš€ Getting Started with Generated Projects

Java Project

cd java-selenium-bdd
mvn clean test

Python Project

cd python-playwright-tests
pip install -r requirements.txt
pytest

Ruby Project

cd ruby-appium-tests
bundle install
rspec

TypeScript Project

cd mobile-app-tests
npm install
npm test

πŸ”§ Advanced Configuration

Custom Project Templates

The generator creates optimized configurations for each combination:

  • Java: Maven POM file, JUnit 5, TestNG, Cucumber integration
  • Python: requirements.txt, pytest, behave (Cucumber)
  • Ruby: Gemfile, RSpec, Cucumber
  • TypeScript: package.json, Jest, Playwright/Appium bindings

Environment Setup

Each generated project includes:

  • Dependency management files
  • Build configuration files
  • Test runner setup
  • Sample test files
  • Documentation and examples

πŸ†• New Advanced Features

πŸ“Š Advanced Reporting

  • Allure Reports: Beautiful HTML reports with screenshots, videos, and detailed test results
  • HTML Reports: pytest-html for Python, Jest HTML for TypeScript
  • Coverage Reports: Code coverage analysis for all languages
  • JSON Reports: Machine-readable test results for CI/CD integration

⚑ Parallel Execution

  • Java: TestNG parallel execution with thread pools
  • Python: pytest-xdist for distributed testing
  • TypeScript: Jest parallel execution with worker threads
  • Cross-browser: Simultaneous testing across multiple browsers

πŸ”„ CI/CD Integration

  • GitHub Actions: Pre-configured workflows for all languages
  • Matrix Testing: Multiple versions and browsers in parallel
  • Artifact Upload: Automatic test result and report uploads
  • Cache Optimization: Fast builds with dependency caching

πŸ“ Professional Logging

  • Java: Log4j2 with file and console appenders
  • Python: Structured logging with file rotation
  • TypeScript: Winston logger with multiple transports
  • Log Levels: DEBUG, INFO, WARN, ERROR with filtering

πŸ› οΈ Configuration Management

  • Environment Variables: .env files for different environments
  • Test Configuration: Language-specific config files
  • Git Integration: Comprehensive .gitignore files
  • IDE Support: VS Code and IntelliJ configurations

πŸ“Έ Test Artifacts

  • Screenshot on Failure: Automatic screenshots for failed tests
  • Video Recording: Test execution videos for debugging
  • Log Files: Detailed execution logs
  • Test Reports: Multiple report formats (HTML, JSON, XML)

πŸ—οΈ Page Object Model (POM)

  • BasePage Class: Common functionality and wait strategies
  • Page Classes: HomePage, LoginPage, and other page-specific classes
  • WebDriverManager Utility: Cross-browser driver management
  • Reusable Components: Modular and maintainable test structure
  • Best Practices: Industry-standard POM implementation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Join our community discussions

Happy Testing! πŸ§ͺ✨

Made with ❀️ by erdncyz

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors