This document summarizes a test for an ExchangeRateUploader class that uploads exchange rates to a database. The test mocks several dependencies, sets up test data including currencies and exchange rates, and verifies the uploader saves the rates and finalizes the thread.
Data in Motion: Streaming Static Data Efficiently 2Martin Zapletal
Updated version for SD Berlin 2016. Distributed streaming performance, consistency, reliable delivery, durability, optimisations, event time processing and other concepts discussed and explained on Akka Persistence and other examples.
Introduction
Spring Boot testing features
Example of microservices with Spring Cloud
Component & Integration testing with Hoverfly
Contract testing with Pact or Spring Cloud Contract
Load testing with Gatling
Integration & end-to-end testing with Arquillian Cube
Summary
Data in Motion: Streaming Static Data Efficiently 2Martin Zapletal
Updated version for SD Berlin 2016. Distributed streaming performance, consistency, reliable delivery, durability, optimisations, event time processing and other concepts discussed and explained on Akka Persistence and other examples.
Introduction
Spring Boot testing features
Example of microservices with Spring Cloud
Component & Integration testing with Hoverfly
Contract testing with Pact or Spring Cloud Contract
Load testing with Gatling
Integration & end-to-end testing with Arquillian Cube
Summary
Poche chiacchiere e tanto codice per cercare rendere la nostra vita di
sviluppatori più divertente.
Parleremo di JAX-RS, le annotazioni, l'MVC che mette a disposizione e
l'integrazione di Jersey con Guice.
Useremo AOP per gestire log, transazioni e con l'aiuto di Infinispan
limiteremo le chamate concorrenti sul nostro cluster.
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
Spring and Cloud Foundry: a Marriage Made in Heaven. This talk introduces how to build Spring applications on top of Cloud Foundry, the open source PaaS from VMware
JavaFX 8 est disponible depuis mars 2014 et apporte son lot de nouveautés. Gradle est en version 2 depuis juillet 2014. Deux technologies plus que prometteuses: JavaFX donne un coup de jeune au développement d’applications desktop en Java en apportant un navigateur web intégré, le support des WebSockets, de la 3D, et bien d’autres. Gradle est l’outil de d’automatisation de build à la mode, apportant de superbes possibilités par rapport rapport à maven, outil vieillissant, grâce à l’engouement de la communauté vis à vis de cet outil mais aussi par le fait de la technologie utilisée en son sein: groovy. Venez découvrir comment il est possible de réaliser rapidement une application à la mode en JavaFX avec un outil à la mode également. Bref venez à une session trendy.
This presentation was given at DevFest Twin Cities in 2013, and introduces droidQuery - the Android port of jQuery, that allows UI manipulation and traversal of the Android layout, asynchronous REST client calls, event handling, animations, and much more.
The talk presents how we established a TDD cycle within the complex AEM technology stack using a "unified testing API". It illustrates how such an API can be built and discusses various advantages over other approaches such as the Sling Testing API.
Workshop slides from the Alt.Net Seattle 2011 workshop. Presented by Wes Dyer and Ryan Riley. Get the slides and the workshop code at http://rxworkshop.codeplex.com/
Similar to Sustaining Test-Driven Development (20)
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
4. Test Readability
To design is to communicate clearly by
whatever means you can control or
master.
—Milton Glaser
Friday, 9 September 2011
5. Test Names
Describe Features
public class TargetObjectTest {
@Test public void isReady() {
✘
@Test public void choose() {
@Test public void choose1() {
public class TargetObject {
public void isReady() {
public void choose(Picker picker) {
www.growing-object-oriented-software.com 2011
Test Names
Describe Features
public class ListTests {
@Test public void
holdsItemsInTheOrderTheyWereAdded() {
@Test public void
canHoldMultipleReferencesToTheSameItem() {
@Test public void
throwsAnExceptionWhenRemovingAnItemItDoesntHold() {
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
6. Canonical Test Structure
public class StringTemplateTest {
@Test public void expandsMacrosSurroundedWithBraces() {
StringTemplate template = new StringTemplate("{a}{b}"); Setup
HashMap<String,Object> macros = new HashMap<String,Object>();
macros.put("a", "A"); macros.put("b", "B");
String expanded = template.expand(macros); Execute
assertThat(expanded, equalTo("AB")); Assert
Teardown
}
}
www.growing-object-oriented-software.com 2011
Streamline the Test Code
assertThat(instruments,
hasItem(instrumentWithPrice(greaterThan(81))));
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
7. Narrow Assertions and
Expectations
oneOf(failureReporter).cannotTranslateMessage(
with(SNIPER_ID), with(badMessage),
with(any(RuntimeException.class)));
www.growing-object-oriented-software.com 2011
Self-Describing Variables
final static Chat UNUSED_CHAT = null;
final static int INVALID_ID = 666;
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
8. @RunWith(NestedJUnit4.class)
public class RemovingFullRowsTest extends Assert {
private static final RotatableGrid PIECE =
new RotatablePiece(
"" +
".X.n" +
".X.n" +
".X.n");
private final RowRemovalListener listener =
mock(RowRemovalListener.class);
private Board board;
private void dropAndFallToBottom(RotatableGrid piece) {
board.drop(piece);
while (board.hasFalling()) {
board.tick();
}
}
[...]
http://www.cs.helsinki.fi/u/luontola/tdd-2009/harjoitukset
public class When_many_rows_become_full_at_the_same_time {
@Before
public void dropPiece() {
board = new Board("" +
"........n" +
"........n" +
"AAAA.AAAn" +
"BBBB..BBn" +
"CCCC.CCCn");
board.addRowRemovalListener(listener);
dropAndFallToBottom(PIECE);
}
@Test
public void all_of_those_rows_are_removed() {
String s = board.toString();
assertFalse("Should not contain 'A':n" + s, s.contains("A"));
assertFalse("Should not contain 'C':n" + s, s.contains("C"));
}
@Test
public void the_row_removal_listener_is_notified_about_the_removed_rows() {
verify(listener).onRowsRemoved(2);
}
}
Friday, 9 September 2011
9. Constructing
Complex Test Data
Many attempts to communicate are
nullified by saying too much.
—Robert Greenleaf
The Problem With
Object Structures
Order order = new Order(
new Customer("Sherlock Holmes",
new Address("221b Baker Street",
"London",
new PostCode("NW1", "3RX"))));
order.addLine(new OrderLine("Deerstalker Hat", 1));
order.addLine(new OrderLine("Tweed Cape", 1));
Order order1 = ExampleOrders.newDeerstalkerAndCapeAndSwordstickOrder();
Order order2 = ExampleOrders.newDeerstalkerAndBootsOrder();
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
10. Test Data Builder:
Add Indirection
public class OrderBuilder {
private Customer customer = new CustomerBuilder().build();
private List<OrderLine> lines = new ArrayList<OrderLine>();
private BigDecimal discountRate = BigDecimal.ZERO;
public OrderBuilder withCustomer(Customer customer) {
this.customer = customer;
return this;
}
public OrderBuilder withOrderLines(OrderLines lines) {
this.lines = lines;
return this;
}
public OrderBuilder withDiscount(BigDecimal discountRate) {
this.discountRate = discountRate;
return this;
}
public Order build() {
Order order = new Order(customer);
for (OrderLine line : lines) order.addLine(line);
order.setDiscountRate(discountRate);
return order;
}
}
www.growing-object-oriented-software.com 2011
Only Need To Include
Relevant Values
new OrderBuilder()
.fromCustomer(
new CustomerBuilder()
.withAddress(new AddressBuilder().withNoPostcode().build())
.build())
.build();
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
11. Named Methods Make
Mistakes Obvious
new AddressBuilder()
.withStreet("221b Baker Street")
.withStreet2("London")
.withPostCode("NW1 6XE")
.build();
www.growing-object-oriented-software.com 2011
Use Builders to
Create Similar Objects
OrderBuilder hatAndCape = new OrderBuilder()
.withLine("Deerstalker Hat", 1)
.withLine("Tweed Cape", 1);
Order orderWithDiscount = hatAndCape
.but().withDiscount(0.10).build();
Order orderWithGiftVoucher = hatAndCape
.but().withGiftVoucher("abc").build();
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
12. Compacting Construction
Order order = anOrder()
.from(aCustomer()
.with(anAddress().withNoPostcode()))
.build();
Address aLongerAddress = anAddress()
.withStreet("221b Baker Street")
.withCity("London")
.with(postCode("NW1", "3RX"))
.build();
www.growing-object-oriented-software.com 2011
Refactor To Builders
@Test public void reportsTotalSalesOfOrderedProducts() {
sendAndProcess(anOrder()
.withLine("Deerstalker Hat", 1)
.withLine("Tweed Cape", 1));
sendAndProcess(anOrder().withLine("Deerstalker Hat", 1));
TotalSalesReport report = gui.openSalesReport();
report.checkDisplayedTotalSalesFor("Deerstalker Hat", is(equalTo(2)));
report.checkDisplayedTotalSalesFor("Tweed Cape", is(equalTo(1)));
void sendAndProcess(OrderBuilder orderDetails) {
Order order = orderDetails
.withDefaultCustomersReference(nextCustomerReference())
.build();
requestSender.send(order);
progressMonitor.waitForCompletion(order);
}
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
13. What, Not How
@Test public void reportsTotalSalesOfOrderedProducts() {
havingReceived(anOrder()
.withLine("Deerstalker Hat", 1)
.withLine("Tweed Cape", 1));
havingReceived(anOrder().withLine("Deerstalker Hat", 1));
TotalSalesReport report = gui.openSalesReport();
report.displaysTotalSalesFor("Deerstalker Hat", equalTo(2));
report.displaysTotalSalesFor("Tweed Cape", equalTo(1));
}
www.growing-object-oriented-software.com 2011
Test Diagnostics
Mistakes are the portals of discovery.
—James Joyce
Friday, 9 September 2011
14. Explain Yourself
assertEquals(16301, customer.getBalance());
ComparisonFailure: expected:<[16301]> but was:<[16103]>
assertEquals("balance", 16301, customer.getBalance());
ComparisonFailure: balance expected:<[16301]> but was:<[16103]>
www.growing-object-oriented-software.com 2011
Describe Yourself
ComparisonFailure: expected:<[a customer account id]>
but was:<[id not set]>
java.lang.AssertionError: payment date
Expected: <Thu Jan 01 01:00:01 GMT 1970>
got: <Thu Jan 01 01:00:02 GMT 1970>
Date startDate = namedDate(1000, "startDate");
Date endDate = namedDate(2000, "endDate");
Date namedDate(long timeValue, final String name) {
return new Date(timeValue) {
public String toString() { return name; }
};
}
java.lang.AssertionError: payment date
Expected: <startDate>
got: <endDate>
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
15. Tracer Objects
@RunWith(JMock.class) public class CustomerTest {
final LineItem item1 = context.mock(LineItem.class, "item1");
final LineItem item2 = context.mock(LineItem.class, "item2");
final Billing billing = context.mock(Billing.class);
@Test public void requestsInvoiceForPurchasedItems() {
context.checking(new Expectations() {{
oneOf(billing).add(item1);
oneOf(billing).add(item2);
}});
customer.purchase(item1, item2);
customer.requestInvoice(billing);
}
}
not all expectations were satisfied
expectations:
expected once, already invoked 1 time: billing.add(<item1>)
! expected once, never invoked: billing.add(<item2>>)
what happened before this:
billing.add(<item1>)
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
16. Test Flexibility
Living plants are flexible and tender;
the dead are brittle and dry.
[...]
The rigid and stiff will be broken.
The soft and yielding will overcome.
—Lao Tzu (c.604—531 B.C.)
Specify Precisely
What Should Happen
and No More
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
17. Interlude
Information,
Not Representation
public interface CustomerBase {
// Returns null if no customer found
Customer findCustomerWithEmailAddress(String emailAddress);
allowing(customerBase).findCustomerWithEmailAddress(theAddress);
will(returnValue(null));
public static final Customer NO_CUSTOMER_FOUND = null;
public interface CustomerBase {
Maybe<Customer> findCustomerWithEmailAddress(String emailAddress);
}
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
19. Allow Queries
Expect Commands
ignoring(auditTrail);
allowing(catalog).getPriceForItem(item); will(returnValue(74));
exactly(2).of(order).addItem(item, 74);
www.growing-object-oriented-software.com 2011
Only Enforce Order
When It Matters
@Test public void announcesMatchForOneAuction() {
final AuctionSearcher auctionSearch =
new AuctionSearcher(searchListener, asList(STUB_AUCTION1));
context.checking(new Expectations() {{
Sequence events = context.sequence("events");
oneOf(searchListener).searchMatched(STUB_AUCTION1); inSequence(events);
oneOf(searchListener).searchFinished(); inSequence(events);
}});
auctionSearch.searchFor(KEYWORDS);
}
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
20. “Guinea Pig” Objects
public class XmlMarshallerTest {
public static class MarshalledObject {
private String privateField = "private";
public transient String transientField = "transient";
public final String publicFinalField = "public final";
// constructors, accessors for private field, etc.
}
@Test public void marshallsAndUnmarshallsSerialisableFields() {
XMLMarshaller marshaller = new XmlMarshaller();
MarshalledObject original = new MarshalledObject();
String xml = marshaller.marshall(original);
MarshalledObject unmarshalled = marshaller.unmarshall(xml);
assertThat(unmarshalled,
hasSameSerialisableFieldsAs(original));
}
}
www.growing-object-oriented-software.com 2011
Tests Are Code Too
• Expressiveness over convenience
• Refactor and abstract
• Focus on what matters
• If it’s hard to test, that’s a clue
www.growing-object-oriented-software.com 2011
Friday, 9 September 2011
21. Other sources
www.growing-object-oriented-software.com 2011
And, of course…
Friday, 9 September 2011