Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA...

51
Build a remote testing capability! Dockerize your testing to enable virtual environments Ref: 2020 Docker Inc Webinar

Transcript of Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA...

Page 1: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Build a remote testing capability!

Dockerize your testing to enable virtual

environments

Ref: 2020 Docker Inc

Webinar

Page 2: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Today’s Webinar

Bryon LowenTessolve -Software testing lead

Mounika KoduriTessolve – SDET

Sankar D RaoTessolve – SDET

Page 3: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Agenda• Benefits of Dockerizing your

testing• QA best practice in using Docker

environments• Tips in creating your virtual

Docker containers• How to integrate SonarQube for

code coverage • Understand Docker driven test

automation

Page 4: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Benefits of Dockerizing your testing

Page 5: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Why Docker?

• Docker accelerates your workflow

• Developing apps today requires so much more than writing code.

• Complexity:

• Multiple languages

• Frameworks

• Architectures

• Interfaces

Page 6: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Incredible adoption in just 4 years!

Ref: 2020 Docker Inc

Page 7: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Benefits• Agility

• Portability

• Security

• Cost savings

Page 8: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Why Docker is Hot!• Its simple

• Developers love it

Dev / test of legacy apps

New app dev

Code agility, CI/CD pipeline

DevOps adoption

Microservices & cloud

Page 9: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Ecosystem

Page 10: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

QA best practice in

using Docker environments

Page 11: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Historical limitations of app deployment

• Slow

• Costs

• Wasted resources

• Difficult to scale

• Difficult to migrate

• Vendor lock in

Application

Operating System

Physical server

Page 12: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Hypervised-based Virtualization

© 2019, Vipin Joshi. All Rights Reserved

Page 13: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Unlocking Containers

• A standardized unit of software that allows developers to isolate their app from its environment

• De facto standard to build and share containerized apps

• For Quality assurance:

• Clean builds

• Separate sections

• Is the defect a bug or env

Page 14: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker containers

Page 15: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Containers and VMs together

Conference: A Hybrid Genetic Programming: Boxiong Tan . All Rights Reserved

Page 16: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Benefits of Docker containers

Page 17: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Creating your virtual Docker

containers

Page 18: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Excellent Use Cases for Containers

Ready to Run Application Stacks

New App Dev & Microservices

One-Time Run jobs and Analytics

Build your own Paas

Front-End App Servers

Increase server density

Create secure sandboxes

Create your own SaaS

Automated application deployment

Continuous Integration and Deployment

Lightweight Desktop Virtualization

Page 19: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Dictionary

• Images:

• Base image

• Child image

• Containers

• Docker daemon

• Docker client

• Docker hub

Page 20: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Architecture

Page 21: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Containers as a Service

Page 22: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker CLI – Common / useful commands

• docker build : build docker image from Dockerfile

• docker run : run docker image• docker logs : show log data for a running

or stopped container

• docker ps : list running docker containers (analogous to ps)

• docker ps –a : list all containers including not running

• docker images : list all images on the local volume

• docker rm : remove/delete a container | docker rmi : remove/delete an image

• docker tag : name a docker image

• docker login : login to registry

• docker push/pull : push or pull volumes to/from Docker Registries

• docker inspect : return container run time configuration parameter metadata

Page 23: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Dockerfile

Page 24: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Demo -Docker commands hands-on

Page 25: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Compose

Docker Tool for defining and running multi-container Docker applicationsReference file defined in YAMLdocker-compose.yml

$ docker-compose up -d

Page 26: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Allocation of images to hosts

Page 27: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Swarm Master

Page 28: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

How to integrate

SonarQube for code coverage

Page 29: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Tracking and improving

software quality with

Page 30: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Overview

● Code quality (what, why

and when)

● SonarQube introduction

● How does it work?

● Integration with Maven

Project.

Page 31: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

What is code quality?

“It’s an indicator about how quickly

developers can add business value to

a software system”

Page 32: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Why measure?

● Source code is the heart of each system

● Developers don’t write new software. They

maintain “legacy” systems

● A system is (almost) never “finished”

● You can’t improve if you don’t measure

● Broken window theory

Page 33: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

When you should measure?

● From project day #1

● Continuously

● Prevent vs post-actions

● Prioritize and plan

Page 34: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

What SonarQube is?

● Free & open source “Code Quality Platform”

● Provides moment-in-time quality snapshots

● Gives trends of lagging and leading

indicators

● Tracks developers’ seven deadly sins (seven

axes of quality )

Page 35: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

How does it work?

● Analyzes source code and byte code

● Computes hundreds of metrics

● Associates metrics with analysis

snapshots

● Shows the results in dashboards

and widgets accessible by any

browser

Page 36: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

SonarQube for everything

● Initially developed only for Java projects

● Today supports over twenty languages

Open Source : C++, C#, Flex, Groovy, Android,

Javascript, PHP, Python, XML,

Web(xhtml, jsp , jsf, )

Commercial : ABAP, C, C++, Cobol, Natural, PL/SQL, Visual

Basic

Page 37: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

… and for everyone

● For developers. Is my code “good”? How can I improve it?

● For testers / QA staff. Which parts of the system lack unit

testing?

● For architects. Is the initial design “broken”? How about

complexity?

● For managers. Give me the numbers!! Are we going up or down?

Page 38: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Sonar Integration with

Maven Project

● Download and install SonarQube from URL

● Define sonar properties, jacoco.exec file path,

sonar dependency plugins Jacoco-maven-plugin,

Maven-compiler-plugin and maven-surefire-plugin)

● Push code coverage to sonar server using below

command from local/jenkins

mvn clean install sonar:sonar -

Dsonar.host.url=http://10.80.200.8 -

Dsonar.jacoco.reportPath=target/jacoco.exec

Page 39: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Sonar Properties

Page 40: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Sonar Plugins

Page 41: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Code Coverage & Quality Gate

Page 42: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Code Measures

Page 43: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Understand Docker driven

test automation

Page 44: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Test Automation Pre Req’s

● Docker Setup

● Sonar Integration with Maven/Gradle.. etc.

● Jenkins Job creation with Docker Swarm Cluster

for Unit / Integration Testing.

● Run the job and get the code quality report

through email.

Page 45: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Driven Test

Automation Flow Chart

Page 46: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Driven Unit Test

Reports

Page 47: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Docker Driven

Unit + Integration Test Reports

Page 48: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Summary

Q & A

Page 49: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Summary

• Docker accelerates your workflow

• Containers are a standardized unit of software

• For Quality assurance:

• Clean builds

• Separate sections

• Is the defect a bug or environment issue

• Integrate SonarQube to enable code coverage & quality

• Use docker environments to drive quality automation pipeline

Page 50: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Q & A

Page 51: Build a remote testing capability! Dockerize your …...Microservices & cloud Docker Ecosystem QA best practice in using Docker environments Historical limitations of app deployment

Thankyou