With Isolated and Integrated tests
Aritz Águila Díaz
Community
Work
@duiraritz
Aritz Águila Díaz
Co-organizer
Owner
Head of QA
Quality Engineer
Present
Former
Find bugs strategy
This makes testing not entirely efficient and affects team productivity.
Preventive bugs strategy
Isolated tests
Three pillars
Productivity
Defect
prevention
Adaptability
Tests that require a real communication or integration with other collaborator.
Poor traceability
Poor feedback
Flaky tests
Long testing time
Tests that don't require a real communication or integration with other collaborator.
Nobel prize storage app
package prizes.getPrizes.successfully
import org.springframework.cloud.contract.spec.Contract
Contract.make {
request {
method('GET')
url('/nobel_prizes/v1/')
}
response {
status OK()
...
Contract
Consumer
Provider
Ensure that the sent or received message complies with the agreed conditions
Consumer & Provider isolated testing
Conditions
Nobel prize front
version: "3.1"
services:
stubs:
image: spring-cloud-contract-stub-runner:2.1.2.RELEASE
environment:
- STUBRUNNER_IDS=...infrastructure:+:stubs:9876
- STUBRUNNER_STUBS_MODE=LOCAL
volumes:
- ~/.m2:/root/.m2
...
Docker-compose stub runner
E2E test
context('Navigation', () => {
it('search a nobel prize by category and years', () => {
const category = 'physics'
const from = '2018'
const to = '2019'
cy.get('[data-test=search-category]').type(category
...
})
})
version: "3.1"
services:
back_test_web:
depends_on:
- back_test_db
- back_test_wiremock
build:
dockerfile: ./src/e2eTest/resources/docker/Dockerfile
...
Docker-compose
@Test void
should_get_nobel_prizes() {
//Call to api first time
given()
.when()
.contentType(ContentType.JSON)
.get(nobelPrizesApiUrl)
.then()
.statusCode(200);
...
}
E2E test
Nobel prize storage app
Both are complementary.
Balanced and defined test strategy based on product requirements.
Use for acceptance and regression tests in a development stage in order to get a quick feedback.
Use as support in order to get a more complete quality status.