SlideShare a Scribd company logo
Red Light,
Green Light,
Go!
Set Up a Portable Testing Rig
with Docker and GoConvey
Capital Go Language Conference
April 25, 2017
Alison Rowland
Capital One Tech Fellows Program
(Formerly 18F, Presidential Innovation Fellows, Sunlight Foundation)
@arowla
Confession Time
Testing Makes Better Code
Testing Should Be Fun
Go ‘Testing’ is Spartan
Go Testing Frameworks
Gingko Testify Mao/Zen
Gocheck GoConvey gospec
Prettytest Go-spec goblin
Go Testing Frameworks
Gingko Testify Mao/Zen
Gocheck GoConvey gospec
Prettytest Go-spec goblin
The GoConvey Web UI
The main test result pane
testing log/history
status bar
controls
controls
test history view
coverage pane
coverage pane
Failures Highlighted
Native or BDD Testing
• Works with existing testing code • But also has a nice BDD syntax
with elegant asserts
Docker
How Docker Works with GoConvey
HOWTO: Two Docker Files
Gist on Github: http://bit.ly/2pIxMim
Docker File Drop-In
Gist on Github: http://bit.ly/2pIxMim
Dockerfile.testing
Gist on Github: http://bit.ly/2pIxMim
docker-compose.yml
Building the Docker Container
Autotesting
Test History Inspector
Coverage Browser
Responsive Layout
Gist on Github: http://bit.ly/2pIxMim
Docker File Drop-In
Docker/Goconvey Benefits
Doesn’t pollute your environment
Doesn’t bulk up your project dependencies
Docker/Goconvey Benefits
If you’re developing your app in a container already, you can run this alongside it
A Step Further
Developing golang apps in Docker, if you vendor your dependencies,
can eliminate the need to follow $GOPATH entirely.
Caveats
To use BDD style, goconvey needs to be included in your project dependencies
To get goconvey’s enhancements for CLI test runner, it also needs to be included in
your project
Thank you!
Gist: http://bit.ly/2pIxMim
@arowla

More Related Content

What's hot

GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
Spandana Govindgari
 
How to master a programming language: a Golang example"
How to master a programming language: a Golang example"How to master a programming language: a Golang example"
How to master a programming language: a Golang example"
Evan Lin
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1
 
Lcna 2012-example
Lcna 2012-exampleLcna 2012-example
Lcna 2012-example
Gluster.org
 
Kotlin react bkk 3.0.0
Kotlin react bkk 3.0.0Kotlin react bkk 3.0.0
Kotlin react bkk 3.0.0
Christopher Ng
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
GoogleDevelopersStud
 
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Aysylu Greenberg
 
Introduction to GoLang
Introduction to GoLangIntroduction to GoLang
Introduction to GoLang
NVISIA
 
Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"
Nicolas Cuillery
 
A prentation on github
A prentation on githubA prentation on github
A prentation on github
Veronica Ojochona Michael (MCP)
 
Fine Tuning Your GitHub Flow
Fine Tuning Your GitHub FlowFine Tuning Your GitHub Flow
Fine Tuning Your GitHub Flow
Stefan Stölzle
 
After the Code
After the CodeAfter the Code
After the Code
Adam Whittingham
 
Github 101 An Adventurer's Guide To Open Source
Github 101   An Adventurer's Guide To Open SourceGithub 101   An Adventurer's Guide To Open Source
Github 101 An Adventurer's Guide To Open Source
Prachitibhukan
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
Otto Kekäläinen
 
Dockercon2015 bamboo
Dockercon2015 bambooDockercon2015 bamboo
Dockercon2015 bamboo
Steve Smith
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
Evan Lin
 
Graalvm with Groovy and Kotlin - Greach 2019
Graalvm with Groovy and Kotlin - Greach 2019Graalvm with Groovy and Kotlin - Greach 2019
Graalvm with Groovy and Kotlin - Greach 2019
Alberto De Ávila Hernández
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
Otto Kekäläinen
 
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal GargGitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
Nisha Garg
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
Karsten Dambekalns
 

What's hot (20)

GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
How to master a programming language: a Golang example"
How to master a programming language: a Golang example"How to master a programming language: a Golang example"
How to master a programming language: a Golang example"
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Lcna 2012-example
Lcna 2012-exampleLcna 2012-example
Lcna 2012-example
 
Kotlin react bkk 3.0.0
Kotlin react bkk 3.0.0Kotlin react bkk 3.0.0
Kotlin react bkk 3.0.0
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
 
