Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mvysny/karibu-testing-spring

Karibu-Testing Demo project for Spring Boot
https://github.com/mvysny/karibu-testing-spring

Last synced: 28 days ago
JSON representation

Karibu-Testing Demo project for Spring Boot

Awesome Lists containing this project

README

        

[![Powered By Vaadin on Kotlin](http://vaadinonkotlin.eu/iconography/vok_badge.svg)](http://vaadinonkotlin.eu)
[![Build Status](https://travis-ci.org/mvysny/karibu-testing-spring.svg?branch=master)](https://travis-ci.org/mvysny/karibu-testing-spring)

# Karibu-Testing Demo project for Spring Boot

A Vaadin 8 example project which demonstrates the possibility to use
the [Karibu-Testing](https://github.com/mvysny/karibu-testing)
Browserless Testing Framework with Spring Boot. No web server,
no Selenium, and no TestBench, pure business logic testing.

> For Vaadin 14 example project please visit [t-shirt-shop-example](https://github.com/mvysny/t-shirt-shop-example).

Either Java or Kotlin might be used, or both. Testing the Vaadin 8 application is as easy as:

Java:
```java
@Test
public void createNewCustomer() {
_click(_get(Button.class, spec -> spec.withCaption("New customer")));
_setValue(_get(TextField.class, spec -> spec.withCaption("First name")), "Halk");
_click(_get(Button.class, spec -> spec.withCaption("Save")));
Grid grid = _get(Grid.class);
Stream customerStream = grid.getDataProvider().fetch(new Query<>());
assertTrue("Halk does not exist", customerStream.map(Customer::getFirstName).anyMatch("Halk"::equals));
}
```

Kotlin:
```kotlin
@Test
fun createNewCustomer() {
_get { caption = "New customer" }._click()
_get { caption = "First name" }._value = "Halk"
_get { caption = "Save" }._click()
val dataProvider = _get> { }.dataProvider
expect(true, "Halk does not exist: ${dataProvider._findAll()}") {
dataProvider._findAll().any { it.firstName == "Halk" }
}
}

```
Workflow
========

To compile the entire project, run `./mvnw -C clean package` (or on Windows: `./mvnw.cmd -C clean package`).

To run the application, run `./mvnw spring-boot:run` and open [http://localhost:8080/](http://localhost:8080/).

To run the tests, run `./mvnw verify`.