GithubHelp home page GithubHelp logo

5l1v3r1 / java-selenium_grid-parallel-testing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ogulcanarbc/java-selenium-grid-parallel-testing

0.0 1.0 0.0 13.45 MB

running cross-browser selenium tests in parallel using selenium grid and docker container

Java 99.42% HTML 0.58%

java-selenium_grid-parallel-testing's Introduction

Gerekli Kurulumlar

  • Java JDK 8 +
  • Apache Maven
  • Docker
  • NodeJs

Kullanılan Teknolojiler

  • Java 8
  • Docker
  • Maven
  • Selenium Grid
  • TestNG / Dataprovider (Data Driven Testing)
  • NodeJs

Testin Çalıştırılabilmesi İçin Gerekli Ortam Nasıl Oluşturulur?

Sırasıyla;
  • Proje Github'dan clone edilir.
  • Docker Deamon başlatışır ve projenin olduğu dizinin içine girilerek docker-compose up -d komutu çalıştırılır.
    • Bu yml dosyası gerekli altyapıları içindeki image'lar ile kurar.
    • İmage list; ngnix,selenium-grid-hub,firefox node, chrome node.
  • Bu compose.yml dosyası tek bir firefox ve chrome tarayıcısını hub'a register eder.(her biri farklı iki nod) Eğer scale etmek istoyorsanız compose dosyasını docker-compose up -d --scale firefox=arg0 --scale chrome=arg1 olarak çalıştırmanız yeterlidir.
  • http://localhost:4444/grid/console'e giderek Selenium Grid hub'nın ayakta olduğu ve node'ların register olup olduğu kontrol edilir.
  • localhost:8001' giderek ngnix'in çalışırlığı kontrol edilir.

Test Nasıl Çalıştırılır?

  • LinkAndLinkResponseCodeTest (STEP/1) testini çalıştırmak için;

    • mvn test -DsuiteXmlFile=LinkAndLinkRespTestNG.xml
  • ImgLoadTimeAndResponseCodeTest(STEP/2) testini çalıştırmak için;

    • mvn test -DsuiteXmlFile=ImgLoadAndRespTestNg.xml
  • DataDrivenLoginTest (STEP/3) testini çalıştırmak için;

    • mvn test -DsuiteXmlFile=LoginDataDrivenTestNG.xml

Komutlarını çalıştırılması yeterli olacaktır.

Not: Bu komutlar proje dizininin içerisinde çalıştırılması gerekmektedir, aksi takdirde .xml file uzantısı için tam path vermeniz gerekir.

Proje ile CI/CD Adına Ek Olarak Neler Yapılabilir?

  • Proje Jenkins üzerinde bir job ile tetiklendirilebilir. Şöyle ki; package.json dosyası içerisinde mevcut npm scrip komutları bulunmaktadır, bu komutlar ile Jenkins içerisinden sh script yazarak testleri schedule edebilirsiniz.

Jenkins Aracılığıyla Test Çalıştırmak İçin?

Gerekli Kurulumlar:

  • Jenkins, Java JDK 8 ,Maven, NodeJs, npm ve npm-run-all

Npm İle Pipeline Script Yazımı:

  • LinkAndLinkResponseCodeTest (STEP/1) testini çalıştırmak için;

    • git 'https://github.com/ogulcanarbc/TestAutomationProject.git'
    • sh 'npm butik-linkAndLinkResp-test'
  • ImgLoadTimeAndResponseCodeTest(STEP/2) testini çalıştırmak için;

    • git 'https://github.com/ogulcanarbc/TestAutomationProject.git'
    • sh 'npm butik-imgLoadAndResp-test'
  • DataDrivenLoginTest (STEP/3) testini çalıştırmak için;

    • git 'https://github.com/ogulcanarbc/TestAutomationProject.git'
    • sh 'npm login-datadriven-test'
  • Bu üç testi paralel çalıştırmak için:

    • git 'https://github.com/ogulcanarbc/TestAutomationProject.git'
    • sh 'login-butik-imageload-parallel-test'
  • Test sonuçları ile ilgili csv dosyalarını ve ekran görüntülerini proje dizini içerisindeki ./reports dosyası içinde görebilirsiniz.

  • allure serve allure-results komutunu çalıştırarak allure raporunuzu oluşturabilirsiniz.

  • Son olarak Html formatında bir raporunuz var ise (örn. allure report), test bittikten sonra şu komutu çalıştırarak ngnix sunucusu üzerinde raporu yayınlayabilirsiniz.

    • docker cp <proje-path>/index.html trendyol_web_server_1:/var/www/html/index.html

    Ardından localhost:8001'e girerek html raporunuzu görüntüleyebilirsiniz.

java-selenium_grid-parallel-testing's People

Contributors

oglcnarbcty avatar ogulcanarbc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.