Introduction to GoLang
Introduction to GoLangIntroduction to GoLang
Introduction to GoLang
 
Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"
 
A prentation on github
A prentation on githubA prentation on github
A prentation on github
 
Fine Tuning Your GitHub Flow
Fine Tuning Your GitHub FlowFine Tuning Your GitHub Flow
Fine Tuning Your GitHub Flow
 
After the Code
After the CodeAfter the Code
After the Code
 
Github 101 An Adventurer's Guide To Open Source
Github 101   An Adventurer's Guide To Open SourceGithub 101   An Adventurer's Guide To Open Source
Github 101 An Adventurer's Guide To Open Source
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
Dockercon2015 bamboo
Dockercon2015 bambooDockercon2015 bamboo
Dockercon2015 bamboo
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
 
Graalvm with Groovy and Kotlin - Greach 2019
Graalvm with Groovy and Kotlin - Greach 2019Graalvm with Groovy and Kotlin - Greach 2019
Graalvm with Groovy and Kotlin - Greach 2019
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal GargGitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 

Similar to Building a Portable Testing Rig with GoConvey and Docker

Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
Anthony Chow
 
Testing in GO
Testing in GOTesting in GO
Testing in GO
song jiayang
 
Golang
GolangGolang
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
Vimlesh Sharma
 
Jenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipelineJenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipeline
Steffen Gebert
 
Trying out the Go language with Google App Engine
Trying out the Go language with Google App EngineTrying out the Go language with Google App Engine
Trying out the Go language with Google App Engine
Lynn Langit
 
Acceptance testing with Geb
Acceptance testing with GebAcceptance testing with Geb
Acceptance testing with Geb
Richard Paul
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
sangam biradar
 
Introduction to using google colab
Introduction to using google colabIntroduction to using google colab
Introduction to using google colab
ali alemi
 
presentationcloud-18123333331185718.pptx
presentationcloud-18123333331185718.pptxpresentationcloud-18123333331185718.pptx
presentationcloud-18123333331185718.pptx
MuhammadAbdullah311866
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioJava to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.io
Mauricio (Salaboy) Salatino
 
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Baruch Sadogursky
 
Gitlab meets Kubernetes
Gitlab meets KubernetesGitlab meets Kubernetes
Gitlab meets Kubernetes
inovex GmbH
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Vadym Kazulkin
 
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Omer van Kloeten
 
Let's Go @ St. Louis CocoaHeads
Let's Go @ St. Louis CocoaHeadsLet's Go @ St. Louis CocoaHeads
Let's Go @ St. Louis CocoaHeads
Paul Balogh
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
Codemotion
 

Similar to Building a Portable Testing Rig with GoConvey and Docker (20)

Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
 
Testing in GO
Testing in GOTesting in GO
Testing in GO
 
Golang
GolangGolang
Golang
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
Jenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipelineJenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipeline
 
Trying out the Go language with Google App Engine
Trying out the Go language with Google App EngineTrying out the Go language with Google App Engine
Trying out the Go language with Google App Engine
 
Acceptance testing with Geb
Acceptance testing with GebAcceptance testing with Geb
Acceptance testing with Geb
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
 
Introduction to using google colab
Introduction to using google colabIntroduction to using google colab
Introduction to using google colab
 
presentationcloud-18123333331185718.pptx
presentationcloud-18123333331185718.pptxpresentationcloud-18123333331185718.pptx
presentationcloud-18123333331185718.pptx
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioJava to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.io
 
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
 
Gitlab meets Kubernetes
Gitlab meets KubernetesGitlab meets Kubernetes
Gitlab meets Kubernetes
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
CICD_1670665418.pdf
CICD_1670665418.pdfCICD_1670665418.pdf
CICD_1670665418.pdf
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
 
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04Power Up Your Build - Omer van Kloeten @ Wix 2018-04
Power Up Your Build - Omer van Kloeten @ Wix 2018-04
 
Let's Go @ St. Louis CocoaHeads
Let's Go @ St. Louis CocoaHeadsLet's Go @ St. Louis CocoaHeads
Let's Go @ St. Louis CocoaHeads
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
 

Recently uploaded

Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 

Recently uploaded (20)

Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 

Building a Portable Testing Rig with GoConvey and Docker

