Skip to content

Instantly share code, notes, and snippets.

Avatar
🇧🇷

Elias Nogueira eliasnogueira

🇧🇷
View GitHub Profile
@eliasnogueira
eliasnogueira / general.properties
Last active Jun 19, 2022
Example of the general properties file to run the Selenium tests locally or in a remote machine
View general.properties
# target execution: local or remote
target = local
# browser to use
browser = chrome
# run test into headless mode
headless = true
# initial URL
@eliasnogueira
eliasnogueira / ChromeManager.java
Created Jun 4, 2022
Snippet of getOptions method in ChromeManager class
View ChromeManager.java
@Override
public ChromeOptions getOptions() {
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--start-maximized");
chromeOptions.addArguments("--disable-infobars");
chromeOptions.addArguments("--disable-notifications");
chromeOptions.setHeadless(configuration().headless());
return chromeOptions;
}
@eliasnogueira
eliasnogueira / RemoteDriverFactory.java
Created Jun 3, 2022
Code snippet from the local-remote execution
View RemoteDriverFactory.java
@Override
public WebDriver createInstance(String browser) {
MutableCapabilities capability;
BrowserList browserToCreate = BrowserList.valueOf(browser.toUpperCase());
switch (browserToCreate) {
case CHROME:
capability = new ChromeDriverManager().getOptions();
break;
case FIREFOX:
View DriverFactory.java
public class DriverFactory implements IDriverFactory {
@Override
public WebDriver createInstance(String browser) {
Target target = Target.valueOf(configuration().target().toUpperCase());
WebDriver webdriver;
switch (target) {
case LOCAL:
webdriver = new LocalDriverFactory().createInstance(browser);
@eliasnogueira
eliasnogueira / how-to-test-complex-api-integrations.md
Last active May 2, 2022
How to test complex API integrations
View how-to-test-complex-api-integrations.md

Title

How to test complex API integrations

Elevator pitch

Testing microservices is a day-by-day activity for any software engineer and is highly required to deliver bug-free services. Most of them create tests that can be seen only inside de microservice project which are unit and integration, whereas others cannot have the benefit to reuse. Applying the approach proposed in this presentation will enable you to create an approach to add more coverage, speed up the testing process, and enable e2e tests across different APIs.

Description

In the world of microservices, one of the challenges is to guarantee that the integrations we have for internal and external services are working without mocks. Normally we do unit and integration tests, but it's not sufficient to cover scenarios the customer might do in the real world.

This presentation will show how to extend the API test coverage through functional and end-to-end tests, using Rest-Assured, some design and test patterns, and a pipeline strategy to

@eliasnogueira
eliasnogueira / shift-left-testing-dev.md
Last active May 1, 2022
The Shift-Left Testing and the Saga for the Continuous Delivery
View shift-left-testing-dev.md

Title

The Shift-Left Testing and the Saga for the Continuous Delivery

Description

Every year we are trying to improve the development process in the context we are working on, with one main goal: to deliver a reliable application, as fast as we can, to the customers. One of the approaches many companies follow is Continuous Delivery, which will allow us to deliver continuously, with confidence, what we've developed. One of the key aspects is to check the application, which means testing it, at different moments, to make the application reliable.

In the context I'm inserted, a group of engineers (me included) has worked hard to create an approach based on our challenges, which include: how to deliver Java cloud-native applications asynchronously and bug-free?

This presentation will share the old process, the problems we were facing, and the approaches, tools, and techniques we used to test the Java applications on different levels (unit, integration, database, API covering functional and e2e tests).

View keybase.md

Keybase proof

I hereby claim:

  • I am eliasnogueira on github.
  • I am eliasnogueira (https://keybase.io/eliasnogueira) on keybase.
  • I have a public key ASBnVy1hOunqED6MONU4agw7RMgf1vxw42gdoeqtsRx5PQo

To claim this, I am signing this object:

View PostTest.java
class PostTest {
@Test
void postUsingObjectMapping() {
User user = new User("Elias", "Principal Engineer");
given().
contentType(ContentType.JSON).
body(user).
View User.java
public class User {
private String name;
private String job;
public User(String name, String job) {
this.name = name;
this.job = job
}
@eliasnogueira
eliasnogueira / JavaFakerExampleTest.java
Last active Oct 10, 2021
JavaFaker example for the CustomerData data generation
View JavaFakerExampleTest.java
class BasicExampleTest {
@Test
@DisplayName("Data validations using faker library")
void faker() {
Faker faker = new Faker();
CustomerData customerData = CustomerData.builder().
id((int) faker.number().randomNumber()).
name(faker.name().name()).