Coder Social home page Coder Social logo

sergueik / stoppable_test Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.33 MB

This project demonstrates pausing Selenium test through a java modal dialog (SWT, Swing, JavaFx)

License: MIT License

Java 95.80% CSS 1.41% Shell 2.79%
swing javafx swt selenium error-handler

stoppable_test's Introduction

Info

This project demonstrates pausing the Selenium test through an modal dialog which is available or can be easily composed from library dialog widgets in all common java GUI frameworks:

The most basic dialog widget is sufficient for the cause, despite slight differences in the under the hood implementations of the widget event loop processing by these mainstream Java UI frameworks.

This technique can be used to add an Image Button Dialog and text to communicate the name of the test method that is s paused. Alternatively one may add text box or an accordion widget to comunicate some extra information from the test through one of common custom dialogs available in Swing Widgets or Nebula - Supplemental Widgets for SWT e.g. to print test exception stack from the Junit or testNg exception handler.

icon

Demo

The example directory contains an testNg test. The equivalent jUnit case is arriving shortly and isn't expected to lead to a difference in test behavior. The test is launched in a usual fashion, via maven. Running from the project directory builds and tests all 3 frameworks one after another.

mvn test

The examples in this directory borrows one of the test scenarios from another repository selenium test. The test in question performs some scrolling actions in Chrome then gets stopped and the UI dialog is shown. It has been seen to successfully resume execution after 10...15 minutes of being paused. It is uncertain atm if the test would be able to continue after an arbitrary long interruption.

icon

Note

Using Java for stop dialog guarantees platform independnce, at a low cost that a different set of jars need to be used for Mac OSX, Linux and Windows (32 or 64 bit) for SWT. This is easily solvable through property activated profiles, but may become a little of a challenge if the test suite itself needs maven profiles for some other purpose. The JavaFx and Swing versions have no such platformr-specific jar dependencies.

icon

Note

On older mac / hackintosh platforms one need to pick the ChromeDriver version matching whatever Chrome version browser would be installed, in paricular Google Chrome build 49.0.2623.112 for mac is a 32-bit app and requires a 32 bit chromdriver build 22 to even work. The supported versions are always listed in the notes.txt e.g.

https://chromedriver.storage.googleapis.com/2.22/notes.txt

Using the correct combination allows driver to at least make the browser visible on the desktop but may still fail to navigate anywhere from the starting page data:, and test eventually timing out (one can add assertions).

Using a mismatched combination is likely lead to the exception

org.openqa.selenium.WebDriverException:
Timed out waiting for driver server to start.

No such problem with (also old) build of Firefox and the geckodriver icon

See Also

License

This project is licensed under the terms of the MIT license.

Author

Serguei Kouzmine

stoppable_test's People

Contributors

sergueik avatar

Stargazers

 avatar

Watchers

 avatar  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.