Presentation from RTP AEM / CQ5 Meetup by Sagar Sane. This presentation provides some of the challenges and benefits of applying Test Driven Development principles to Adobe Experience Manager (AEM)/CQ5 based projects and overview of some of the tools and technologies, including Spock & Geb, which can be used for automating test cases & execution.
Creating automated functional tests of your web application with Selenium IDE is quick and easy, but leads to massive duplication in your test scripts. See why this duplication is a problem, and how to address it using a simple design pattern called the Page Object.
Page-Object pattern is very commonly used when implementing Automation frameworks. However, as the scale of the framework grows, there is a limitation on how much reusability really happens. It inherently becomes very difficult to separate the test intent from the business domain.
I talk about this problem, and the solution I have been using - Business Layer - Page-Object pattern, which has helped me keep my code DRY.
For more details (links to slides, etc.), see my blog: http://goo.gl/biRn4n
This presentation provides an overview of a Test Automation Framework with BDD and Cucumber. It also includes several open-source initiatives that Rhoynar Software Consulting (www.rhoynar.com) has been working on in the fields of QA Automation and DevOps. Lastly, it also includes links to some of the open-source projects that you can use right now for your work.
- Continuous Integration Infra a la OpenStack - https://github.com/Rhoynar/ci-infra
- An Email Verification Library in Java:
https://github.com/Rhoynar/EmailVerify
- Automatic Test Generation using Selenium WebDriver, Java and TestNG
https://github.com/Rhoynar/AutoTestR
- Barebones BDD and Cucumber Framework integrated with Java Maven and TestNG:
https://github.com/Rhoynar/qa-automation
Presentation from RTP AEM / CQ5 Meetup by Sagar Sane. This presentation provides some of the challenges and benefits of applying Test Driven Development principles to Adobe Experience Manager (AEM)/CQ5 based projects and overview of some of the tools and technologies, including Spock & Geb, which can be used for automating test cases & execution.
Creating automated functional tests of your web application with Selenium IDE is quick and easy, but leads to massive duplication in your test scripts. See why this duplication is a problem, and how to address it using a simple design pattern called the Page Object.
Page-Object pattern is very commonly used when implementing Automation frameworks. However, as the scale of the framework grows, there is a limitation on how much reusability really happens. It inherently becomes very difficult to separate the test intent from the business domain.
I talk about this problem, and the solution I have been using - Business Layer - Page-Object pattern, which has helped me keep my code DRY.
For more details (links to slides, etc.), see my blog: http://goo.gl/biRn4n
This presentation provides an overview of a Test Automation Framework with BDD and Cucumber. It also includes several open-source initiatives that Rhoynar Software Consulting (www.rhoynar.com) has been working on in the fields of QA Automation and DevOps. Lastly, it also includes links to some of the open-source projects that you can use right now for your work.
- Continuous Integration Infra a la OpenStack - https://github.com/Rhoynar/ci-infra
- An Email Verification Library in Java:
https://github.com/Rhoynar/EmailVerify
- Automatic Test Generation using Selenium WebDriver, Java and TestNG
https://github.com/Rhoynar/AutoTestR
- Barebones BDD and Cucumber Framework integrated with Java Maven and TestNG:
https://github.com/Rhoynar/qa-automation
BDD (Behavior-driven development), also known as ATDD (Acceptance test–driven development) is a software development process that helps Agile teams design, develop, test and deliver software efficiently, it's about how to implement agile acceptance testing and binding business requirements to code. BDD helps to bridge the communication gap between stakeholders and implementation teams, build quality into software from the start, design, develop and deliver systems fit for purpose. SpecFlow is the official tool to implement BDD on the .NET platform.
Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your Drupal site. These stories can then be auto-tested against your website, whether in the midst of development, or on a live site. And yes, it’s as cool as it sounds!
Behat, if embraced by enough Drupal folks, has the potential to vastly improve the way we build and test Drupal websites. Testing language can be developed by module maintainers, and allow nearly codefree testing to be developed by everyone, as needed, per site.
Behat IS NOT unit testing nor a specification testing tool. Behat is a Scenario-oriented BDD framework with functional testing capabilities as part of a communication process between stake-holders and developers. Think Agile User Stories meets Selenium.
Behat is currently used to test Drupal.org, allowing a variety of coders to work on a single site, and ensure that no existing functionality will break as they add new features. Or as it's migrated from one version to another. Imagine that on your site.
We will review Behat (and Mink, and related code), how to use it with Drupal, Drush, and the existing modules/code to support that. We will demo live testing, and so how easy it is to write tests, with and without code.
We believe people can and should experience last-minute traveling because all those spontaneous moments enrich our lives.
Therefore, we are building a world-class mobile product that makes last-minute hotel booking fast and rewarding.
Do you want to help us build this product? Then join us! RTFM @ GitHub
https://github.com/HotelQuickly/WeAreHiring/
More info about our Product & Engineering
http://product.hotelquickly.com
How many times have your Selenium test suites run beautifully on one browser, only to fail when run in any other browser? This is an extremely common problem faced when incorporating cross-browser tests into your test runs. Not all browser drivers are created equally, but that doesn’t mean you can’t create a robust suite of cross-browser tests.
This presentation shares strategies for making cross-browser tests invincible. It focuses on topics such as using as choosing the best locators for all browsers, explicit vs. implicit waits and how to leverage cloud-based testing tools.
This presentation was given at SeleniumConf London in November 2016.
This power point presentation provides details on syntax of Gherkin language and how it can be used to write accurate user acceptance criteria for user stories.
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016Oren Rubin
In this talk we will delve into one the biggest challenges that Test Automation developers face, finding elements i.e. a robust test means finding the same element with high fidelity while the Application Under Test keeps changing.
We will categorise the methods, and show where developer fail, where machines (Record/Playback) fail, and suggest a new way for locating elements, and analyze the skill-set required to overcome those difficulties.
Cucumber is a tool which supports development via behavior realization (BDD - Behavior-Driven Development). It is considered to be utilized for creating the tests which can be understood by each and all, even without special technical knowledge.
(by QATestLab)
This presentation introduces the audience to BDD - the Behavior-Driven Development method and how it can be applied to development and testing of GUI applications. We will also try to debunk myths and false hopes surrounding it.
BDD centers around stories written in an "ubiquitous language" that describe the expected behavior of an application. The use of a human-readable language allows for technical as well as non-technical project stakeholders to participate in authoring of feature descriptions. Those descriptions then serve as a base for the work of both developers and testers.
Classic agile and test-driven programming takes an inside-out approach by focussing on the specification and testing of the API of individual software components. BDD, on the other hand, looks at the application as a whole and puts interaction sequences and their expected outcomes into the foreground.
An introduction to the de-facto standard BDD language Gherkin will be given. It became popular as part of the Cucumber Ruby testing framework but has found its way into various free and commercial tools that will be listed.
A sample feature file including scenarios, outlines and backgrounds descriptions will be developed live using the Squish GUI Tester. This feature file can already be "run" in dry mode. We'll see different types of usage of this input:
* A mean to communicate with the customer.
* Documentation for the acceptance test before delivery
* A sequence to walk through for manual testing
* Automated GUI testing through tools like Squish.
BDD (Behavior-driven development), also known as ATDD (Acceptance test–driven development) is a software development process that helps Agile teams design, develop, test and deliver software efficiently, it's about how to implement agile acceptance testing and binding business requirements to code. BDD helps to bridge the communication gap between stakeholders and implementation teams, build quality into software from the start, design, develop and deliver systems fit for purpose. SpecFlow is the official tool to implement BDD on the .NET platform.
Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your Drupal site. These stories can then be auto-tested against your website, whether in the midst of development, or on a live site. And yes, it’s as cool as it sounds!
Behat, if embraced by enough Drupal folks, has the potential to vastly improve the way we build and test Drupal websites. Testing language can be developed by module maintainers, and allow nearly codefree testing to be developed by everyone, as needed, per site.
Behat IS NOT unit testing nor a specification testing tool. Behat is a Scenario-oriented BDD framework with functional testing capabilities as part of a communication process between stake-holders and developers. Think Agile User Stories meets Selenium.
Behat is currently used to test Drupal.org, allowing a variety of coders to work on a single site, and ensure that no existing functionality will break as they add new features. Or as it's migrated from one version to another. Imagine that on your site.
We will review Behat (and Mink, and related code), how to use it with Drupal, Drush, and the existing modules/code to support that. We will demo live testing, and so how easy it is to write tests, with and without code.
We believe people can and should experience last-minute traveling because all those spontaneous moments enrich our lives.
Therefore, we are building a world-class mobile product that makes last-minute hotel booking fast and rewarding.
Do you want to help us build this product? Then join us! RTFM @ GitHub
https://github.com/HotelQuickly/WeAreHiring/
More info about our Product & Engineering
http://product.hotelquickly.com
How many times have your Selenium test suites run beautifully on one browser, only to fail when run in any other browser? This is an extremely common problem faced when incorporating cross-browser tests into your test runs. Not all browser drivers are created equally, but that doesn’t mean you can’t create a robust suite of cross-browser tests.
This presentation shares strategies for making cross-browser tests invincible. It focuses on topics such as using as choosing the best locators for all browsers, explicit vs. implicit waits and how to leverage cloud-based testing tools.
This presentation was given at SeleniumConf London in November 2016.
This power point presentation provides details on syntax of Gherkin language and how it can be used to write accurate user acceptance criteria for user stories.
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016Oren Rubin
In this talk we will delve into one the biggest challenges that Test Automation developers face, finding elements i.e. a robust test means finding the same element with high fidelity while the Application Under Test keeps changing.
We will categorise the methods, and show where developer fail, where machines (Record/Playback) fail, and suggest a new way for locating elements, and analyze the skill-set required to overcome those difficulties.
Cucumber is a tool which supports development via behavior realization (BDD - Behavior-Driven Development). It is considered to be utilized for creating the tests which can be understood by each and all, even without special technical knowledge.
(by QATestLab)
This presentation introduces the audience to BDD - the Behavior-Driven Development method and how it can be applied to development and testing of GUI applications. We will also try to debunk myths and false hopes surrounding it.
BDD centers around stories written in an "ubiquitous language" that describe the expected behavior of an application. The use of a human-readable language allows for technical as well as non-technical project stakeholders to participate in authoring of feature descriptions. Those descriptions then serve as a base for the work of both developers and testers.
Classic agile and test-driven programming takes an inside-out approach by focussing on the specification and testing of the API of individual software components. BDD, on the other hand, looks at the application as a whole and puts interaction sequences and their expected outcomes into the foreground.
An introduction to the de-facto standard BDD language Gherkin will be given. It became popular as part of the Cucumber Ruby testing framework but has found its way into various free and commercial tools that will be listed.
A sample feature file including scenarios, outlines and backgrounds descriptions will be developed live using the Squish GUI Tester. This feature file can already be "run" in dry mode. We'll see different types of usage of this input:
* A mean to communicate with the customer.
* Documentation for the acceptance test before delivery
* A sequence to walk through for manual testing
* Automated GUI testing through tools like Squish.
One of the main hindrances to teams being able to respond rapidly to new features are technical problems resulting from bad coding practices, also known as technical debt. Melissa and Brett will cover Agile tools and practices that help development teams write better code and increase maintainability. Topics that will be covered include:
Pair programming
Automated Unit Testing
Refactoring
Test-Driven Development
Agile Architecture
TDD is now mainstream but a lot people don't know or don't remember what is its purpose. TDD is about software design not testing or catching bug. TDD helps developers to shape and create software with "good" design, what is a "good" design is something that we will discuss in the topic.
This session aims to shed some light to an emerging test automation framework Karate DSL. This framework resolves many of the test automation problems by having API test-automation along with performance-testing and UI Web Automation testing into a single, unified framework.
Test and Behaviour Driven Development (TDD/BDD)Lars Thorup
In this introduction to Test Driven Development (TDD) or Behaviour Driven Development (BDD) we give a high level description of what it is and why it is useful for developers. Then we go into some details on stubs and mocks, test data, UI testing, SQL testing, JavaScript testing, web services testing and how to start doing TDD/BDD on an existing code base.
Slides for my talk at General Assembly's Web Dev bootcamp. Covers the motivations behind software testing, some theoretical background and hands-on exercises. Final challenge is testing a real-world like Node.js API using Mocha & Chai.
Although all of us speak the same language, each of us uses different meaning of words "soon”, "fine” and "done”. That’s why for one developer "I’m done” means that just a moment ago the part of the code with implemented functionality has been successfully executed, while for another developer it means that code has been committed to repository but without checking if build is green or not on continuous integration server. At the same time "done" of developer-perfectionist means totally refactored and optimized code. And only for "black swan”-developer phrase "I'm done“ means that all tests were passed, new functionality was documented on wiki and a new feature was verified by customer on the demo server.
So if you want to decrease a risk of misunderstanding inside a team or between team and customer you should make agreement about common vision of “definition of done“ and then start using it on a daily basis. In order to prevent losing your time and stepping on the hidden rake during discussion of your done criteria we will share our knowledge about creating compact and most effective “definition of done“. We will talk about lifecycle of this document and about approaches that help you to add important items to it. We will discuss doneness on different levels (preplanning, user story and task development, sprint). And of course we won’t forget to tell you how to create “Definition of Done“ which will satisfy not only your team but your customer as well.
Similar to Test Driven Development in CQ5/AEM (20)
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
2. What’s on the plate?
● What is Test driven development (TDD)?
● Why TDD / BDD?
● CQ backend and Spock testing framework
● Live code
3. Not on the plate
● Advanced testing techniques
o Features of Spock Framework
● Much about testing your UI / JS
4. ● Software Consultant II / Tech lead
● WEM Consultant
o Backend development
o Comfortable with Java (/JSP) and Groovy
● I don’t dislike front-end development :-)
About me
5. I became a programmer because of the
‘science’ in programming,
but, I remained a programmer because of the
‘art’ in programming.
I believe..
8. Test Driven Development
● Write Test First (extreme programming)
o Technical meaning
o Design your code around the tests
● Write a lot of tests
o Milder approach
10. Benefits of Testing
● Find bugs early
● Make it easy for a new person on your
project
o Read the tests if you don’t understand the code
● Improve code quality
11. Benefits of Testing
● Helps during code re-factoring
● A good test is worth a thousand comments
● Executable documentation
12. BDD
● Behavior Driven Development
● Writing tests from the customer’s /
stakeholder’s point of view
● It really is TDD done well!
● More expressive than TDD
13. //Variables
expected, v1, v2, ..
//Execute feature
actual = System.executeFeature(v1, v2, ..)
//The system gives output as expected
assert actual == expected
14.
15. CQ/AEM and Spock
● What is Spock Framework? [ link ]
● Why is it awesome? [ link ] [ link ]
o Is beautiful
● It can be used to test your CQ/AEM
backend!
16. A basic Spock Feature
//Spock ‘feature’
def "My component should just work"() {
given:
final variables = [ //initial conditions ]
final expected = new MyComponent(...)
when:
final actual = MyComponent.create(variables)
then:
actual == expected
}
17. Time for some real code...
What ‘new’ will we see?
● Mocks in spock
● setupSpec(), cleanupSpec()
● @Ignore(), @Shared
18. What all can you do?
● Unit tests for servlets, services
● Integration tests
● Functional tests for your rest APIs
● Even UI tests! (with Geb)
Hello everyone…
Thanks for joining, today we will be talking about Test Driven Development.
- Testing during development.
We will discuss about Test Driven Development , Behavior Driven Development. What it is, what are the benefits? Then, try apply our understanding of TDD / BDD to testing our backend code in CQ using Spock Framework ) .. and also look at some code!
.. We will NOT be going into advanced details .. my goal is to get people excited about testing. Hopefully, the testing framework I will be talking about (Spock) will help. We will also be looking at some live code later, going through some basics examples of Spock testing
We will not talk about these
I am this.. that..
PAUSE...
So, here is a statement I read somewhere recently
I am really starting to believe in the above saying.
-- I want to be able to say this for myself in say 10 years for now.
But, What does this mean? art? what is the ‘art’ of programming?
-- We will try to answer these questions by the time we end the talk today
… having said that.. lets get started!
Some people have very strong views about testing. They just have to have tests no matter what!
No, they really may be intimidating.
But, what I want to do here is to NOT try and enforce my opinion, but lay down MY thoughts about testing, what it means to me, how it can help, etc.
I believe in a bit milder approach
So, what is test driven development?
* Different if you ask different people, can mean a lot of things!
- Write tests first … have them fail and then implement features to pass them
- Write a lot of tests … ‘test oriented development’ .. this is what I like
- Umm people might not always be on-board to this thought
- It is all about testing a small ‘unit’ functionality of code.
- In terms of CQ, it can be anything ..
** from testing the ‘activate()’ method of your service ..
** to testing if your servlet responds to a ‘doPost()’ call to ..
** testing if your factory method on a component WORKS
- We will be looking at each of these pieces live in action when we get to the ‘looking at the code’ section.
….. QUESTIONS ??
Why is it useful?
- Helps to find bugs early. If you have important piece of code and you have tests backing it, over time, its going to be invariably easier to find bugs early during development.
- HUGE CODEbase.. new person.. enterprise application codebase. Read tests if you don’t understand the code
- And also, if you want to write good tests, you eventually try to make your code sound . Meaning, you use the correct programming patterns. So.. you also get the opportunity to receive kudos! :)
Another one is .. re-factoring.
Say eg: YOu have a code which has not been touched for a LONG time. You know.. its like a dark room in your grandma’s house. If you have tests for that implementation, then you are in relatively good shape. Even if I mess things up in my refactoring, you know that that tests can save you.
Lastly, a good test is worth a thousand words! This is true .. and you will see it in action soon.
Dan North - Coined the name BDD
- Is about Implementing application by describing an application from the perspective of the stakeholders
- A new feature requested by the stakeholders is not delivered until it has tests (Code Coverage)
- More expressive, readable for humans, than just for computers to execute
- Tests whose names are real sentences
Lets take an example of a simple ‘pseudotest’ .. or a ‘usecase’ for a test.
We want to assert that a feature in a system works as expected!
If we want to take the TDD or BDD approach
* Very natural to read
* easy to understand what its doing .. etc.
So.. enter Spock framework!
- Enterprise ready testing framework for testing Java and Grooy application
- What makes it stand out from the crowd is its highly expressive specification language.
- Next generation testing framework!
- Spock lets you write specifications that describe expected features (properties, aspects) exhibited by a system of interest.
- Why is it awesome?
-- Its beautiful.. expressive, based on rspec, junit, etc.
-- Easy to learn, powered by Groovy, which is basically java on steroids!
-- Several Spock Extensions for like Spring Framework, etc. and it also provides apis to write custom extensions
...QUESTIONS ??
So lets take a simple example of how testing in Spock can look like.
Now.. lets take an example of how you can write a simple spock unit test (spec) to test the backend of your component JSP.
Every test in Spock is really a ‘feature’, as we saw with regards to BDD, we want to test a feature or a behavior of the system in question.
Mocks - A mock is an object of a certain type but without any behavior. Instead, the expected behavior is specified by the developer writing the specification.
setupSpec, cleanupSpec - Runs before 1st feature method, runs after the last feature method
ignore - Skipping tests, shared - shared between feature methods / tests
…… QUESTIONS??
--- All done using spock.. can be extremely readable and can help understand your system’s usecases better.
--- Integration tests for example.. when done in Spock..
It is not just enough to have a lot of tests. I think what will provide real value of the tests, is continuous delivery and integration. So using tools like Jenkins CI, you can basically use these tests as means to catch errors before they go to production, or to user testing.
SUMMARIZING
So answering the question that we asked at the start. The art of programming really lies in being a good programmer that can write code that humans can understand. I believe that having the mindset of writing tests, is going to help you achieve that purpose.