Skip to content

zenithstack/Ruby-browserstack-AA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# πŸ“± Ruby Appium Automation with BrowserStack

This project demonstrates running Appium tests written in Ruby on real devices using [BrowserStack App Automate](https://www.browserstack.com/app-automate).

---

## πŸ“ Project Structure
ruby_appium/
β”‚
β”œβ”€β”€ config/
β”‚   └── browserstack_config.rb     # Holds credentials, device config, and capabilities
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ driver_manager.rb          # Handles Appium driver lifecycle
β”‚   └── test_runner.rb             # Manages parallel test execution
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ search_wikipedia_test.rb   # Sample test: search on Wikipedia app
β”‚   └── another_test.rb            # Placeholder for additional test case
β”‚
└── main.rb                        # Entry point to run all tests



πŸ’Ž Prerequisites

  • macOS/Linux/Windows
  • Ruby 3.x or later
  • Appium
  • BrowserStack account with valid credentials

πŸ› οΈ Installation

  1. Clone the repository:
git clone https://github.com/zenithstack/ruby_appium.git
cd ruby_appium
  1. Install required gems:
gem install appium_lib
gem install parallel
gem install dotenv

πŸ” Set Up Your Credentials

Create a .env file in the root directory:

BROWSERSTACK_USERNAME=your_username
BROWSERSTACK_ACCESSKEY=your_access_key

These will be automatically loaded from config/browserstack_config.rb.


πŸš€ Running Tests

The entry point is main.rb. It will load all test cases and run them in parallel using threads, like this:

require_relative './tests/search_wikipedia_test'
require_relative './tests/another_test'

require_relative './lib/test_runner'

# Wrap each run_tests_in_parallel in its own thread
threads = []

threads << Thread.new { run_tests_in_parallel(method(:search_wikipedia_test)) }
threads << Thread.new { run_tests_in_parallel(method(:another_test)) }

# Wait for both test suites to complete
threads.each(&:join)

▢️ To run the tests:

ruby main.rb

This will:

  • Execute each test file in a separate thread
  • Run test scenarios in parallel on real devices using BrowserStack

πŸ“Œ Notes

  • Add more test cases in the tests/ directory and refer them inside main.rb
  • Device and capability settings are managed via browserstack_config.rb
  • Session management handled in driver_manager.rb
  • test_runner.rb uses the Parallel gem for thread-safe execution of scenarios

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages