SlideShare a Scribd company logo
Breaking free from .staticAbuse()
in test automation frameworks
Hello!
I am Abhijeet Vaikar
● Software Quality Engineer since 6 years and 7
months with a focus on Test Automation
● Quality Engineer @ Carousell
● https://www.linkedin.com/in/abhijeetvaikar/
Southeast Asia's largest and fastest
growing mobile marketplace,
and a highly-rated iPhone & Android app
that makes selling as simple as taking a
photo and buying as simple as chat.
https://www.carousell.com
What are we here for?
● Why we should avoid abusing static methods in
automation frameworks
● What we can do about it.
● How we can use Dependency Injection
frameworks to simplify automation scripts.
Why
we should avoid abusing static in automation frameworks
Breaking free from static abuse in test automation frameworks and using Spring DI
Does this look familiar?
protected void grabScreenshot(){
ScreenshotUtil.captureScreenshot(currentSuiteScreenshotsDirector
yPath);
}
AppiumUtil.scrollDown();
User user = UserService.getUser(expectedUserKey);
Does this look familiar?
itemName =
TestDataService.extract(itemName);
private static
AndroidDriver<WebElement> driver;
So what’s wrong with that?
Concurrency issues
All static objects are shared between threads. Imagine the race condition issues with
parallel test executions.
private static WebDriver driver;
private static HashMap<String, String> testResultsMap;
Thread 1
Thread 2 Thread 3
Expect something :)
Get something else :’(
Design
Code becomes procedural instead of object oriented.
public class LoginTest {
@Test(priority = 0)
public void loginfail() {
LoginPage.goTo("http://127.0.0.1:8080/login");
LoginPage.loginAs("wrong username", "wrongpassword");
boolean didLoginFail = LoginPage.loginErrorDisplayed();
Assert.assertTrue(didLoginFail == true, "Bad login was successful");
if (didLoginFail){
LoginPage.getLoginErrorMessage();
}
}
@Test(priority = 1)
public void loginsuccess() {
LoginPage.loginAs("correct_username", "correctpass");
boolean didLoginFail = LoginPage.loginErrorDisplayed();
Assert.assertTrue(didLoginFail == false, "Valid Login was unsuccessful");
}
Mutable state
Static objects if kept mutable leaves their values open to change by other code.
/** Contains all the constant system property names */
public final class SystemPropertyConstants {
public static String loginEndPoint = "/api/login/";
}
// In some other code
SystemPropertyConstants.loginEndPoint = "/api/logout/";
What
Can we do about it?
“Make the framework smart so that the
test code can be short and simple.
Test code must be so concise that it
doesn't matter which language is used to
run it”
- Martin Schneider ( Java Ninja @
Carousell )
For concurrency issues
public static ThreadLocal<WebDriver> driver;
driver =
new ThreadLocal<WebDriver>() {
@Override
protected WebDriver initialValue() {
return new FirefoxDriver(); // You
can use other driver based on your requirement.
}
};
OR use Dependency Injection with non-static object
Design
Use Object-Oriented programming concepts (abstraction, encapsulation, inheritance, polymorphism) to make your
test code maintainable.
new AuthPage().login("username","password");
SellingPage sellingPage = new HomePage().startSelling();
sellingPage
.setCategory(Category.EVERYTHING_ELSE)
.setItemDetails("Carousell Test Item",ConditionType.NEW,"Test Description")
.setPrice("10.12")
.setDealDetails(DealType.MEETUP,"Lets meetup at 5 PM")
.listIt();
AND enhance them using Dependency Injection
Mutable state
To avoid static objects being overwritten by other code, declare them final
/** Contains all the constant system property names */
public final class SystemPropertyConstants {
public static final String loginEndPoint = "/api/login/";
}
What is
Dependency
Injection????
Dependency Injection
Dependency Non-Injection
public class Employee {
private Address address;
public Employee() {
address = new Address();
}
}
Employee employee = new Employee(new address);
Employee employee = new Employee();
employee.setAddress(new Address());
SellingPage sellingPage = new SellingPage(driver);
// Injecting driver dependency in pageobjects
@BeforeMethod
public void setUp(ITestContext testContext){
...
}
// DI used by TestNG
Dependency Injection using a framework
● Use a DI framework instead of managing dependencies manually.
● DI frameworks: Spring, Google Guice, PicoContainer, Dagger
● These frameworks use IoC (Inversion of Control) container in which all the
dependencies are registered, initialized and managed.
● IoC (Inversion of Control) - “Don’t call us, we call you”
● Once the dependencies are instantiated, the container injects them using
approaches like:
○ Constructor injection
○ Setter method injection
○ Field injection
Benefits of Dependency Injection
● Single Responsibility Principle
● Clean, Readable code
● Isolated components which become easy for testing as dependencies can be
mocked without modifying depending class.
How
we can use Dependency Injection frameworks to simplify automation scripts.
22
Spring Dependency Injection
Spring IoC Container
(where all the magic
happens!)
Configuration in Java
class or XML
Read dependency and configuration details
Create dependency
objects and inject them
POJOs/ Java
Classes part of your
application
code/test code
Usable system with
all dependencies
available
@Component @Configuration
@Autowired @Bean
Applied to fields, setter methods, and
constructors. The @Autowired annotation
injects object dependency implicitly.
Used as config for
Spring. Can have
methods to instantiate
and configure the
dependencies
Marks the Java class
as a bean or
component (i.e., you
want Spring to
manage this class
instance)
Applied to fields, setter methods, and
constructors. The @Autowired annotation
injects object dependency implicitly.
Commonly used annotations in Spring
Used for conditional
loading of classes
based on usecase
(environment,
platform etc)
@Profile
@Test()
public void testNewListingAppearsInSearch() throws Exception {
new WelcomePage(driver).beginSignUpOrLoginWithEmail();
new AuthPage(driver).login("username","password");
new
HomePage(driver).startSellingWithPhotoFromCamera();
new CameraPage(driver).capturePhoto();
new CameraPhotoPreviewEditPage(driver).moveForward();
}
}
● Driver is a dependency for PageObjects.
● PageObjects are a dependency for the test class
(Is it necessary to create new instance of pageobject every time?)
public class WelcomePage extends BasePage {
private WebDriver driver;
WelcomePage(WebDriver driver){
super(driver);
this.driver = driver;
}
. . . .
}
@Configuration
@ComponentScan(basePackages = "com.carousell")
public class SpringContext {
@Autowired
private TestConfiguration configuration;
private WebDriver driver;
@Bean
public WebDriver getWebDriver() {
if(configuration.isWeb()){
driver = new ChromeDriver();
}
else if(configuration.isAndroid() {
driver = new AndroidDriver();
}
else if(configuration.isIOS()) {
driver = new IOSDriver();
}
return driver;
}
Create a configuration class for Spring to manage dependencies
public class WelcomePage extends BasePage {
@Autowired
private WebDriver driver;
//You can move this to BasePage too
. . . .
}
29
@Component
public class WelcomePage extends BasePage {
@Autowired
private WebDriver driver;
//You can move this to BasePage too
. . . .
}
@Autowired
WelcomePage welcomePage;
@Autowired
AuthPage authPage;
. . . . .
@Test()
public void testNewListingAppearsInSearch() throws Exception {
welcomPage.beginSignUpOrLoginWithEmail();
authPage.login("username","password");
homePage.startSellingWithPhotoFromCamera();
cameraPage.capturePhoto();
cameraPhotoPreviewEditPage.moveForward();
//Use references directly as they are already injected with instance by
Spring
}
public abstract class WelcomePage
extends BasePage {
}
@Component
@Profile(Platform.ANDROID)
public class AndroidWelcomePage
extends WelcomePage {
}
@Component
@Profile(Platform.IOS)
public class IOSWelcomePage
extends WelcomePage {
}
spring.profiles.active=ANDROID - Initializes AndroidWelcomePage and injects into an
Autowired variable.
Sounds good. Where can I find real
world implementation of such
framework?
Check out https://www.justtestlah.qa/
Python: dependency_injector, Spring Python
Ruby: sinject, dry-container
C#: Spring.Net , Castle Windsor, Unity, Autofac
Javascript: BottleJS, InversifyJS, DI-Ninja
Thank you. Questions?
Reference
Inversion of Control and Dependency Injection
https://martinfowler.com/bliki/InversionOfControl.html
https://martinfowler.com/articles/injection.html
https://www.baeldung.com/inversion-control-and-dependency-injection-in-spring
https://dzone.com/articles/a-guide-to-spring-framework-annotations
https://stackoverflow.com/questions/52720198/how-does-spring-profile-work-with-inheritance
Static methods and variables
https://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil
https://stackoverflow.com/questions/2671496/java-when-to-use-static-methods
https://stackoverflow.com/questions/4002201/why-arent-static-methods-considered-good-oo-practice
https://softwareengineering.stackexchange.com/questions/336701/static-services-and-testability
Use of Dependency Injection in automation frameworks
www.justtestlah.qa by Martin Schneider
https://peterkedemo.wordpress.com/2013/03/30/writing-good-selenium-tests-with-page-objects-and-spring/

More Related Content

PPTX
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
PDF
Selenium Overview
ODP
Integrating Selenium testing infrastructure into Scala Project
PDF
Web UI test automation instruments
PPTX
Automated UI testing done right (DDDSydney)
PDF
UI Testing Best Practices - An Expected Journey
PPTX
Selenium WebDriver
PDF
Integration Testing With ScalaTest and MongoDB
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
Selenium Overview
Integrating Selenium testing infrastructure into Scala Project
Web UI test automation instruments
Automated UI testing done right (DDDSydney)
UI Testing Best Practices - An Expected Journey
Selenium WebDriver
Integration Testing With ScalaTest and MongoDB

What's hot (20)

PDF
UI Testing Automation
PPTX
Selenium web driver
PPTX
Automated Smoke Tests with Protractor
PDF
Test automation - Building effective solutions
PPT
Introduction to Selenium
PPTX
Protractor Testing Automation Tool Framework / Jasmine Reporters
PPTX
Automation Testing by Selenium Web Driver
PPTX
Codeception
PDF
Acceptance & Functional Testing with Codeception - Devspace 2015
PDF
PHP Unit Testing in Yii
PDF
Testing Web Applications
PDF
Mobile Testing with Selenium 2 by Jason Huggins
PDF
Join the darkside: Selenium testing with Nightwatch.js
PPTX
Testing android apps with espresso
PDF
Front-End Testing: Demystified
PDF
Selenium Basics Tutorial
PDF
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
PDF
Codeception introduction and use in Yii
PDF
WinAppDriver - Windows Store Apps Test Automation
PPTX
An overview of selenium webdriver
UI Testing Automation
Selenium web driver
Automated Smoke Tests with Protractor
Test automation - Building effective solutions
Introduction to Selenium
Protractor Testing Automation Tool Framework / Jasmine Reporters
Automation Testing by Selenium Web Driver
Codeception
Acceptance & Functional Testing with Codeception - Devspace 2015
PHP Unit Testing in Yii
Testing Web Applications
Mobile Testing with Selenium 2 by Jason Huggins
Join the darkside: Selenium testing with Nightwatch.js
Testing android apps with espresso
Front-End Testing: Demystified
Selenium Basics Tutorial
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
Codeception introduction and use in Yii
WinAppDriver - Windows Store Apps Test Automation
An overview of selenium webdriver
Ad

Similar to Breaking free from static abuse in test automation frameworks and using Spring DI (20)

PPTX
Using Page Objects
ODP
Unit Testing and Coverage for AngularJS
PPTX
Protractor framework architecture with example
PDF
Modular Test-driven SPAs with Spring and AngularJS
PDF
Design Patterns in Automation Framework.pdf
PPTX
Introduction to Spring Boot
PDF
Spring 3: What's New
PDF
Vaadin 7 CN
PPTX
Test automation
PPTX
Mastering Test Automation: How To Use Selenium Successfully
PDF
Human Talks - StencilJS
PDF
Hybrid App using WordPress
PDF
70562 (1)
PPT
Test strategy for web development
PPTX
Frontend training
PDF
Visual Regression Testing Using Playwright.pdf
PDF
Spring MVC Intro / Gore - Nov NHJUG
PDF
Angular server side rendering - Strategies & Technics
ODP
Bring the fun back to java
PDF
The Role of Python in SPAs (Single-Page Applications)
Using Page Objects
Unit Testing and Coverage for AngularJS
Protractor framework architecture with example
Modular Test-driven SPAs with Spring and AngularJS
Design Patterns in Automation Framework.pdf
Introduction to Spring Boot
Spring 3: What's New
Vaadin 7 CN
Test automation
Mastering Test Automation: How To Use Selenium Successfully
Human Talks - StencilJS
Hybrid App using WordPress
70562 (1)
Test strategy for web development
Frontend training
Visual Regression Testing Using Playwright.pdf
Spring MVC Intro / Gore - Nov NHJUG
Angular server side rendering - Strategies & Technics
Bring the fun back to java
The Role of Python in SPAs (Single-Page Applications)
Ad

More from Abhijeet Vaikar (6)

PDF
Unit testing (Exploring the other side as a tester)
PDF
End-end tests as first class citizens - SeleniumConf 2020
PDF
Good practices for debugging Selenium and Appium tests
PPTX
Upgrading Mobile Tester's Weapons with Advanced Debugging
PPTX
Mongo DB 102
PPTX
MongoDB 101
Unit testing (Exploring the other side as a tester)
End-end tests as first class citizens - SeleniumConf 2020
Good practices for debugging Selenium and Appium tests
Upgrading Mobile Tester's Weapons with Advanced Debugging
Mongo DB 102
MongoDB 101

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PPTX
Operating system designcfffgfgggggggvggggggggg
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
medical staffing services at VALiNTRY
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How to Choose the Right IT Partner for Your Business in Malaysia
Wondershare Filmora 15 Crack With Activation Key [2025
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Advanced SystemCare Ultimate Crack + Portable (2025)
Why Generative AI is the Future of Content, Code & Creativity?
Internet Downloader Manager (IDM) Crack 6.42 Build 41
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Designing Intelligence for the Shop Floor.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Operating system designcfffgfgggggggvggggggggg
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
L1 - Introduction to python Backend.pptx
Patient Appointment Booking in Odoo with online payment
Autodesk AutoCAD Crack Free Download 2025
medical staffing services at VALiNTRY

Breaking free from static abuse in test automation frameworks and using Spring DI

  • 1. Breaking free from .staticAbuse() in test automation frameworks
  • 2. Hello! I am Abhijeet Vaikar ● Software Quality Engineer since 6 years and 7 months with a focus on Test Automation ● Quality Engineer @ Carousell ● https://www.linkedin.com/in/abhijeetvaikar/
  • 3. Southeast Asia's largest and fastest growing mobile marketplace, and a highly-rated iPhone & Android app that makes selling as simple as taking a photo and buying as simple as chat. https://www.carousell.com
  • 4. What are we here for? ● Why we should avoid abusing static methods in automation frameworks ● What we can do about it. ● How we can use Dependency Injection frameworks to simplify automation scripts.
  • 5. Why we should avoid abusing static in automation frameworks
  • 7. Does this look familiar? protected void grabScreenshot(){ ScreenshotUtil.captureScreenshot(currentSuiteScreenshotsDirector yPath); } AppiumUtil.scrollDown(); User user = UserService.getUser(expectedUserKey);
  • 8. Does this look familiar? itemName = TestDataService.extract(itemName); private static AndroidDriver<WebElement> driver;
  • 9. So what’s wrong with that?
  • 10. Concurrency issues All static objects are shared between threads. Imagine the race condition issues with parallel test executions. private static WebDriver driver; private static HashMap<String, String> testResultsMap; Thread 1 Thread 2 Thread 3 Expect something :) Get something else :’(
  • 11. Design Code becomes procedural instead of object oriented. public class LoginTest { @Test(priority = 0) public void loginfail() { LoginPage.goTo("http://127.0.0.1:8080/login"); LoginPage.loginAs("wrong username", "wrongpassword"); boolean didLoginFail = LoginPage.loginErrorDisplayed(); Assert.assertTrue(didLoginFail == true, "Bad login was successful"); if (didLoginFail){ LoginPage.getLoginErrorMessage(); } } @Test(priority = 1) public void loginsuccess() { LoginPage.loginAs("correct_username", "correctpass"); boolean didLoginFail = LoginPage.loginErrorDisplayed(); Assert.assertTrue(didLoginFail == false, "Valid Login was unsuccessful"); }
  • 12. Mutable state Static objects if kept mutable leaves their values open to change by other code. /** Contains all the constant system property names */ public final class SystemPropertyConstants { public static String loginEndPoint = "/api/login/"; } // In some other code SystemPropertyConstants.loginEndPoint = "/api/logout/";
  • 13. What Can we do about it?
  • 14. “Make the framework smart so that the test code can be short and simple. Test code must be so concise that it doesn't matter which language is used to run it” - Martin Schneider ( Java Ninja @ Carousell )
  • 15. For concurrency issues public static ThreadLocal<WebDriver> driver; driver = new ThreadLocal<WebDriver>() { @Override protected WebDriver initialValue() { return new FirefoxDriver(); // You can use other driver based on your requirement. } }; OR use Dependency Injection with non-static object
  • 16. Design Use Object-Oriented programming concepts (abstraction, encapsulation, inheritance, polymorphism) to make your test code maintainable. new AuthPage().login("username","password"); SellingPage sellingPage = new HomePage().startSelling(); sellingPage .setCategory(Category.EVERYTHING_ELSE) .setItemDetails("Carousell Test Item",ConditionType.NEW,"Test Description") .setPrice("10.12") .setDealDetails(DealType.MEETUP,"Lets meetup at 5 PM") .listIt(); AND enhance them using Dependency Injection
  • 17. Mutable state To avoid static objects being overwritten by other code, declare them final /** Contains all the constant system property names */ public final class SystemPropertyConstants { public static final String loginEndPoint = "/api/login/"; }
  • 18. What is Dependency Injection???? Dependency Injection Dependency Non-Injection public class Employee { private Address address; public Employee() { address = new Address(); } } Employee employee = new Employee(new address); Employee employee = new Employee(); employee.setAddress(new Address());
  • 19. SellingPage sellingPage = new SellingPage(driver); // Injecting driver dependency in pageobjects @BeforeMethod public void setUp(ITestContext testContext){ ... } // DI used by TestNG
  • 20. Dependency Injection using a framework ● Use a DI framework instead of managing dependencies manually. ● DI frameworks: Spring, Google Guice, PicoContainer, Dagger ● These frameworks use IoC (Inversion of Control) container in which all the dependencies are registered, initialized and managed. ● IoC (Inversion of Control) - “Don’t call us, we call you” ● Once the dependencies are instantiated, the container injects them using approaches like: ○ Constructor injection ○ Setter method injection ○ Field injection
  • 21. Benefits of Dependency Injection ● Single Responsibility Principle ● Clean, Readable code ● Isolated components which become easy for testing as dependencies can be mocked without modifying depending class.
  • 22. How we can use Dependency Injection frameworks to simplify automation scripts. 22
  • 23. Spring Dependency Injection Spring IoC Container (where all the magic happens!) Configuration in Java class or XML Read dependency and configuration details Create dependency objects and inject them POJOs/ Java Classes part of your application code/test code Usable system with all dependencies available
  • 24. @Component @Configuration @Autowired @Bean Applied to fields, setter methods, and constructors. The @Autowired annotation injects object dependency implicitly. Used as config for Spring. Can have methods to instantiate and configure the dependencies Marks the Java class as a bean or component (i.e., you want Spring to manage this class instance) Applied to fields, setter methods, and constructors. The @Autowired annotation injects object dependency implicitly. Commonly used annotations in Spring Used for conditional loading of classes based on usecase (environment, platform etc) @Profile
  • 25. @Test() public void testNewListingAppearsInSearch() throws Exception { new WelcomePage(driver).beginSignUpOrLoginWithEmail(); new AuthPage(driver).login("username","password"); new HomePage(driver).startSellingWithPhotoFromCamera(); new CameraPage(driver).capturePhoto(); new CameraPhotoPreviewEditPage(driver).moveForward(); } } ● Driver is a dependency for PageObjects. ● PageObjects are a dependency for the test class (Is it necessary to create new instance of pageobject every time?)
  • 26. public class WelcomePage extends BasePage { private WebDriver driver; WelcomePage(WebDriver driver){ super(driver); this.driver = driver; } . . . . }
  • 27. @Configuration @ComponentScan(basePackages = "com.carousell") public class SpringContext { @Autowired private TestConfiguration configuration; private WebDriver driver; @Bean public WebDriver getWebDriver() { if(configuration.isWeb()){ driver = new ChromeDriver(); } else if(configuration.isAndroid() { driver = new AndroidDriver(); } else if(configuration.isIOS()) { driver = new IOSDriver(); } return driver; } Create a configuration class for Spring to manage dependencies
  • 28. public class WelcomePage extends BasePage { @Autowired private WebDriver driver; //You can move this to BasePage too . . . . }
  • 29. 29 @Component public class WelcomePage extends BasePage { @Autowired private WebDriver driver; //You can move this to BasePage too . . . . }
  • 30. @Autowired WelcomePage welcomePage; @Autowired AuthPage authPage; . . . . . @Test() public void testNewListingAppearsInSearch() throws Exception { welcomPage.beginSignUpOrLoginWithEmail(); authPage.login("username","password"); homePage.startSellingWithPhotoFromCamera(); cameraPage.capturePhoto(); cameraPhotoPreviewEditPage.moveForward(); //Use references directly as they are already injected with instance by Spring }
  • 31. public abstract class WelcomePage extends BasePage { } @Component @Profile(Platform.ANDROID) public class AndroidWelcomePage extends WelcomePage { } @Component @Profile(Platform.IOS) public class IOSWelcomePage extends WelcomePage { } spring.profiles.active=ANDROID - Initializes AndroidWelcomePage and injects into an Autowired variable.
  • 32. Sounds good. Where can I find real world implementation of such framework? Check out https://www.justtestlah.qa/
  • 33. Python: dependency_injector, Spring Python Ruby: sinject, dry-container C#: Spring.Net , Castle Windsor, Unity, Autofac Javascript: BottleJS, InversifyJS, DI-Ninja
  • 35. Reference Inversion of Control and Dependency Injection https://martinfowler.com/bliki/InversionOfControl.html https://martinfowler.com/articles/injection.html https://www.baeldung.com/inversion-control-and-dependency-injection-in-spring https://dzone.com/articles/a-guide-to-spring-framework-annotations https://stackoverflow.com/questions/52720198/how-does-spring-profile-work-with-inheritance Static methods and variables https://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil https://stackoverflow.com/questions/2671496/java-when-to-use-static-methods https://stackoverflow.com/questions/4002201/why-arent-static-methods-considered-good-oo-practice https://softwareengineering.stackexchange.com/questions/336701/static-services-and-testability Use of Dependency Injection in automation frameworks www.justtestlah.qa by Martin Schneider https://peterkedemo.wordpress.com/2013/03/30/writing-good-selenium-tests-with-page-objects-and-spring/

Editor's Notes

  • #11: Static objects represent global state and scope-less.
  • #24: this is just the tip of the iceberg that Spring offers. It's grown to become much more than a framework, Spring is actually an entire application development ecosystem. We only use spring-core to get the Spring container. Whether or not to use Spring in a testing framework depends on multiple factors, for example what other functionality is needed (for example, Spring has a good way of accessing web services). You could mention that Spring is not the most lightweight solution but one that's been around for many years and quite well maintained. Also chances are that engineers have experience with it (plus the experience they gain by using it is more valuable than e.g. just knowing Cucumber DI).