SlideShare a Scribd company logo
1 of 17
Download to read offline
Testing Basic
Concepts
by Iván Corrales Solera, @wesovi
Index
● Code with tests vs code w/o tests
● Tests oriented development
● Types of testing
● Frameworks and tools (Java apps)
● Tests automation and CI
● Testing examples
Code with tests or w/o tests
● Do you think is better to do tests in your developments?
○ I supposed your answer would be YES
● Do you think development process take longer if we do tests?
○ YES? Why?
○ No, You are right, but why?
● What are the benefits of doing testing?
○ ….
Brief questions
Code with or w/o tests
Code with TestsCode w/o Tests
Refactor is so
risky!
Just necessary code
Software
with unused
code
Tests are our best documentation
We need to
get in the code
Developers Spending time
on understanding what code
does
Life is easier for new developers
Quick bug-fixing
Quality Software
Spending
long time on
bug-fixing
compiled
code but
NOT
software..
Re-factor is safe
Tests oriented development
Start writing tests
See the tests fail
Write code to make the tests pass
Pass the tests
TDD
● We will write code to make tests work
instead of writing some tests to check part of
our code.
● High test coberture levels.
● If we need to do bug-fixing we will start
writing some tests before making changes in
the code.
● Developers with experience in that
programming language.
BDD
● No technical people can define our tests
or help us to write them at least.
● Both technical and non technical people
speak the same language.
● BDD doesn’t mean not to do unit
testing.
● Our user stories will be completed when
acceptance criterias are satisfied.
● User stories can be tracked in the code.
Comparison
Steps
1. We have the software requirements
2. We think about what we need to test
3. We write some tests
4. Tests will fail
5. We write code to pass the tests
6. We can do some re-factor
Pros
● Code with quality
● We do not have unnecessary code
● We ensure our software works as expected.
● High test coberture level
● Low Bug-fixing time
Steps
1. We have the software requirements
2. We write code for the requirements
3. We write some tests to check our software
work
4. Run the tests
5. We’ll be happy when we have a test that
pass (probably because we know the
result before writing it)
Pros
● We have code with some tests
● Some coberture level
● Highly probably software with no high
quality
Writing code before tests Test before coding
Types of testing
Unit Testing
Integration Testing
Acceptance Testing
Stress Testing
UI Testing
Monkey Testing
Load Testing ….. Testing, Testing, Testing
Plenty types of testing… BUT we only need to do those testings that contribute to ensure the
quality of our application
Tests oriented development
People not used to
do test
Just code but NOT Software
Maybe Over tested
applications...
Software with QA and correct tests
No tests
We do not apply the correct
testing
Identify which testing are
suitable for our application
Code with lack of Testing
Tips on Testing
Do tests but just those ones that have sense for your code
Identify what kind of testing should we do depending on the application
Practicing TDD or NOT is up to the developers. They should never be forced to do it
Enforce developers to do tests but do NOT establish a minimum test coberture
Unit Testing
What are the unit testing for?
● Ensure a piece of code or method works as expected
● Make us achieve high test coberture levels
● Easy for developers but not understable by non-technical people.
● Tests must be run without application deployments
● Mocks are required
When do not we have to do unit testing?
● Front end applications
● We use MDA
● We use kind of code generation
frameworks.
When should we do unit testing?
● Complexed methods
● Algorithms and mathematics calculus
Integration Testing
When do not we have to do integration
testing?
● Our application does only one basic thing
such as a math operation or display hello
world in the screen.
When should we do integration testing?
● Most of architectures: WS, Batch,
microservices ,...
● Backend developed in Javascript (e2e)
● User interfaces
What are the integration testing for?
● Ensure our system works as expected.
● Does not really guarantee a high test coberture level.
● They must be run in environment similar to the production one.
● We could be forced to use mocks in case of we interact with third-party systems.
Acceptance Testing
What are the acceptance testing for?
● Make technical and non technical people speak the same language
● In scrum these tests would be the acceptance criterias defined for the user stories.
● If these are not defined by the Product Owner, we need his/her validation at least.Some people
think these tests are unnecessary since integration testing could be enough. (And they could be
right indeed)
● Natural language syntax (When, Then, And…. ) See below an example:
Given 10 can of beers
When I drink 2 of them
Then I should have 8 in my fridge.
Frameworks and tools (Java apps)
Tests automation and CI
Compile & Build Unit Tests Integration Tests Acceptance Tests
● The above flow represents the steps in the ci process.
● Each step above would be a different job in Jenkins (or whichever other CI tool)
● Each step will generate a report with the results
● We should not move to the next step in the flow in case of there were tests failing
● Developers must be able to run the tests from their local environment.
Sample - e2e for nodejs REST API
Code: https://github.com/wesovi/nodejs-authentication-api
Technologies: Nodejs, mocha, supertest
Snippet:
it('should response BAD REQUEST & the error details when password is empty ', function (done) {
var credentials = {username:"email@mail.com"};
request(app)
.post('/accounts/authenticate')
.send(credentials)
.set('Content-Type', 'application/json')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect(400)
.expect({errors:[{ param: 'password', msg: 'required' }]})
.end(done);
});