Editor's Notes

  1. Hi! Thank you all for being here today. This is my talk on better and more fun testing in Go with Docker and GoConvey. And, I have to say, I was a little concerned Bryan was going to steal my thunder earlier, but since he only had one slide on GoConvey, he’s forgiven.
  2. But before we get into this, I have a confession to make… I’m not really a Go programmer. I’m a Python and Node.js programmer. In fact, I’m probably the only speaker on stage today who also attended Mark’s awesome “Intro to Go” workshop yesterday. That said, what I hope to bring here is a bit of a Go newbie’s fresh perspective. Something else I DO have a lot of experience with... is testing.
  3. At 18F, I was co-organizer of our Automated Testing Workgroup, which was a group centered around testing techniques and best practices. I’m sure I’m preaching to the choir here, but testing is important. Testing makes our code smarter. I believe it even makes _us_ smarter developers. When we test, we end up building better interfaces. Our modules become more decoupled. We also avoid regressions, so we can confidently ship software, and… by the way, *hands up* who here enjoys manually testing your software every time you make a change?
  4. Since it’s so important, testing should be easy and FUN. Which means that any testing framework should be, at a MINIMUM: *lightweight, *require minimal changes to our codebase, *include the option to fail fast, meaning the test run stops at the first failure, so we don’t have to wait for the whole suite to finish running; *it should be colorful, so it’s easy to visually scan the test output. Annnd another really great feature to have is autotesting, so our tests watch for code changes, and re-run live, as soon as we make changes. By the way, since you’re probably wondering, that photo is of a real test rollercoaster, so it’s LITERALLY TESTING FUN. And safety…. (It’s from a company in Italy called Ride Tek, which designs rollercoasters. You can read about it on Wikipedia.)
  5. So… What does all this test evangelism have to do with Go? Well, I recently found myself helping out with a golang project. And of course, the first thing I did, after cloning the repo, was to find out where the tests were located and how to run them. And the first thing I realized was: the standard go testing library is pretty SPARTAN. No colors No failfast option It didn’t support test subsets or tagging and worst of all, no autotest. But that’s ok, because that’s what 3rd-party testing frameworks are for, right? So let’s take a look at some of the options.
  6. Looking around at libraries, I found Ginkgo, testify, gocheck, prettytest, go-spec, mao/zen, and more. But I’m not going to cover all of those, because just as I was starting to explore the landscape, my colleague, Jeff Damick, suggested that I check out GoConvey.
  7. And GoConvey had something so unique, in my experience, that I had to try it out. That really unique feature was this:
  8. The GoConvey Web UI. It acts like a local CI/CD server for your Go project. GoConvey runs as a daemon on your local machine, watches your code for changes, and automatically re-runs your tests while you code. This is really awesome for speeding up our development feedback loops, and reducing the barriers to testing. So, let’s take a quick tour of the UI.
  9. Play/Pause, Retry, Test History, and a few others.
  10. That third button, the test history, is really interesting, because it brings up another panel which shows our test histories, and lets us click on any one, to travel back in time, and inspect anything about the test run.
  11. At the left, we have a pane which includes coverage information.
  12. And from there, we can click on a package name to enter the coverage browser. But I’ll go over that more in a little bit.
  13. Test failures are really well highlighted. And if you can see the little icon that looks like an eye, that will toggle to let us ignore any given module if we know we have tests that are going to fail, or for some reason we don’t want to keep rerunning them.
  14. So, this GoConvey UI is really cool, and one of the best parts about it, is that it works with the standard go ‘testing’ module. But if you prefer, it also has a nice BDD syntax that we can use, with some pretty powerful asserts available. I won’t go into those here, but you can find a full list of the asserts on the GoConvey repo in the wiki.
  15. So, at the beginning I promised this talk was going to include something about Docker. And in fact, this whole talk was inspired by the fact that I figured out how to get GoConvey running in a Docker container, and it was so friggin’ cool, I just had to come here and tell you all about it. In this next part, we are going to see how to run GoConvey in its own Docker container, and get many of the benefits of this framework, without ever changing our project’s code. So that’s what this is about. Our portable… testing... Rig. Let’s see how it works!
  16. Here, I drew a little picture for you. How it works, is that you have your project repo on your laptop, and you mirror that directory into a volume on your container. And if you don’t know about volumes in Docker, when you mirror a path on the host, changes continue to be reflected live in the container, even after it’s built. That’s really the crux of how this whole thing works. The project from the host, gets mirrored into the $GOPATH in the container. The cool thing here is that $GOPATH on the host vs $GOPATH on the container are a totally arbitrary relationship. They look the same here, but they don’t have to be the same. If you hold that thought, I’ll have a little bit more to say about that later.
  17. Here, we see the paths to two files we’re going to need to accomplish this setup, Dockerfile.testing and docker-compose.yml. So we have our two files, and this is just showing that the Dockerfile.testing file sets up the basic GoConvey build instructions, while the docker-compose.yml wraps those build instructions and injects the details of the local project into the build via some arguments.
  18. And here is the text of those two files. With two small files, and under 35 lines of code, we get that whole working GoConvey setup, which I’ll demo for you a bit more in a minute. But next, I’ll go through each of these files in more detail, and if you want to pull down these files for yourself, just use the link at the bottom– they’re in a Gist on Github. (And don’t worry, I’m going to move on, but this link will be on a few of the next slides, and at the end, too.)
  19. So, if we go through this file, section by section, first we have the FROM image– we’re just using a standard golang image based on the alpine Linux distro, which makes it really lightweight, and keeps the filesizes really small. Next, we have a couple of arguments– these get populated by the docker-compose file, which we’ll see in a minute– but you can see that we’re specifying a port to run on, and the app_path, which is the path to our repo (relative to the GOPATH/src directory). Then we EXPOSE the port, we RUN commands to install git as well as goconvey, and finally, we have the command which will start up the goconvey daemon. A few things to note there-- host works best as 0.0.0.0 with Docker – by default, it’s localhost, but that and 127.0.0.1 did not work in my testing. Port is self-explanatory, workDir is the path to the project we want to test, and finally, launchBrowser equals false– by default, goconvey tries to open itself in a browser for us, but since that won’t work from within the container, we turn it off to avoid an error.
  20. Here is the docker-compose.yml. This says we’re using version three of the docker-compose syntax. We’re defining just one service, called goconvey… There’s some build info, including the context, which is our local project directory. We specify the dockerfile name, since we’re not using the default name, just to avoid conflicts with any existing Dockerfile you may have. By the way, you might need to do a similar renaming of the docker-compose file if you also have an existing one of those. (One caveat: don’t name your file Dockerfile.goconvey. GoConvey is a little dumb in this respect, and it will throw an error at you, because apparently the file pattern that it watches matches anything with ”.go” in the name ~anywhere~.) Next, we specify the args, our port is 9006, our app_path is the path to our go module. Then we have the volumes mapping, which is basically just mapping $GOPATH/src to $GOPATH/src here. Finally, we map port 9006 on the host to 9006 on the container. And that’s all it takes. Next, let’s watch how to get it running.
  21. First, we’ll do a build.
  22. Ok, now that it’s running, what can we do with it? Let’s see how autotesting works. I’ll fix a test failure and you can see the web interface re-run the tests and update in almost real-time. END: “There we go. It’s already back to passing. I didn’t even have to reload the page or trigger anything, other than saving my Go file.”
  23. Next, let’s check out that cool test history inspector, that’s kind of like our build history in a CI/CD system. (Might re-run this one a second time)
  24. This is one of my favorite parts– the coverage browser.
  25. Ok, last demo: that web ui can take up a lot of screen real estate, but it doesn’t have to. The interface is built to be fully responsive, so you can shrink it down and have it display side-by-side with your editor, if you like.
  26. So, to reiterate, you can have a portable testing rig with GoConvey and Docker, everything I showed you above, with just two small files dropped in to your project.
  27. So the really great thing about this is– if you’re just helping out, or just checking out a Github repo, you can use this anytime, to get a more responsive testing experience, without installing a single go package or changing a single line of the code base.
  28. Keeping GoConvey in a separate container from your app follows the principle of one process per container. And if you already have a docker-compose file, you can just specify them both with the –f flag on the command line, and it should all work.
  29. Use Docker and clone your repos where you will!
  30. This neat trick has its limits, I must admit… [READ SLIDE] But if you want the feeling of a local CI/CD system as you develop, and you want to be able to use it on any project you touch, you can use this portable testing rig setup! In fact, you may even be able to build the image once, push it to a docker registry, then bring nothing but the docker-compose file from project to project. I haven’t tried this myself, but it should be possible. In addition, I’m sure there are some improvements that could be made to those Docker files that I posted. And if you find any, get in touch, I’d love to hear about them!
  31. And that’s all. Thank you! Once again, there’s the link to the Gist for the files, I’m arowla on Twitter, and… I wish you happy and fun testing!