All Projects → timboudreau → giulius-selenium-tests

timboudreau / giulius-selenium-tests

Licence: other
A test harness that allows Selenium tests to be run using JUnit and test fixtures to be created and injected by a WebDriver-aware Guice

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects

Projects that are alternatives of or similar to giulius-selenium-tests

Testowanieoprogramowania
Testowanie oprogramowania - Książka dla początkujących testerów
Stars: ✭ 146 (+1116.67%)
Mutual labels:  selenium, junit
webdrivermanager-examples
JUnit tests with Selenium WebDriver and WebDriverManager
Stars: ✭ 94 (+683.33%)
Mutual labels:  selenium, junit
Fluentlenium
FluentLenium is a website & mobile automation framework which extends Selenium to write reliable and resilient UI functional tests. This framework is React ready. Written and maintained by people who are automating browser-based tests on a daily basis.
Stars: ✭ 766 (+6283.33%)
Mutual labels:  selenium, junit
Reporting
Zebrunner Reporting Tool
Stars: ✭ 198 (+1550%)
Mutual labels:  selenium, junit
Mastering Junit5
A comprehensive collection of test examples created with JUnit 5
Stars: ✭ 223 (+1758.33%)
Mutual labels:  selenium, junit
justtestlah
Dynamic test framework for web and mobile applications
Stars: ✭ 43 (+258.33%)
Mutual labels:  selenium, junit
Hsac Fitnesse Fixtures
An environment to define and run integration tests. It contains Fitnesse fixture (base) classes and a baseline FitNesse installation.
Stars: ✭ 99 (+725%)
Mutual labels:  fixtures, selenium
testing-spring-boot-applications-masterclass
🍃 Everything You Need to Know About Testing Spring Boot Applications
Stars: ✭ 185 (+1441.67%)
Mutual labels:  selenium, junit
main
Mocks Server monorepo
Stars: ✭ 109 (+808.33%)
Mutual labels:  fixtures
spydriver
🕵️ Lightweight utility to intercept WebDriver and WebElement method calls.
Stars: ✭ 24 (+100%)
Mutual labels:  selenium
timber-junit-rule
A highly configurable JUnit Rule that outputs Timber logs to standard output
Stars: ✭ 42 (+250%)
Mutual labels:  junit
python-appium-framework
Complete Python Appium framework in 360 degree
Stars: ✭ 43 (+258.33%)
Mutual labels:  selenium
tithiwa
Automate Web WhatsApp with selenium in python.
Stars: ✭ 17 (+41.67%)
Mutual labels:  selenium
king-bot
travian kingdoms automation (www.kingdoms.com)
Stars: ✭ 19 (+58.33%)
Mutual labels:  selenium
zhihu-crawler
徒手实现定时爬取知乎,从中发掘有价值的信息,并可视化爬取的数据作网页展示。
Stars: ✭ 56 (+366.67%)
Mutual labels:  selenium
docker-selenium-lambda
The simplest demo of chrome automation by python and selenium in AWS Lambda
Stars: ✭ 172 (+1333.33%)
Mutual labels:  selenium
chameleon-crawler
Browser automation for Chameleon.
Stars: ✭ 17 (+41.67%)
Mutual labels:  selenium
facebook-cleaner
It is almost spring, so time for a pre spring cleaning. This time: taking care of your Facebook. This script can safe you a lot of time if you would try to do that by hand.
Stars: ✭ 52 (+333.33%)
Mutual labels:  selenium
instagram-profilecrawl
📝 quickly crawl the information (e.g. followers, tags etc...) of an instagram profile.
Stars: ✭ 964 (+7933.33%)
Mutual labels:  selenium
Whatsapp-Bot
Web.whatsapp.com bot made with selenium
Stars: ✭ 39 (+225%)
Mutual labels:  selenium

giulius-selenium-tests

An easy way to write Selenium tests in Java, have objects representing web page contents be created and injected by Guice + WebDriver, and use any JUnit reporting engine with Selenium

Builds and a Maven repository containing this project can be found on timboudreau.com.

Overview

This library makes it easy to write Selenium tests in Java. These tests are run using JUnit (which makes reporting simple). It can utilize both Google Guice and Selenium's own injection to create test fixtures. It extends Giulius-Tests, a test-harness for writing Guice-aware JUnit tests to make the framework Selenium-aware as well.

This means that test methods can have method parameters, and the framework will pre-create objects that you want to test. You write test code to test what matters, and the framework does the rest.

To see what these tests look like, check out this test which is part of the test-suite for this project.

Here's a test which tests a fake search page. That page contains a form with a text field with the ID searchField, a submit button with the ID searchSubmit and a span with the ID prev which contains the previously submitted form. This test uses a test fixture - a class called MyPageModel which contains fields representing each of those HTML elements.

The nice thing about this is that you never have to write code to create any of the objects in question - the framework creates them for you. So writing tests remains focused on writing code that actually tests something:

@Test
@Fixtures( LoginFixture.class ) // do the login steps ahead of time
public void foo( MyPageModel page, WebDriverWait wait ) {
    page.searchField.sendKeys ( "giulius" );
    page.searchButton.click ();
    assertEquals ( "giulius", page.prev.getText() );
}

MyPageModel is a Selenium model for the content of the page, written just the way you normally do with Selenium tests.

The difference is that the framework sees that this class is an argument to your test method, and it scans its fields and notices that there are Selenium annotations on them. So it uses Selenium's PageFactory to instantiate the object, and then uses Guice to inject any other objects you might have included in it (remember to use @Inject on such fields).

The result is that you never have to write code to instantiate this class ourselves - you just mention it as a test method parameter and the rest is handled for you.

public class MyPageModel {
    @FindBy(how = How.ID, using = "searchField")
    @CacheLookup
    public WebElement searchField;
    @FindBy(how = How.ID, using = "searchSubmit")
    public WebElement searchButton;
    @FindBy(how = How.ID, using = "prev")
    public WebElement prev;
}

You may have noticed the annotation:

@Fixtures (LoginFixture.class)

That annotation is a way of saying "I don't need one of these passed to me, but I need you to make one before my test method runs". The test harness will construct an instance of LoginFixture. As a side-effect of constructing it, it logs into the web page, so that the page is ready to do the things we want to test.

Groovy

The groovy-selenium-guice-demo shows an example of writing Selenium tests injected by Guice in Groovy and run in JUnit, and recording a screen-capture video while doing so (requires ffmpeg).

The test-main project provides a simplified JUnit runner suitable for running tests as a standalone process (Selenium tests are not usually part of a unit test suite).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].