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.
Rxjs provides a paradigm for dealing with asynchronous operations in a way that resembles synchronous code. It uses Observables to represent asynchronous data streams over time that can be composed using operators. This allows handling of events, asynchronous code, and other reactive sources in a declarative way. Key points are:
- Observables represent asynchronous data streams that can be subscribed to.
- Operators allow manipulating and transforming streams through methods like map, filter, switchMap.
- Schedulers allow controlling virtual time for testing asynchronous behavior.
- Promises represent single values while Observables represent continuous streams, making Observables more powerful for reactive programming.
- Cascading asynchronous calls can be modeled elegantly using switch
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
Vaadin is an open source web framework for building web applications and websites. It began in 2001 and has gone through several major versions including versions 3, 4, 5, 6, and the current version 7. Version 7 features a renewed JavaScript architecture, Sass support, redesigned forms, and built-in view management. The Vaadin framework is used by over 50,000 companies worldwide and has a large community on GitHub.
The document discusses various techniques for testing game code, including:
1. Unit testing frameworks like Google Test and mocking objects to isolate dependencies.
2. Database testing using seed data and frameworks like xDBUnit.
3. Resource validation to check for logical errors in game assets.
4. Various approaches for runtime validation, debugging crashes, and analyzing crash dumps. Testing covers areas like databases, AI, and preventing crashes via assertions.
The Ring programming language version 1.5.2 book - Part 67 of 181Mahmoud Samir Fayed
This document describes how to create reports using the Ring WebLib and GUILib. It provides an example that loads the necessary libraries, creates a Qt application, and defines a report controller class. The class initializes a report view and calls a CreateReport method. This method generates an HTML report using the HtmlPage class, adding headers, tables, and sample customer data. It styles the tables and loops to add multiple rows of sample data. This allows quickly generating reports by combining Ring's Web and GUI libraries.
The Ring programming language version 1.8 book - Part 105 of 202Mahmoud Samir Fayed
This document provides documentation on Qt classes related to networking, OpenGL, and other topics. It includes summaries of classes like QNetworkAccessManager for network requests, QOpenGLContext for OpenGL context handling, and QObject as the base class. For each class it lists the class parameters, parent class, and key methods.
This document provides an overview of advanced Hibernate concepts including:
- The persistence lifecycle of objects in Hibernate and the four states objects can be in: transient, persistent, detached, and removed.
- The persistence context and how it acts as a cache and guarantees object identity within a session scope.
- Transaction management in Hibernate including demarcating transaction boundaries programmatically or declaratively.
- Additional topics covered include the persistence manager, concurrency control, caching, and batch processing.
This document provides an introduction to RxJS, a library for reactive programming using Observables. It discusses some of the key concepts in RxJS including Observables, operators, and recipes. Observables can be created from events, promises, arrays and other sources. Operators allow chaining transformations on Observables like map, filter, switchMap. RxJS is useful for complex asynchronous flows and is easier to test than promises using marble testing. Overall, RxJS enables rich composition of asynchronous code and cancellation of Observables.
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.
This document provides an overview of modern Android development techniques including application architecture patterns like MVC, MVP and MVVM. It discusses topics like dependency injection with Dagger 2, reactive programming with RxJava, HTTP libraries like Retrofit and OkHttp, annotations, testing, using Kotlin and the future of Android development targeting the next billion users across more devices.
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneDroidConTLV
Yonatan V. Levin is a Google Developer Expert and CTO & Co-Founder of Parahall, which has over 100 cities and 30M users. The document discusses techniques for securing Android applications, including code protection through obfuscation, encryption, and reflection; hiding network models using Protocol Buffers; and challenging code stripping through signature checks, custom class loading, and Google Play licensing. Combination techniques are proposed like generating signatures based on the app build properties, dynamic challenges, and API request signing.
This document provides an introduction to Vaadin, including:
1. Vaadin allows building rich web UIs using Java and HTML. It uses a client-server architecture with the UI running on the server and JavaScript/HTML on the client.
2. Key features include rich UI components, support for any JVM language, no browser plugins required, and embracing of Java standards.
3. The document recommends getting started with Vaadin by generating a Maven archetype project in Eclipse.
The document discusses React, Redux, and ES6/7 features. It begins with an overview of React lifecycles and class components. It then provides a brief introduction to Redux, including core concepts like actions, reducers, and unidirectional data flow. The document also includes an example to demonstrate how React and Redux can work together, with Redux managing application state in the store and React components interacting via container components.
Vaadin 7 is a Java framework for building rich web applications. It allows developers to write UI code in Java and have it rendered as responsive HTML, CSS, and JavaScript that runs in any browser. Key features include rich UI components, separation of server and client code, and support for any JVM language and cloud platform. The framework embraces modern web standards and allows developers to build consumer-grade UX with a business system budget.
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
This document provides an overview of React and Redux concepts including:
- React basics like components, props, state, and lifecycle methods
- Flux architecture and how data flows through actions, dispatcher, and stores
- Redux as an alternative to Flux that uses a single store updated by reducers in response to actions
- Additional React topics like JSX, propTypes, and using React with ES6 classes are also covered.
This document provides an overview of RxAndroid and RxJava. It discusses key concepts like Observables that emit items, Subscribers that receive emitted items and complete/error notifications, and Operators like map that transform Observables. It shows how to create a simple Observable, subscribe to it, and use operators like map. It also demonstrates integrating Rx with Android by observing button clicks and updating UI, merging multiple Observables, and using scan to increment a counter and calculate a running sum from emitted values.
The Ring programming language version 1.5.4 book - Part 70 of 185Mahmoud Samir Fayed
This document discusses using the WebLib and GUILib in Ring to create reports. It provides an example that loads necessary libraries, creates an HTML report using the HtmlPage class, saves it to a file, then loads it into a WebView widget. A print button calls a method to print the report to a PDF file using the web view's print method.
Rachel Davies gave a presentation on surfing the agile wave. She introduced herself and asked attendees about their experience with agile. Her presentation covered why companies are attracted to agile, how to get started with pilot projects, common mistakes like rushing in or only implementing certain parts of agile, and how agile affects many areas of a company. She discussed agile values from the manifesto and principles like prioritizing customer satisfaction and frequent delivery. The presentation concluded with suggestions on what support is needed for successful agile adoption, like improving build pipelines, empowering teams, and being patient as change takes time.
The document discusses smart metrics for agile projects. It recommends choosing leading metrics like features accepted, sponsor confidence, and user satisfaction that are simple, self-generating, relevant to goals, and future-focused. Lagging metrics like lines of code are not as useful. Metrics should influence positive behaviors by leveraging the Hawthorne Effect. Feature tracking and cycle times are presented as examples of smart metrics that provide visibility into progress and bottlenecks.
This document discusses Research Instruments' adoption of Agile practices for their software development process. It provides background on the company and describes their previous waterfall process. It then outlines the steps they took in adopting Agile, including workshops, Kanban boards, sprints, test-driven development, and pair programming. Benefits included improved team motivation, easier management, and higher quality. Adoption of Agile practices also led to changes in other departments and a better understanding with management and customers.
This document discusses an organization's adoption of agile practices and the benefits. It first asks why the organization adopted agile and what they now do differently with their processes. It then questions how customers may benefit from these changes, such as through more open communication, delivering in small steps, and incorporating feedback. The document emphasizes delivering value over ideas to customers.
1. The document discusses how software developers often prefer technical "tools" like abstraction, logic, and decomposition over dealing with "people problems".
2. It argues that this reductionist approach can be damaging when applied to agile methodologies, as agile was originally successful because it emphasized a holistic and people-friendly process.
3. The key point is that software development depends on people, so agile needs to continue prioritizing human elements like simplification, intuition, and collective work over technical abstraction and decomposition in order to be effective.
The document argues that focusing on quality and sustainability over speed leads to better software development outcomes. It notes that taking time early to reduce defects and improve maintainability saves significant costs down the road. Overall, the document advocates for an incremental approach to development that prioritizes learning from each iteration rather than trying to deliver code at an unsustainable pace.
The document discusses recommendations from a taskforce on improving government IT projects, which often experience large failures and costs. It recommends adopting an agile approach to projects through modular development, user focus, and iterative testing. The government ICT strategy has partially adopted the recommendations, including establishing agile pilot projects and centers of excellence to help implement more efficient and responsive digital services.
The document discusses tools to improve a LAMP web development stack. It recommends source control, development platforms, task tracking, automated testing, static analysis, automated deployment, and continuous integration. These tools enable collaboration, testing, deployment automation, and integration of code changes. Specific open source tools are recommended for each category like Git, PHPUnit, PHP Code Sniffer, and Jenkins. The document argues these tools improve workflow, quality, and speed of development.
This document discusses lean software development principles. It emphasizes eliminating waste and non-value adding activities from development processes. It defines value and waste from a customer perspective. It also discusses mapping the end-to-end value stream to identify improvement opportunities like reducing cycle times and increasing efficiency. A case study example shows how responding to critical defects can be improved through applying lean principles.
The document discusses test-driven development (TDD) and some of its challenges. It describes how TDD is often overspecified, with tests that are brittle and can lead to meaningless failures. The document advocates for tests that focus on explaining the domain rather than proving code correctness, and notes TDD works best when taking an incremental, empirical approach from simple to general.
The document discusses clean coding practices for Java developers. It covers topics such as choosing meaningful names for variables, methods, and classes; writing code that is easy for others to understand; breaking methods down into single logical steps; and using fluent APIs to make code more readable. The presentation provides examples of clean code and ways to refactor code to follow best practices.
The document discusses using annotations in Java, providing examples of annotations for servlets, EJBs, web services, CDI, and using frameworks like JUnit, Spring, Javassist, and ASM. It presents code samples to define servlets, session beans, RESTful and SOAP web services, and component injection using annotations instead of XML configurations. The document also demonstrates how to programmatically read annotation values and metadata using reflection, Javassist, and ASM.
PowerMock is an open source Java framework that allows mocking of static methods, final classes, and private methods. It extends EasyMock and JUnit to enable these additional types of mocking. The document provides details on how to add PowerMock dependencies to Maven and Ant projects, examples of unit testing with and without mocks, and techniques like capturing arguments and emulating code in mock objects. It also discusses skipping static initialization and the F.I.R.S.T. properties that unit tests should have.
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
1. The document discusses good and bad practices for writing unit tests. It emphasizes that tests should verify the expected behavior, fail clearly when something goes wrong, and use mocks and isolation to focus on the code being tested.
2. Some examples of bad tests shown include tests that don't make assertions or assertions that don't provide useful information on failure. Real objects are also used instead of mocks, obscuring the test.
3. Good practices include using mocks to isolate the code being tested, making sure tests fail clearly when something goes wrong, and focusing tests on expected behavior through clear assertions. Automated testing, fixing broken tests, and mastering testing tools are also emphasized.
The document provides an overview of Spring MVC, comparing it to Struts, and detailing controllers, form handling, validation, configuration, and view technologies. Spring MVC controllers return ModelAndView objects and support dependency injection, making them easier to test than Struts actions. Both frameworks allow mapping requests to methods and configuring views, but Spring uses POJOs while Struts requires backing forms.
The document provides templates and examples for creating Swing-based GUI applications, servlets, Java Server Pages (JSP), Java Database Connectivity (JDBC), Java Server Faces (JSF), Enterprise Java Beans (EJB), Hibernate, Struts, and web services in Java. It includes templates for common GUI components, servlets, JSP tags, database queries, managed beans, navigation rules, entity beans, Hibernate mappings, actions, and web service providers/consumers.
Unit Test Candidate Solutions discusses various techniques for unit testing including:
- Using mock environments to isolate tests and focus on single responsibilities
- Preparing test data, files, and mock objects to provide context for developers
- Verifying XML output using techniques like XPath, XMLUnit, and REXML
- Mocking domain logic using libraries like EasyMock, jMock, and Mockito
- Employing BDD specifications styles for more readable test code
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.
Vaadin 7 is an introduction to the Vaadin framework. Key ideas of Vaadin 7 include rich components, a server+client architecture that runs entirely on the Java server, and embracing the Java programming language. New features in Vaadin 7 include a renewed JavaScript architecture, Sass support, redesigned forms, and built-in high level view management. The roadmap for Vaadin 7.1 includes server push using Atmosphere, a new calendar component, and limited IE 10 support.
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
This document summarizes a presentation about developing a MVP application using GWT, Spring Roo, and deploying it to CloudFoundry. The presentation covers MVP pattern in GWT, using activities and places for navigation, using Spring Roo for rapid development, and deploying the application to CloudFoundry. It provides code examples for implementing MVP using views, presenters, activities and places. It also outlines the steps to deploy an application to CloudFoundry including installing the vmc CLI and pushing the application.
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.
Vaadin 7 is an open source web application framework that allows developers to build rich client-side web applications using Java on the server-side and JavaScript on the client-side, with new features in Vaadin 7 including improved component architecture, support for SASS styling, and enhanced widget communication through state-based RPC.
Rhino Mocks is a .NET mocking framework that allows developers to easily create and setup mock objects to test interactions using unit tests. It generates both mocks, which allow expectations to be set and verified, and stubs, which simply return preset values without verification. The document provides examples of using Rhino Mocks to generate mocks and stubs of interfaces, set expectations on mocks, and verify mock interactions using the AAA (Arrange, Act, Assert) syntax. It also distinguishes between mocks and stubs.
The document discusses Google App Engine task queues and cron jobs. It provides examples of creating and using default and named push queues, as well as pull queues. It explains how to add tasks, lease tasks from pull queues, and delete tasks. It also covers using task queues within transactions. Additionally, it demonstrates configuring and using cron jobs to schedule recurring tasks.
Here are some suggestions to improve the test method name:
- shouldReturnNullWhenQueryReturnsNull
- shouldPassNullFromDaoWhenQueryReturnsNull
Using "should" makes the intent clearer - we expect the method to return null under certain conditions. Describing those conditions ("when query returns null") in the name provides more context than a generic "testQuery".
Overall, test method names should clearly communicate what is being tested and under what conditions we expect the test to pass or fail. This helps readers understand the purpose and focus of each test.
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)
This document discusses Research Instruments' adoption of Agile practices for their software development process. It provides background on the company and describes their previous waterfall process. It then outlines the steps they took in adopting Agile, including workshops, Kanban boards, sprints, test-driven development, and pair programming. Benefits included improved team motivation, easier management, and higher quality. Adoption of Agile practices also led to changes in other departments and a better understanding with management and customers.
The document discusses what it takes to be an agile software company. It defines agility as a company's ability to quickly identify and seize opportunities more effectively than rivals. Being agile means being able to quickly adapt to or anticipate and lead change. The document discusses how agility affects strategic thinking, operations, technology innovation and the ability to innovate in products, processes and business models. It also notes that while some companies exhibit agile characteristics, agility is unevenly distributed and it is important for companies to repeatedly demonstrate agility over time.
The document describes using lean principles to build the Millennium Falcon from Lego pieces in an agile manner. A team identified bottlenecks in finding pieces and assembling them, then divided work and established queues to flow pieces through the process more efficiently. Specialists emerged who optimized piece finding and assembly. Control charts tracked variability over time, which the team worked to reduce. Defect tracking and work in progress limits were also utilized to improve the process of constructing the starship model.
The document discusses creating agile organizations. It defines an agile organization as one that can sense opportunities and threats, prioritize responses efficiently, and act effectively. The author advocates measuring an organization's agility in these three areas - ability to sense, prioritize, and act. Transforming an organization to be agile involves analyzing where it is lacking in these areas and designing improvements based on agile principles like Scrum.
The document provides guidance on building quality into software development through defect prevention rather than defect removal. It discusses how the best companies aim to freeze code and test within 10% of the release cycle, rather than leaving 30-50% for "hardening". An effective process matches tests to specifications and code, rather than introducing defects first. It also advocates optimizing throughput over utilization by limiting work, leveling the workload, and shortening deployment cycles.
The document discusses techniques for crafting user stories that are effective for embedded software projects, noting that context is important, stories evolve over time, and it can be useful to identify the customer, what they want, why they want it, and to find the conditions of satisfaction. It also recommends considering building block stories for different technical layers and identifying the "do-er" or performer of the work in the story.
The document discusses various programming tools and concepts. It provides lists of popular programming languages like Java and PHP, frameworks like Spring and Rails, and version control systems like Git and Mercurial. It also discusses code examples in Java, Ruby, and Python and ways to refactor code to make it more readable and maintainable.
The document discusses the Lean Startup methodology. It defines a startup as an experiment designed to deliver a new product or service under conditions of uncertainty. The Lean Startup process advocates for iterating quickly through building minimum viable products and testing hypotheses through customer feedback before resources run out. Key aspects of Lean Startup include establishing a baseline with an MVP, tuning the product through experiments, and deciding when to pivot or persevere. Actionable metrics like the AARRR framework and cohort analysis are important for measuring progress. Pivots are changes to test new fundamental hypotheses when experiments reach diminishing returns.
Behaviour Driven Development - Beyond given when thenAgileOnTheBeach
Behaviour Driven Development (BDD) builds upon Test Driven Development (TDD) by formalizing good habits like slicing tests vertically around user stories rather than horizontally across layers. This allows for earlier feedback. BDD expresses tests and examples using patterns like "Given, When, Then" to define the context, action, and expected outcome. It also encourages describing user interactions to enable testing through different interfaces.
The document discusses Agile practices in software development. It mentions people, rituals, collaboration, implementing solutions in small steps with a walking skeleton approach, continuous integration, deploying to testing and production environments, and developers focusing on delivering working software frequently in short iterations.
This document summarizes an Agile coaching program in Cornwall, England. The program was started in 2010 by Michael Barritt and Oxford Innovation to (1) bring international software practices to local businesses, (2) improve business efficiency and profitability, and (3) support the local knowledge economy. The program provides workshops, in-house coaching, and training to help 9+ local companies employing over 150 people adopt Agile practices. It is funded through a combination of client fees, the European Social Fund, and European Regional Development Fund. The program aims to create better paid, more skilled jobs in the region.
The document discusses problems with typical development approaches and how agile methodologies address these issues through feedback loops. Typical development relies on upfront planning that becomes outdated and does not integrate customer feedback well. Agile uses short iterations, user stories to track business value, and continuous feedback to allow plans to change quickly in response to new information. This helps ensure development stays aligned with customer needs and allows for incremental delivery of value.
The document discusses the art and craft of programming. It references several sources that view programming as both an engineering discipline and an artistic endeavor that requires skill, experience, and care. Several passages note that good programmers take pride in their work and appreciate elegant, well-designed code.
The document discusses how software development approaches like Agile, which were originally people-focused, are becoming more reductionist and process-oriented over time as the community develops more tools and techniques. This risks losing sight of what made Agile successful in the first place - keeping people and collaboration at the center. To progress, Agile needs to remember its people-first roots and focus more on topics like understanding individuals, communication, and team dynamics rather than an over-emphasis on processes and tools.
Global Collaboration for Space Exploration.pdfSachin Chitre
Distinguished readers, leaders, esteemed colleagues, and fellow dreamers,
We stand at the precipice of a new era, an epoch where the boundaries of human potential are poised to be redefined. For centuries, humanity has gazed up at the celestial expanse, yearning to explore the cosmic mysteries that beckon us.
Today, I present a vision, a blueprint for a journey that transcends the limitations of conventional science and technology.
Imagine a world where the shackles of gravity are broken, where interstellar travel is no longer confined to the realms of science fiction. A world united not by petty differences, but by a shared purpose – to explore, to discover, and to elevate humanity.
This presentation outlines a comprehensive research project to construct and deploy Vimanas – ancient, aerial vehicles of wisdom and power. By harnessing the knowledge of our ancestors and the advancements of modern science, we can embark on a quest to not only conquer the skies but to conquer the cosmos.
Let us together ignite the spark of human ingenuity and propel our civilization towards a future where the stars are within our reach and where the bonds of humanity are strengthened through shared exploration.
The time for action is now. Let us embark on this extraordinary journey together."
Jacquard Fabric Explained: Origins, Characteristics, and Usesldtexsolbl
In this presentation, we’ll dive into the fascinating world of Jacquard fabric. We start by exploring what makes Jacquard fabric so special. It’s known for its beautiful, complex patterns that are woven into the fabric thanks to a clever machine called the Jacquard loom, invented by Joseph Marie Jacquard back in 1804. This loom uses either punched cards or modern digital controls to handle each thread separately, allowing for intricate designs that were once impossible to create by hand.
Next, we’ll look at the unique characteristics of Jacquard fabric and the different types you might encounter. From the luxurious brocade, often used in fancy clothing and home décor, to the elegant damask with its reversible patterns, and the artistic tapestry, each type of Jacquard fabric has its own special qualities. We’ll show you how these fabrics are used in everyday items like curtains, cushions, and even artworks, making them both functional and stylish.
Moving on, we’ll discuss how technology has changed Jacquard fabric production. Here, LD Texsol takes center stage. As a leading manufacturer and exporter of electronic Jacquard looms, LD Texsol is helping to modernize the weaving process. Their advanced technology makes it easier to create even more precise and complex patterns, and also helps make the production process more efficient and environmentally friendly.
Finally, we’ll wrap up by summarizing the key points and highlighting the exciting future of Jacquard fabric. Thanks to innovations from companies like LD Texsol, Jacquard fabric continues to evolve and impress, blending traditional techniques with cutting-edge technology. We hope this presentation gives you a clear picture of how Jacquard fabric has developed and where it’s headed in the future.
Network Auto Configuration and Correction using Python.pptxsaikumaresh2
- Implemented Zero Touch Provisioning, Network Topology Mapper, and Root Cause Analysis using Python, GNS3, Netmiko, SSH, OSPF, and Graphviz.
- Developed a Python script to automate network discovery based on Core Router IP and login details, significantly reducing manual intervention.
- Enhanced network visualization by generating detailed network graphs, aiding in quick network analysis and troubleshooting.
Leading Bigcommerce Development Services for Online RetailersSynapseIndia
As a leading provider of Bigcommerce development services, we specialize in creating powerful, user-friendly e-commerce solutions. Our services help online retailers increase sales and improve customer satisfaction.
Multimodal Embeddings (continued) - South Bay Meetup SlidesZilliz
Frank Liu will walk through the history of embeddings and how we got to the cool embedding models used today. He'll end with a demo on how multimodal RAG is used.
Understanding the NFT marketplace ecosystem involves exploring platforms for creating, buying, selling, and trading digital assets. These platforms use blockchain technology for security and smart contracts for automated transactions. Key components include digital wallets, NFT standards, and marketplaces like OpenSea and Rarible. This ecosystem is shaped by the roles of creators, collectors, and developers, offering insights into the dynamics and trends of the digital asset economy.
How CXAI Toolkit uses RAG for Intelligent Q&AZilliz
Manasi will be talking about RAG and how CXAI Toolkit uses RAG for Intelligent Q&A. She will go over what sets CXAI Toolkit's Intelligent Q&A apart from other Q&A systems, and how our trusted AI layer keeps customer data safe. She will also share some current challenges being faced by the team.
Discover practical tips and tricks for streamlining your Marketo programs from end to end. Whether you're new to Marketo or looking to enhance your existing processes, our expert speakers will provide insights and strategies you can implement right away.
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