More Related Content

What's hot

Software Testing 101
Software Testing 101Software Testing 101
Software Testing 101QA Hannah
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testingHadi Fadlallah
 
Types of Software Testing | Edureka
Types of Software Testing | EdurekaTypes of Software Testing | Edureka
Types of Software Testing | EdurekaEdureka!
 
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...Ankit Prajapati
 
Regression Testing - An Overview
Regression Testing - An OverviewRegression Testing - An Overview
Regression Testing - An OverviewBugRaptors
 
Bug life cycle
Bug life cycleBug life cycle
Bug life cycleBugRaptors
 
Software Testing Life Cycle
Software Testing Life CycleSoftware Testing Life Cycle
Software Testing Life CycleUdayakumar Sree
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1Raghu Kiran
 
Software Testing Life Cycle (STLC) | Software Testing Tutorial | Edureka
Software Testing Life Cycle (STLC) | Software Testing Tutorial | EdurekaSoftware Testing Life Cycle (STLC) | Software Testing Tutorial | Edureka
Software Testing Life Cycle (STLC) | Software Testing Tutorial | EdurekaEdureka!
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation TestingArchana Krushnan
 
Difference between functional testing and non functional testing
Difference between functional testing and non functional testingDifference between functional testing and non functional testing
Difference between functional testing and non functional testingpooja deshmukh
 
What is Sanity Testing? Edureka
What is Sanity Testing? EdurekaWhat is Sanity Testing? Edureka
What is Sanity Testing? EdurekaEdureka!
 
software testing for beginners
software testing for beginnerssoftware testing for beginners
software testing for beginnersBharathi Ashok
 

What's hot (20)

Introduction & Manual Testing
Introduction & Manual TestingIntroduction & Manual Testing
Introduction & Manual Testing
 
Software Testing 101
Software Testing 101Software Testing 101
Software Testing 101
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
 
Software testing
Software testingSoftware testing
Software testing
 
Types of Software Testing | Edureka
Types of Software Testing | EdurekaTypes of Software Testing | Edureka
Types of Software Testing | Edureka
 
Testing fundamentals
Testing fundamentalsTesting fundamentals
Testing fundamentals
 
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
 
Regression Testing - An Overview
Regression Testing - An OverviewRegression Testing - An Overview
Regression Testing - An Overview
 
Bug life cycle
Bug life cycleBug life cycle
Bug life cycle
 
Software Testing Life Cycle
Software Testing Life CycleSoftware Testing Life Cycle
Software Testing Life Cycle
 
Manual testing
Manual testingManual testing
Manual testing
 
Introduction to Agile Testing
Introduction to Agile TestingIntroduction to Agile Testing
Introduction to Agile Testing
 
Types of testing
Types of testingTypes of testing
Types of testing
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1
 
Software Testing Life Cycle (STLC) | Software Testing Tutorial | Edureka
Software Testing Life Cycle (STLC) | Software Testing Tutorial | EdurekaSoftware Testing Life Cycle (STLC) | Software Testing Tutorial | Edureka
Software Testing Life Cycle (STLC) | Software Testing Tutorial | Edureka
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
 
Difference between functional testing and non functional testing
Difference between functional testing and non functional testingDifference between functional testing and non functional testing
Difference between functional testing and non functional testing
 
