The document provides an overview of testing Java code using test-driven development (TDD). It discusses the basics of TDD, including writing tests before code, running tests frequently during development, and using tests to drive code design. It also covers best practices for unit testing like testing individual units of code in isolation using mock objects, verifying method calls and arguments, and testing exceptional behavior. The document emphasizes writing testable code, using testing frameworks to their full capabilities, and having thorough test coverage of all requirements and use cases.
C++ Testing Techniques Tips and Tricks - C++ LondonClare Macrae
Links from the talk are available at:
https://github.com/claremacrae/talks/blob/master/Cpp_Testing_Techniques_Tips_and_Tricks.md#top
Presented at C++ London Meetup, on Thursday, November 21, 2019.
Abstract:
An assortment of practical techniques to make it easier to write effective automated tests of C++ code, both old and new.
I share some approaches for easier handling of commonly troublesome testing scenarios. This is a brand new talk, that is independent of test frameworks, and even covers a little for those creating Qt desktop applications.
Principles and patterns for test driven developmentStephen Fuqua
Developed to help introduce key topics in Test Driven Development, for new and veteran developers alike. Some examples are language-specific (C# / MSTest / Moq), but the principles apply to any object oriented language.
Refactoring Legacy Web Forms for Test AutomationStephen Fuqua
THE CHALLENGE:
Given you understand the value of test automation.
Given you are handed a legacy application to maintain and enhance
Given the application is in ASP.Net Web Forms
When you try to add tests
Then you find that test-driven development is literally impossible.
Spring has long become more than just a framework for application writing. Now there is a whole ecosystem of frameworks under Spring umbrella. This presentation is dedicated to automated testing of applications written in Spring, and more.
The respective talk was held by Kostyantyn Baranov (Senior Software Engineer, Consultant, GlobalLogic) at GlobalLogic Mykolaiv Java TechTalk #1 on July 26, 2018.
Database development unit test with tSQLtSergio Govoni
When we talk about unit test, we are actually talking about a software testing level that aims to test a discrete piece of code. The word “unit” refers to the smallest piece of code that can be tested separately. In a database solution, the unit is typically a stored procedure, a trigger or a user-defined function. When you start to think about unit test, it is very important to define the System Under Test (SUT) first and isolate it! Unit testing frameworks, stubs, mock and fake objects are used to assist in unit testing. In this session we will explore the techniques and tSQLt framework to start unit testing in your database development.
Demo scripts are available here: https://github.com/segovoni/sql-server-demos/tree/master/datasaturday/2021/datasat0001/database-development-unit-test-with-tSQLt
Transformation Priority Premise: TDD Test Order MattersMike Clement
When coding using TDD, do you often run into a point when you have to “implement the whole thing”? The sequence of tests that we write significantly impacts where are code ends up! We’ll explore Uncle Bob’s Transformation Priority Premise, looking at the transformations that code goes through and how our tests can drive the code in different directions.
C++ Testing Techniques Tips and Tricks - C++ LondonClare Macrae
Links from the talk are available at:
https://github.com/claremacrae/talks/blob/master/Cpp_Testing_Techniques_Tips_and_Tricks.md#top
Presented at C++ London Meetup, on Thursday, November 21, 2019.
Abstract:
An assortment of practical techniques to make it easier to write effective automated tests of C++ code, both old and new.
I share some approaches for easier handling of commonly troublesome testing scenarios. This is a brand new talk, that is independent of test frameworks, and even covers a little for those creating Qt desktop applications.
Principles and patterns for test driven developmentStephen Fuqua
Developed to help introduce key topics in Test Driven Development, for new and veteran developers alike. Some examples are language-specific (C# / MSTest / Moq), but the principles apply to any object oriented language.
Refactoring Legacy Web Forms for Test AutomationStephen Fuqua
THE CHALLENGE:
Given you understand the value of test automation.
Given you are handed a legacy application to maintain and enhance
Given the application is in ASP.Net Web Forms
When you try to add tests
Then you find that test-driven development is literally impossible.
Spring has long become more than just a framework for application writing. Now there is a whole ecosystem of frameworks under Spring umbrella. This presentation is dedicated to automated testing of applications written in Spring, and more.
The respective talk was held by Kostyantyn Baranov (Senior Software Engineer, Consultant, GlobalLogic) at GlobalLogic Mykolaiv Java TechTalk #1 on July 26, 2018.
Database development unit test with tSQLtSergio Govoni
When we talk about unit test, we are actually talking about a software testing level that aims to test a discrete piece of code. The word “unit” refers to the smallest piece of code that can be tested separately. In a database solution, the unit is typically a stored procedure, a trigger or a user-defined function. When you start to think about unit test, it is very important to define the System Under Test (SUT) first and isolate it! Unit testing frameworks, stubs, mock and fake objects are used to assist in unit testing. In this session we will explore the techniques and tSQLt framework to start unit testing in your database development.
Demo scripts are available here: https://github.com/segovoni/sql-server-demos/tree/master/datasaturday/2021/datasat0001/database-development-unit-test-with-tSQLt
Transformation Priority Premise: TDD Test Order MattersMike Clement
When coding using TDD, do you often run into a point when you have to “implement the whole thing”? The sequence of tests that we write significantly impacts where are code ends up! We’ll explore Uncle Bob’s Transformation Priority Premise, looking at the transformations that code goes through and how our tests can drive the code in different directions.
iOS Practice Leaders Community Meet-up.
“Unit Testing in iOS” by Maxim Koshtenko
- why we need tests and what their use in applications’ developing on a project is;
- how one should and should not test source code;
- review of some of the most popular tools which make test-writing easier;
- how to switch to unit-testing on a project which already exists.
Efficient JavaScript Unit Testing, March 2013Hazem Saleh
This material about efficient JavaScript unit testing is presented by Hazem Saleh in the Egyptian Java Developer Conference that was held in 09 March 2013.
Example of TAF with batch execution of test cases COMAQA.BY
An example of architectural solution based on consolidate approach is considered. Proposed solution allows to reduce tests time running especially while working on testing of application API with some time-consuming process.
The Spring Framework has always embraced testing as a first class citizen. Spring-based components should be modular, easy to wire together via dependency injection, and therefore easy to test. In fact, when well designed following a POJO programming model, a component in a Spring application can be unit tested without using Spring at all. And when you take the step toward developing integration tests, Spring's testing support is there to make your job easy.
Join Spring Test component lead Sam Brannen in this talk to learn about the basics for Spring's unit and integration testing support. This talk will provide attendees an overview of the following topics: unit testing without Spring, integration testing with Spring, loading application contexts (with and without context hierarchies), injecting dependencies into tests, transaction management for tests, SQL script execution, testing Spring MVC and REST web applications, and more.
Seconda serata di introduzione al Test-Driven Development, tenuta in XPeppers a Trento il 24 Ottobre 2012.
Nelle slide c'è anche la descrizione del coding dojo sullo string calculator che abbiamo svolto assieme.
Presented at C++ on Sea 2019, on 5th February 2019.
You've inherited some legacy code: it's valuable, but it doesn't have tests, and it wasn't designed to be testable, so you need to start refactoring! But you can't refactor safely until the code has tests, and you can't add tests without refactoring. How can you ever break out of this loop?
I present a new C++ library for applying Llewellyn Falco's "Approval Tests" approach to testing cross-platform C++ code - for both legacy and green-field systems, and a range of testing frameworks.
I describe its use in some real-world situations, including how to quickly lock down the behaviour of legacy code. I show how to quickly achieve good test coverage, even for very large sets of inputs. Finally, I also describe some general techniques I learned along the way.
IT Talk in Odessa for QA Automation/SDET engineers on 26/12/2016:
https://dou.ua/calendar/13626/
https://dataart.ru/events/odessa/it-talk-odessa-testng-vs-junit/
JUnit 4 code on github: https://github.com/a-oleynik/junit-workshop/tree/junit-4.13.2
TestNG code on github: https://github.com/a-oleynik/testng-workshop
Webinar on youtube (it was the next version but only a few slides and details were added): https://www.youtube.com/watch?v=3C-Nu5mkyOQ&t=3189
iOS Practice Leaders Community Meet-up.
“Unit Testing in iOS” by Maxim Koshtenko
- why we need tests and what their use in applications’ developing on a project is;
- how one should and should not test source code;
- review of some of the most popular tools which make test-writing easier;
- how to switch to unit-testing on a project which already exists.
Efficient JavaScript Unit Testing, March 2013Hazem Saleh
This material about efficient JavaScript unit testing is presented by Hazem Saleh in the Egyptian Java Developer Conference that was held in 09 March 2013.
Example of TAF with batch execution of test cases COMAQA.BY
An example of architectural solution based on consolidate approach is considered. Proposed solution allows to reduce tests time running especially while working on testing of application API with some time-consuming process.
The Spring Framework has always embraced testing as a first class citizen. Spring-based components should be modular, easy to wire together via dependency injection, and therefore easy to test. In fact, when well designed following a POJO programming model, a component in a Spring application can be unit tested without using Spring at all. And when you take the step toward developing integration tests, Spring's testing support is there to make your job easy.
Join Spring Test component lead Sam Brannen in this talk to learn about the basics for Spring's unit and integration testing support. This talk will provide attendees an overview of the following topics: unit testing without Spring, integration testing with Spring, loading application contexts (with and without context hierarchies), injecting dependencies into tests, transaction management for tests, SQL script execution, testing Spring MVC and REST web applications, and more.
Seconda serata di introduzione al Test-Driven Development, tenuta in XPeppers a Trento il 24 Ottobre 2012.
Nelle slide c'è anche la descrizione del coding dojo sullo string calculator che abbiamo svolto assieme.
Presented at C++ on Sea 2019, on 5th February 2019.
You've inherited some legacy code: it's valuable, but it doesn't have tests, and it wasn't designed to be testable, so you need to start refactoring! But you can't refactor safely until the code has tests, and you can't add tests without refactoring. How can you ever break out of this loop?
I present a new C++ library for applying Llewellyn Falco's "Approval Tests" approach to testing cross-platform C++ code - for both legacy and green-field systems, and a range of testing frameworks.
I describe its use in some real-world situations, including how to quickly lock down the behaviour of legacy code. I show how to quickly achieve good test coverage, even for very large sets of inputs. Finally, I also describe some general techniques I learned along the way.
IT Talk in Odessa for QA Automation/SDET engineers on 26/12/2016:
https://dou.ua/calendar/13626/
https://dataart.ru/events/odessa/it-talk-odessa-testng-vs-junit/
JUnit 4 code on github: https://github.com/a-oleynik/junit-workshop/tree/junit-4.13.2
TestNG code on github: https://github.com/a-oleynik/testng-workshop
Webinar on youtube (it was the next version but only a few slides and details were added): https://www.youtube.com/watch?v=3C-Nu5mkyOQ&t=3189
How do you design software when the requirements are vague? The key is to make it testable. In this talk, I've collected good practices, mindsets, and tools that will help you design high quality software even though the requirements are vague.
Ch 4: Footprinting and Social EngineeringSam Bowne
Slides for a college course at City College San Francisco. Based on "Hands-On Ethical Hacking and Network Defense, Third Edition" by Michael T. Simpson, Kent Backman, and James Corley -- ISBN: 9781285454610.
Instructor: Sam Bowne
Class website: https://samsclass.info/123/123_S17.shtml
Nowadays, TDD, BDD, continuous testing and other methodologies have come into our attention when developing. Yet, we barely know what needs to be tested and why are we testing it? During the talk we will go through a bunch of testing methodologies.
When assertthat(you).understandUnitTesting() failsMartin Skurla
When assertthat(you).understandUnitTesting() fails:
1.) Test face-lifting
2.) Handling assertions
3.) Declarative and Data driven testing
4.) Advanced techniques
5.) Results
An introduction to the motivation and theory behind test-driven development, suitable for people with experience in Mac or iOS development using Objective-C.
Srihitha Technologies provides Testing Tools Training in Ameerpet by real time Experts. For more information about Testing Tools training in Ameerpet call 9394799566 / 9290641808.
Mal ganz ehrlich: Testen im Frontend hat noch nie viel Spaß gemacht. In meinem Talk möchte ich mit Jest eine Testbibliothek vorstellen, die genau das ändern kann. Jest lässt sich ohne viel Konfiguration direkt einsetzen und bringt alles mit, was man von einer Testbibliothek erwartet (und noch mehr).
An vielen praktischen Beispielen möchte ich meine Lieblingsfeatures wie Snapshot-Tests, Mocking oder das tolle CLI erläutern und zeigen, dass Testen im Frontend durchaus Spaß machen kann. Eine Ausrede weniger, um auf das Testen im Frontend zu verzichten!
Vorkenntnisse:
Grundlegende JavaScript-Kenntnisse.
Lernziele:
Die Teilnehmer sollen einen Überblick über die Funktionsweise und die Einsatzbereiche von Jest bekommen. Sie lernen, wie sie für Tests in Frontend-Projekten mit Jest im Werkzeugkoffer gut gerüstet sind.
PuppetConf 2017: Test First Approach for Puppet on Windows- Miro Sommer, HiscoxPuppet
How to apply Test Driven Development (TDD) and Behavior Driven Development (BDD) techniques for Puppet modules? Usually, first comes the module code and then tests, but sometimes there are tests without value just for the sake of testing, or there are no tests at all. This causes problems when someone who isn't familiar with the code has to make changes and has no confidence that the code would still work. We can prevent these issues by using test-first approach with TDD or BDD to ensure that the code is always tested and we write the right tests. This session will give you practical steps to write tests first, as well as an overview and benefits of TDD and BDD techniques. We'll talk about how to write RSpec unit tests before there is any Puppet code written. We'll also look into Test Kitchen and how to write integration tests based purely on acceptance criteria of a work task, with a focus on testing Puppet modules on Windows using the latest and greatest PowerShell BDD testing library, Pester.
Implementing Test Automation in Agile ProjectsDominik Dary
All new features at eBay Europe are developed using SCRUM. One key success factor for those projects is to have a reliable end-to-end test automation safety net. This presentation illustrates how in addition to a robust automation toolset it is essential to have an integrated approach to test automation design:
Test Aspects - Test Aspects are used to do the functional design of the end-to-end automation test cases. Since this is done upfront, the tester is able to focus on the what rather than the how.
Modeling of the Biz Domain Layer - The Biz Domain Layer is an abstraction layer above the user interface that is implemented in the test code. This layer is divided into pages and flows which are then used in the tests.
Test Implementation - Tests are written in Java, stored in SVN and are executed using the WebDriver Grid (Selenium2). Tests execution can be triggered by all team members via a continuous integration server (Hudson).
Lean Test Automation – it is important to retain and maintain the quality of the tests. Key success factors for this are: Code Reviews, Software Craftsmanship, Test Aspect Reviews and the “Definition of Done”.
Following an integrated approach to test automation ensures high efficiency, low overhead and easier maintenance.
Cpp Testing Techniques Tips and Tricks - Cpp EuropeClare Macrae
Links from the talk are available at:
https://github.com/claremacrae/talks/blob/master/Cpp_Testing_Techniques_Tips_and_Tricks.md#top
An assortment of practical patterns and techniques to make it easier to write effective automated tests of C++ code, both old and new.
Clare will share some valuable techniques for easier handling of commonly troublesome testing scenarios. Whatever test framework you use, you will take away practical ideas to writer tests more easily and more effectively, to handle challenging automated test scenarios.
This talk is independent of test frameworks, and even covers a little for those creating Qt desktop applications.
Webinar "Differences between Testing in Waterfall and Agile"
presentation by Maria Teryokhina
http://www.exigenservices.ru/webinars/testing-in-waterfall-and-agile
1. Testing your code
For Java developers
Anna Khasanova
Anna.Khasanova@exigenservices.com
27 March 2013
Exigen Services confidential Exigen Services confidential
2. Agenda
• Testing basics
• TDD approach
• Testing in action
• Best practices
Exigen Services confidential 2
3. What is a test? Why do we need it?
• What is test?
• Why do we need testing?
• Automation
Exigen Services confidential 3
4. Automatic testing
Write once run often:
• Write test once
• Run frequently:
• After each change
• Continuous integration
• No human input
Exigen Services confidential 4
5. What is Test Driven Development?
TDD THEORY
Exigen Services confidential 5
6. Test Driven Development
• Software development approach
• Test before code
• Test - code requirements
Exigen Services confidential 6
8. New change request?
Design
Write Test succeeds
test
Test fails
Run test
Write Test fails
code
Whole story covered
Test
succeeds
Run test
Refactor Test fails
code
All tests succeed
Test
succeeds
Run test
Exigen Services confidential 8
9. Bugfix?
• Get bug report
• Turn it into a test
• Test should fail
• Fix bug
• Test should pass
Exigen Services confidential 9
10. How should I work?
How to write tests?
THE PRACTICE
Exigen Services confidential 10
11. What is Unit Test?
• Automated test for
• One business unit
• One business case
• Isolated
Exigen Services confidential 11
12. Unit Test is
• Small
• Fast
• Self documented
Exigen Services confidential 12
13. 3 parts of Unit-test
unitTest() {
// set preconditions: “arrange”
// call tested method: “act”
// assert results are as expected: “assert”
}
Exigen Services confidential 13
20. Example
PicturesService
+getSquarePictures()
Repository
+getAllPictures()
Exigen Services confidential 20
21. Example
@Test
public void testGetSquarePicturesEmptyResult() {
PicturesService testedService = new PicturesService();
Repository repository = mock(Repository.class);
//create fake Repository, returning empty list of pictures
when(repository.getAllPictures())
.thenReturn(Collections.<Picture>emptyList());
testedService.setRepository(repository);
Set<Picture> result = testedService.getSquarePictures();
assertTrue(result.isEmpty());
}
Exigen Services confidential 21
22. How to verify external calls?
• What to do if:
• Tested method should call externals
• We need to ensure that it was called?
• Mocks scenario verification
Exigen Services confidential 22
23. Example
@Test
public void testDeleteSquarePicturesEmptyResult() {
PicturesService testedService = new PicturesService();
Repository repository = mock(Repository.class);
Mockito.when(repository.getAllPictures())
.thenReturn(Collections.<Picture>emptyList());
testedService.setRepository(repository);
testedService.deleteSquarePictures();
verify(repository, never()).deletePictures(any());
}
Exigen Services confidential 23
24. How to verify arguments?
• What to do if:
• Mocked method is called with parameters
• We need to test passed parameters?
• Argument Captor
• Matchers
Exigen Services confidential 24
25. Example
@Test
public void testDeleteSquarePictures_captor() {
…
ArgumentCaptor<Iterable> captor =
ArgumentCaptor.forClass(Iterable.class);
verify(repository).deletePictures(captor.capture());
Iterable<Picture> result = captor.getValue();
…
}
Exigen Services confidential 25
26. How to verify exceptional cases?
• What to do if:
• Tested method should throw exception in
some case
• We need to test this case?
• Expected exceptions
@Test(expected = IllegalArgumentException.class)
public void testFactorialNegative() {
Factorial.factorial(-2);
}
Exigen Services confidential 26
27. How to verify exceptional cases?
• What to do if:
• We need to test time of execution?
• Timeout parameter
@Test(timeout = 1000)
public void infinity() {
while (true) ;
}
Exigen Services confidential 27