One of the best experiences you might have as a developer is when you are running your continuous delivery pipeline and one of the test failed because it has found a bug. At this point you see that thanks of your tests you are producing a less buggy software. This should be the normal case, in green field projects, but unlikely to happen when running legacy code with a lot of untested code.
23. @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();
}
23
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
24. @alexsotob
APE SQL example
@After
public void clean_database() {
// Given:
rdbmsPopulator.forUri(jdbcUri).withDriver(Driver.class).withUsername("sa")
.withPassword("").usingDataSet("composers.yml")
.clean();
}
24
Clean After Test
Clean Database
32. @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
}
32
Location of the page
Another Page Object
Find web element by id
Page fragment