This document summarizes a presentation about Arquillian Constellation, a middleware for testing not just Java EE applications. It discusses using Arquillian for integration testing, micro-deployments, Docker and container testing, Kubernetes testing, persistence and database testing, contract testing, visual/Selenium testing, and techniques for speeding up test execution like smart testing.
35. @alexsotob
APE SQL example
@Rule
public ArquillianPersistenceRule arquillianPersistenceRule =
new ArquillianPersistenceRule();
@DbUnit
@ArquillianResource
RdbmsPopulator rdbmsPopulator;
@Before
public void populateData() {
// Given:
rdbmsPopulator.forUri(jdbcUri).withDriver(Driver.class).withUsername("sa")
.withPassword("").usingDataSet("composers.yml")
.execute();
}
35
APE JUnit Rule
(not necessary with
Arquillian Runner)
Set DBUnit usage
Configure Connection and Dataset
Populate
composers:
- id: 1
name: Wolfgang Amadeus Mozart
birthdate: 27/1/1756
died: 5/12/1791
36. @alexsotob
APE SQL example
@After
public void clean_database() {
// Given:
rdbmsPopulator.forUri(jdbcUri).withDriver(Driver.class).withUsername("sa")
.withPassword("").usingDataSet("composers.yml")
.clean();
}
36
Clean After Test
Clean Database
38. @alexsotob38
Benefits of Arquillian APE
> Boilerplate Code
> Programmatic/Declarative
@UsingDataSet/@ShouldMatchDataSet
> SQL Support
DBUnit and Flyway
> REST API Support
Postman Collections
> NoSQL Support
MongoDB, Couchbase, CouchDB, Vault, Redis, Infinispan
49. @alexsotob
Arquillian Graphene Page Object example
@Location("login.xhtml")
public class HomePage {
@Page
private UserPage userPage;
@FindBy(id = "submit")
private WebElement submitButton;
@FindBy(id = "form")
private LoginPopup loginPopup;
// methods
}
49
Location of the page
Another Page Object
Find web element by id
Page fragment
58. @alexsotob58
More about Smart Testing
> Heuristics
new, changed, affected, failed and categorized
> Range of Commits
Define where you want to look at
> Configuration
System Properties or YAML file (global or per module)
> Jenkins Pipeline Shared Library
Integrate with your CI/CD pipeline
> Detection of none class changes
@WatchFile("src/main/resources/META-INF/
> Surefire based
Works with any kind of test that can be run in Surefire
64. @alexsotob64
More about Diferencia
> Comparison
with, without noise detection, strict, subset
> Formats supported
JSON, Plain Text (automatic detection), HTTPS
> Monitoring
HTTP Status, Prometheus
> Rest API
Configure, Stats
> Docker Image
Ready to use in Kubernetes and OpenShift