What is Sanity Testing? Edureka
What is Sanity Testing? EdurekaWhat is Sanity Testing? Edureka
What is Sanity Testing? Edureka
 
Software testing
Software testingSoftware testing
Software testing
 
software testing for beginners
software testing for beginnerssoftware testing for beginners
software testing for beginners
 

Similar to Testing Basic Concepts Explained

Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleikram_ahamed
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and AutomationMahesh Salaria
 
High Performance Software Engineering Teams
High Performance Software Engineering TeamsHigh Performance Software Engineering Teams
High Performance Software Engineering TeamsLars Thorup
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Abhijeet Vaikar
 
Should you be your own judge?
Should you be your own judge?Should you be your own judge?
Should you be your own judge?Achyut Pokhrel
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated TestingLars Thorup
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testingBestBrains
 
Software testing and software development process
Software testing and software development processSoftware testing and software development process
Software testing and software development processGen Aloys Ochola Badde
 
What is Unit Testing
What is Unit TestingWhat is Unit Testing
What is Unit TestingSadaaki Emura
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionJosh Gough
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptxAmalEldhose2
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1Blue Elephant Consulting
 
Lessons Learned When Automating
Lessons Learned When AutomatingLessons Learned When Automating
Lessons Learned When AutomatingAlan Richardson
 
Unit Testing and TDD 2017
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017Xavi Hidalgo
 
Android Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit TestingAndroid Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit Testingmahmoud ramadan
 
Software testing enhance quality and performance of software
Software testing enhance quality and performance of softwareSoftware testing enhance quality and performance of software
Software testing enhance quality and performance of softwareEmipro Technologies Pvt. Ltd.
 
Topic production code
Topic production codeTopic production code
Topic production codeKavi Kumar
 
Client Side Unit Testing
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testingcloud chen
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
PMI-ACP Lesson 06 Quality
PMI-ACP Lesson 06 QualityPMI-ACP Lesson 06 Quality
PMI-ACP Lesson 06 QualityThanh Nguyen
 

Similar to Testing Basic Concepts Explained (20)

Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
High Performance Software Engineering Teams
High Performance Software Engineering TeamsHigh Performance Software Engineering Teams
High Performance Software Engineering Teams
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
 
Should you be your own judge?
Should you be your own judge?Should you be your own judge?
Should you be your own judge?
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated Testing
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
 
Software testing and software development process
Software testing and software development processSoftware testing and software development process
Software testing and software development process
 
What is Unit Testing
What is Unit TestingWhat is Unit Testing
What is Unit Testing
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous Inspection
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 
Lessons Learned When Automating
Lessons Learned When AutomatingLessons Learned When Automating
Lessons Learned When Automating
 
Unit Testing and TDD 2017
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017
 
Android Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit TestingAndroid Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit Testing
 
Software testing enhance quality and performance of software
Software testing enhance quality and performance of softwareSoftware testing enhance quality and performance of software
Software testing enhance quality and performance of software
 
Topic production code
Topic production codeTopic production code
Topic production code
 
Client Side Unit Testing
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testing
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
PMI-ACP Lesson 06 Quality
PMI-ACP Lesson 06 QualityPMI-ACP Lesson 06 Quality
PMI-ACP Lesson 06 Quality
 

