Shaun Abram
Technology and Leadership Blog
Blog post summary: Quality Assurance is Not About Testing
The following is a summary of Quality Assurance is Not About Testing by Matt Lievertz. I have also incorporated some elements of his earlier The Death of the Non-Coding QA Role post too.
Shift Left
Defining the term shift left to mean testing earlier in the development cycle feels antiquated since waiting until development is “complete” before testing is a plain ol’ anti-pattern at this point.
A better definition could be testing earlier and more frequently. Writing tests each sprint, and running those tests with every commit.
Perhaps better still is thinking of shift left as a movement of testing to earlier in the pipeline. Favor unit tests, which typically run in the pipeline first and fast. Heavier-weight tests, such as UI based and end-to-end tests, which are typically harder to write, slower to run, and run later in the pipeline, do have a place but should be used sparingly.
Another way to look at this is that shift left means shifting down the testing pyramid.
(more…)Tags: deliverypipeline, shiftleft, Testing, unittesting
Blog post summary: We need to talk about testing
I liked this “We need to talk about testing” post from Dan North. It’s about what testing actually means and how programmers and testers can work together. A summary (or copy & paste of the parts that I found most interesting, with some comments) below…
The purpose of testing is to increase confidence for stakeholders through evidence.
Tags: quality, summary, tdd, Testing, unittesting
Talk summary: SRE principles by Tori Wieldt @ AWS re:Invent 2018
I caught a talk by Tori Wieldt at the New Relic booth at AWS re:Invent on “SRE principles”. Even though it was a short talk in the expo hall, rather than a formal scheduled one, it had a ton of good SRE material.
Tags: aws, newrelic, reinvent, reinvent2018, sitereliabilityengineering, sre, summary, Testing
Testing in Production Presentation – SVCC 2018
The following post is essentially a written version of the Testing in production talk I gave at Silicon Valley Code Camp 2018. You can find the presentation deck here at slideshare.
Tags: chaos, chaosengineering, conferencetalks, For prep, integrationtesting, itestinprod, mytalks, production, resilience, resilienceengineering, Testing, testinginproduction
Book summary: Distributed Systems Observability
“Distributed Systems Observability” is a book from Cindy Sridharan (find her on twitter, and medium), available as a free download here (registration required). At a little over 30 pages and 8,000 words, it is not a difficult read, and I definitely recommend it.
Tags: itestinprod, logs, metrics, observability, production, summary, Testing, testinginproduction, tracing
Testing in Production
Note that I gave a talk on this blog post in Dec ’18, if you prefer to watch that: https://www.youtube.com/watch?v=-b4QaEuFkP0
“Testing in production” used to be a joke. The implication was that by claiming to test in production, you didn’t really test anywhere, and instead just winged it: deploying to production and hoping that it all worked. Times have changed however, and testing in production is becoming accepted as a best practice.
Tags: integrationtesting, itestinprod, production, talks, Testing, testinginproduction
Running an individual unit test with maven
Individual tests can be run from maven. This must be done from within the folder that contains the source (as in the folder that contains src/test/java), which will likely be either be the root of your maven project, or in one of your modules.
For surefire (unit tests), to run a whole test class, this will be something like:
mvn -Dtest=com.your.package.YourTest test
or, to run a specific test method:
mvn -Dtest=com.your.package.YourTest#testMethod test
For failsafe (integration tests), it will be something like:
mvn -Dit.test=com.your.package.YourIT verify
This is covered in the maven surefire plugin docs and maven failesafe plugin docs respectively, but those examples don’t mention packages names, which are required.
Tags: failsafe, integrationtesting, JUnit, Maven, mvn, surefire, Testing, unittesting
Running tests in IntelliJ for a multi module maven project
This post shows how to run all the tests in IntelliJ for a multi module maven project.
Tags: intellij, Maven, mvn, Testing
Unit Testing – the Hard Parts @ NYC Code Camp
Thanks to everyone who came to my “Unit Testing – the Hard Parts” presentation @ New York Code Camp. I really enjoyed it! Great crowd, lots of follow up questions. And cool Microsoft office space in Times Square. Thank you to all who attended. My slides are here: http://www.slideshare.net/shaunabram/unit-testing-the-hard-parts
Tags: codecamp, mocks, mytalks, nycc, stubs, tdd, testdoubles, testdrivendevelopment, Testing, unittesting
Test Doubles: mocks, dummies and stubs
Most classes have collaborators. When unit testing, you usually want to avoid using real implementations of those collaborators to avoid test brittleness and binding/coupling, and instead use Test Doubles: Mocks, Stubs and Doubles.
This article references two existing articles on the subject: Mocks Aren’t Stubs, by Martin Fowler and The Little Mocker, by “Uncle” Bob Martin. I recommend them both.
Tags: doubles, dummies, fakes, martinfowler, mockito, mocks, spies, tdd, testdoubles, Testing, unclebob, unittesting
Builder Pattern: Good for code, great for tests
I’ve found the builder design pattern occasionally useful in code, but frequently useful in tests. This article is a quick summary of the pattern in general, followed by look at a working example of using it in tests. See the code in github.
(more…)
Tags: builder, designpatterns, Testing, unittesting
Software Quality via Unit Testing
The following post is based on a talk I gave at Desert Code Camp 2013. See also the associated slide deck.
Software quality is critical to consistently and continually delivering new features to our users. This articles covers the importance of software quality and how to deliver it via unit testing, Test Driven Development and clean code in general.
Read more
Tags: cleancode, codecamp, dcc13, desertcodecamp, JUnit, martinfowler, mytalks, talks, tdd, Testing, unittesting
Spring MVC Hello World with Continuous Deployment
Oh dear, yet another ‘Hello World!’. But although the functionality is trivial, this little SpringMVC project is complete enough for me to use as a template to bootstrap more complex projects. It consists of:
- HTML/JSP client
- SpringMVC server using a Controller/Service/DAO design
- Maven for build and dependency management
This is an updated version of an older project I created, with the following enhancements:
- Added a full suite of automated tests (unit, integration and browser based)
- Added placeholders for JavaScript and images (both can be a little tricky to put in the correct place with SpringMVC)
- Incorporated into a continuous deployment environment
More details below, but you can find the full source code on this GitHub repository
(Previously I had the code deployed on a CloudBees instance at http://springmvc.shaunabram.cloudbees.net, but CloudBees have since unfortunately shut down their free tier).
Tags: cloud, cloudbees, continuousdeployment, continuousintegration, easymock, fest, helloworld, jenkins, spring, springmvc, Testing, unittesting
Hamcrest Matcher
As a follow up to the Hamcrest post I made yesterday, I wanted to post an example of my own Hamcrest matcher implementation. This matcher tests if a string contains a specified number of substrings.
An example usage could be:
String sql = "select a,b,c from tableA";
assertThat(sql, hasNumberOfSubstrings(",", 2));
See the source code below. I have been reading up on OSS licenses recently and decided to release this using the same license as Hamcrest – the new BSD license.
I have also attached a jar which includes the associated unit tests, although you will need the hamcrest-unit-test project to compile, which can be downloaded as part of the hamcrest all-in-one jar.
Read more
Tags: Hamcrest, JUnit, Testing, unittesting