Giter Site home page Giter Site logo

testbench-demo's Introduction

TestBench Demo

This project is a collection of samples on how to use Vaadin TestBench. If you are looking for more information on TestBench, see https://vaadin.com/testbench

Vaadin TestBench demo
24 Current version
23 https://github.com/vaadin/testbench-demo/tree/v23
14 https://github.com/vaadin/testbench-demo/tree/v14
10 https://github.com/vaadin/testbench-demo/tree/v10
8 https://github.com/vaadin/testbench-demo/tree/8.0
7 https://github.com/vaadin/testbench-demo/tree/7.7

Running the Example

The project is built using Maven. A similar setup can be done using other build systems as well. The Maven project can easily be imported into any IDE supporting Maven or used via the command line interface. Maven can be downloaded from: http://maven.apache.org.

The project produces a standard WAR file containing a simple calculator application written with Vaadin. During the build process TestBench tests are automatically run against the final war file using a Jetty server. The tests can be run from the command line by issuing the following command:

mvn verify

If you are running specific tests directly via an IDE, you might need to deploy the project beforehand to http://localhost:8080/. Any method will do, but the easiest one is probably Maven and the jetty-maven-plugin:

mvn jetty:run

You can also verify the project in production mode by running:

mvn verify -Pproduction

Or deploy the application in production executing:

mvn jetty:run-war -Pproduction

Sample code classes explained

The source code for the application to be tested, a desktop calculator application, is given in the src/main/java subfolder.

The TestBench tests for the application are located under the src/test/java subfolder.

Screenshot comparison in the example project

The screenshot comparison example in src/test/java/com/vaadin/testbenchexample/advanced/ScreenshotIT.java grabs a screenshot and compares it to a reference file in src/test/screenshots. The first time it is run, it will automatically generate a reference screenshot in that folder, e.g. src/test/screenshots/oneplustwo_mac_chrome_107.png (exact file name depends on your operating system and browser). Normally the reference file generation would be handled by hand so you can verify that the screenshots look correct at the same time.

JUnit5 support

JUnit5 is supported since TestBench 9, examples can be found at src/test/java/com/vaadin/testbenchexample/junit5.

TestBench together with Selenium-Jupiter

It is possible to use TestBench together with Selenium-Jupiter JUnit5 extension, see example test at src/test/java/com/vaadin/testbenchexample/junit5/SimpleCaseSeleniumIT.

testbench-demo's People

Contributors

alvarezguille avatar artur- avatar dependabot[bot] avatar enver-haase avatar johannesh2 avatar manolo avatar marcinvaadin avatar peppe avatar rogozinds avatar svenruppert avatar tarekoraby avatar vaadin-bot avatar zch avatar zhesun88 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testbench-demo's Issues

Make this a spring-boot application

Now that we're a much more opinionated (tm) Framework, and by default we suggest people build on top of the spring-boot starter, we should in fact use that as a basis and not jetty.

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.