Recently uploaded

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Testing Basic Concepts Explained

  • 1. Testing Basic Concepts by Iván Corrales Solera, @wesovi
  • 2. Index ● Code with tests vs code w/o tests ● Tests oriented development ● Types of testing ● Frameworks and tools (Java apps) ● Tests automation and CI ● Testing examples
  • 3. Code with tests or w/o tests ● Do you think is better to do tests in your developments? ○ I supposed your answer would be YES ● Do you think development process take longer if we do tests? ○ YES? Why? ○ No, You are right, but why? ● What are the benefits of doing testing? ○ …. Brief questions
  • 4. Code with or w/o tests Code with TestsCode w/o Tests Refactor is so risky! Just necessary code Software with unused code Tests are our best documentation We need to get in the code Developers Spending time on understanding what code does Life is easier for new developers Quick bug-fixing Quality Software Spending long time on bug-fixing compiled code but NOT software.. Re-factor is safe
  • 5. Tests oriented development Start writing tests See the tests fail Write code to make the tests pass Pass the tests
  • 6. TDD ● We will write code to make tests work instead of writing some tests to check part of our code. ● High test coberture levels. ● If we need to do bug-fixing we will start writing some tests before making changes in the code. ● Developers with experience in that programming language.
  • 7. BDD ● No technical people can define our tests or help us to write them at least. ● Both technical and non technical people speak the same language. ● BDD doesn’t mean not to do unit testing. ● Our user stories will be completed when acceptance criterias are satisfied. ● User stories can be tracked in the code.
  • 8. Comparison Steps 1. We have the software requirements 2. We think about what we need to test 3. We write some tests 4. Tests will fail 5. We write code to pass the tests 6. We can do some re-factor Pros ● Code with quality ● We do not have unnecessary code ● We ensure our software works as expected. ● High test coberture level ● Low Bug-fixing time Steps 1. We have the software requirements 2. We write code for the requirements 3. We write some tests to check our software work 4. Run the tests 5. We’ll be happy when we have a test that pass (probably because we know the result before writing it) Pros ● We have code with some tests ● Some coberture level ● Highly probably software with no high quality Writing code before tests Test before coding
  • 9. Types of testing Unit Testing Integration Testing Acceptance Testing Stress Testing UI Testing Monkey Testing Load Testing ….. Testing, Testing, Testing Plenty types of testing… BUT we only need to do those testings that contribute to ensure the quality of our application
  • 10. Tests oriented development People not used to do test Just code but NOT Software Maybe Over tested applications... Software with QA and correct tests No tests We do not apply the correct testing Identify which testing are suitable for our application Code with lack of Testing
  • 11. Tips on Testing Do tests but just those ones that have sense for your code Identify what kind of testing should we do depending on the application Practicing TDD or NOT is up to the developers. They should never be forced to do it Enforce developers to do tests but do NOT establish a minimum test coberture
  • 12. Unit Testing What are the unit testing for? ● Ensure a piece of code or method works as expected ● Make us achieve high test coberture levels ● Easy for developers but not understable by non-technical people. ● Tests must be run without application deployments ● Mocks are required When do not we have to do unit testing? ● Front end applications ● We use MDA ● We use kind of code generation frameworks. When should we do unit testing? ● Complexed methods ● Algorithms and mathematics calculus
  • 13. Integration Testing When do not we have to do integration testing? ● Our application does only one basic thing such as a math operation or display hello world in the screen. When should we do integration testing? ● Most of architectures: WS, Batch, microservices ,... ● Backend developed in Javascript (e2e) ● User interfaces What are the integration testing for? ● Ensure our system works as expected. ● Does not really guarantee a high test coberture level. ● They must be run in environment similar to the production one. ● We could be forced to use mocks in case of we interact with third-party systems.
  • 14. Acceptance Testing What are the acceptance testing for? ● Make technical and non technical people speak the same language ● In scrum these tests would be the acceptance criterias defined for the user stories. ● If these are not defined by the Product Owner, we need his/her validation at least.Some people think these tests are unnecessary since integration testing could be enough. (And they could be right indeed) ● Natural language syntax (When, Then, And…. ) See below an example: Given 10 can of beers When I drink 2 of them Then I should have 8 in my fridge.
  • 15. Frameworks and tools (Java apps)
  • 16. Tests automation and CI Compile & Build Unit Tests Integration Tests Acceptance Tests ● The above flow represents the steps in the ci process. ● Each step above would be a different job in Jenkins (or whichever other CI tool) ● Each step will generate a report with the results ● We should not move to the next step in the flow in case of there were tests failing ● Developers must be able to run the tests from their local environment.
  • 17. Sample - e2e for nodejs REST API Code: https://github.com/wesovi/nodejs-authentication-api Technologies: Nodejs, mocha, supertest Snippet: it('should response BAD REQUEST & the error details when password is empty ', function (done) { var credentials = {username:"email@mail.com"}; request(app) .post('/accounts/authenticate') .send(credentials) .set('Content-Type', 'application/json') .expect('Content-Type', 'application/json; charset=utf-8') .expect(400) .expect({errors:[{ param: 'password', msg: 'required' }]}) .end(done); });