SlideShare a Scribd company logo
Testing for software engineers
1
BY: MOHAMMED ASHOUR
What does “Test” mean in our context?
2
SDLC
1- Requirements
2- Analysis
5- Testing
6- Deployment
3- Design
4- Implementation
3
What should we test?
Units, Groups, Guards, Performance, Old units working with the new ones
And some other stuff..
4
Unit testing
5
Here we try to look at the project as some LEGO
pieces stacked to each others forming the final
product, the Unit test goal here is to make sure
that every piece is in a perfect condition on it’s
own
6
7
I/P
I/P
I/P
O/P
O/P
O/P
Unit Testing toolbox
- Asserting tools/libraries
- Stubbing and spying tools/libraries
8
function sum(x, y) {
if( x == null || y == null) throw new Error("x and y should be
provided!!") //checking if all provided
if(isNaN(x) || isNaN(y))
{
throw new Error("x and y should be Numbers!!") //checking
values
} else{
return Number(x) + Number(y)
}
}
9
Example
Example
let sum = function sum(x, y) {
if( x == null || y == null) throw new
Error("x and y should be provided!!")
if(isNaN(x) || isNaN(y))
{
throw new Error("x and y should be
Numbers!!")
} else{
return Number(x) + Number(y)
}
}
10
describe('add function', function() {
it('should return 3 when the add 1 and 2', (done)=>{
expect(calc.sum(1,2)).to.eql(3)
done()
});
it("should throw error!!", (done)=>{
expect(()=>{calc.sum("a", "2")}).to.throw("x and y
should be Numbers!!")
done()
})
it("should throw that we should provide all the
parameters", (done)=>{
expect(()=>{calc.sum(1)}).to.throw("x and y should
be provided!!")
done()
})
});
calc
add function
✓ should return 3 when the add 1 and 2
✓ should throw error!!
✓ should throw that we should provide all the parameters
3 passing (18ms)
11
Test result
Integration testing
12
See it from the outside [Groups]
After testing each unit on it’s own. We
need to test their interaction with each
other, the flow that represent a higher level
function than one unit represents
13
14
I/P O/P
Assume that our web api
that have this route /add
listening to our Post
requests
15
let request = require("request")
let chai = require("chai")
let expect = chai.expect
describe("testing the add functionality",()=>{
it("should return response of status 200 and type json
with body 5",(done)=>{
let body = {"x":2,"y":3}
request.post("http://localhost:3000/add",{json:body},(err,
res, body)=>{
expect(res.statusCode).to.eql(200)
expect(body).to.eql({"result":5})
expect(res.headers['content-type']).to.eql("appli
cation/json; charset=utf-8")
done()
})
}) })
Security testing
16
Testing the security of the app is not mainly the
developer task, there should be a security team that
can perform different kinds of tests that help to
discover these security holes and fix them,
however, a good developer should have some
knowledge about the secure coding habits, and at
least have an idea about the common security
issues and how to avoid them
17
OWASP Top 10 list
Open Web Application Security Project :
A worldwide not-for-profit charitable organization focused on improving the
security of software
They publish a lot of materials mainly about software security and security
practices, they also make top 10 list of common vulnerabilities found in the current
online web apps every year
2017 Top 10 list :
https://www.owasp.org/images/7/72/OWASP_Top_10-2017_%28en%29.pdf.pdf
18
19
Checking your dependencies
Checking the packages/versions you use for known bugs or vulnerabilities , you
can use tools like snyk
https://snyk.io/
20
Performance testing
21
Before making your app live, you need to test its performance in terms of
● Speed (How much it take to respond/operate)
● Load handling (How many requests/operations it can take without going
down)
● The weak points in your system (I/O operations bottleneck ..etc)
● Your system reaction when -Suddenly- a spike hits it
You need to figure out the breaking points of your system and how much load it
can tolerate
22
Metric example
{
“Response time”
“Error rate”
“Peak response time”
“Memory/cpu utilization”
}
23
Are my tests needs to be tested with other tests?
24
Are my tests good enough?
Test quality gates
25
● Code review
● Test coverage
● Writing your tests before you write your code and make sure they all
fail at the first time -> TDD
Code review
26
Test Coverage
Report Example:
Calc
add function
✓ should return 3 when the add 1 and 2
✓ should throw error!!
✓ should throw that we should provide all the parameters
3 passing (14ms)
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 100 | 100 | 100 | 100 | |
calc.js | 100 | 100 | 100 | 100 | |
----------|----------|----------|----------|----------|-------------------|
27
Istanbuljs
Test coverage report
28
After removing a test case
29
Test driven development [TDD]
30
That was an introduction for the basics, see you soon
in much deeper discussion in each topic
31

More Related Content

What's hot

Unit Test Your Database
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your Database
David Wheeler
 
Qunit Java script Un
Qunit Java script UnQunit Java script Un
Qunit Java script Un
akanksha arora
 
Quick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineQuick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using Jasmine
Gil Fink
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
sgleadow
 
Python testing
Python  testingPython  testing
Python testing
John(Qiang) Zhang
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache Flex
Gert Poppe
 
Unit Testing in iOS
Unit Testing in iOSUnit Testing in iOS
Unit Testing in iOS
Long Weekend LLC
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
 
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialJAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
Anup Singh
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Sheeju Alex
 
20111018 boost and gtest
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtest
Will Shen
 
Hitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingHitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional Testing
Wiebe Elsinga
 
Front end unit testing using jasmine
Front end unit testing using jasmineFront end unit testing using jasmine
Front end unit testing using jasmine
Gil Fink
 
PgTAP Best Practices
PgTAP Best PracticesPgTAP Best Practices
PgTAP Best Practices
David Wheeler
 
unittest in 5 minutes
unittest in 5 minutesunittest in 5 minutes
unittest in 5 minutes
Ray Toal
 
Python unittest
Python unittestPython unittest
Python unittest
Felipe Ruhland
 
Agile Swift
Agile SwiftAgile Swift
Agile Swift
Godfrey Nolan
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
Andrea Paciolla
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontend
Frederic CABASSUT
 

What's hot (20)

Unit Test Your Database
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your Database
 
Qunit Java script Un
Qunit Java script UnQunit Java script Un
Qunit Java script Un
 
Quick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineQuick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using Jasmine
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
 
Python testing
Python  testingPython  testing
Python testing
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache Flex
 
Unit Testing in iOS
Unit Testing in iOSUnit Testing in iOS
Unit Testing in iOS
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
 
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialJAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
20111018 boost and gtest
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtest
 
Hitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingHitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional Testing
 
Front end unit testing using jasmine
Front end unit testing using jasmineFront end unit testing using jasmine
Front end unit testing using jasmine
 
PgTAP Best Practices
PgTAP Best PracticesPgTAP Best Practices
PgTAP Best Practices
 
unittest in 5 minutes
unittest in 5 minutesunittest in 5 minutes
unittest in 5 minutes
 
Python unittest
Python unittestPython unittest
Python unittest
 
Agile Swift
Agile SwiftAgile Swift
Agile Swift
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontend
 

Similar to Testing for software engineers

utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
Steven Feuerstein
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
pleeps
 
Ansible testing
Ansible   testingAnsible   testing
Ansible testing
Scott van Kalken
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End Development
All Things Open
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
Fwdays
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
vilniusjug
 
Upstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testingUpstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testing
DanWooster1
 
Describe's Full of It's
Describe's Full of It'sDescribe's Full of It's
Describe's Full of It's
Jim Lynch
 
Testing
TestingTesting
Java tutorials
Java tutorialsJava tutorials
Rspec
RspecRspec
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
elliando dias
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
Ran Mizrahi
 
Our challenge for Bulkload reliability improvement
Our challenge for Bulkload reliability  improvementOur challenge for Bulkload reliability  improvement
Our challenge for Bulkload reliability improvement
Satoshi Akama
 
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
SPB SQA Group
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
Eugene Dvorkin
 
Junit and testNG
Junit and testNGJunit and testNG
Junit and testNG
Марія Русин
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Core java
Core javaCore java
Core java
kasaragaddaslide
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
Tarunsingh198
 

Similar to Testing for software engineers (20)

utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Ansible testing
Ansible   testingAnsible   testing
Ansible testing
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End Development
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
 
Upstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testingUpstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testing
 
Describe's Full of It's
Describe's Full of It'sDescribe's Full of It's
Describe's Full of It's
 
Testing
TestingTesting
Testing
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
 
Rspec
RspecRspec
Rspec
 
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Our challenge for Bulkload reliability improvement
Our challenge for Bulkload reliability  improvementOur challenge for Bulkload reliability  improvement
Our challenge for Bulkload reliability improvement
 
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
 
Junit and testNG
Junit and testNGJunit and testNG
Junit and testNG
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
 
Core java
Core javaCore java
Core java
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 

Recently uploaded

哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 

Recently uploaded (20)

哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 

Testing for software engineers

  • 1. Testing for software engineers 1 BY: MOHAMMED ASHOUR
  • 2. What does “Test” mean in our context? 2
  • 3. SDLC 1- Requirements 2- Analysis 5- Testing 6- Deployment 3- Design 4- Implementation 3
  • 4. What should we test? Units, Groups, Guards, Performance, Old units working with the new ones And some other stuff.. 4
  • 6. Here we try to look at the project as some LEGO pieces stacked to each others forming the final product, the Unit test goal here is to make sure that every piece is in a perfect condition on it’s own 6
  • 8. Unit Testing toolbox - Asserting tools/libraries - Stubbing and spying tools/libraries 8
  • 9. function sum(x, y) { if( x == null || y == null) throw new Error("x and y should be provided!!") //checking if all provided if(isNaN(x) || isNaN(y)) { throw new Error("x and y should be Numbers!!") //checking values } else{ return Number(x) + Number(y) } } 9 Example
  • 10. Example let sum = function sum(x, y) { if( x == null || y == null) throw new Error("x and y should be provided!!") if(isNaN(x) || isNaN(y)) { throw new Error("x and y should be Numbers!!") } else{ return Number(x) + Number(y) } } 10 describe('add function', function() { it('should return 3 when the add 1 and 2', (done)=>{ expect(calc.sum(1,2)).to.eql(3) done() }); it("should throw error!!", (done)=>{ expect(()=>{calc.sum("a", "2")}).to.throw("x and y should be Numbers!!") done() }) it("should throw that we should provide all the parameters", (done)=>{ expect(()=>{calc.sum(1)}).to.throw("x and y should be provided!!") done() }) });
  • 11. calc add function ✓ should return 3 when the add 1 and 2 ✓ should throw error!! ✓ should throw that we should provide all the parameters 3 passing (18ms) 11 Test result
  • 13. See it from the outside [Groups] After testing each unit on it’s own. We need to test their interaction with each other, the flow that represent a higher level function than one unit represents 13
  • 15. Assume that our web api that have this route /add listening to our Post requests 15 let request = require("request") let chai = require("chai") let expect = chai.expect describe("testing the add functionality",()=>{ it("should return response of status 200 and type json with body 5",(done)=>{ let body = {"x":2,"y":3} request.post("http://localhost:3000/add",{json:body},(err, res, body)=>{ expect(res.statusCode).to.eql(200) expect(body).to.eql({"result":5}) expect(res.headers['content-type']).to.eql("appli cation/json; charset=utf-8") done() }) }) })
  • 17. Testing the security of the app is not mainly the developer task, there should be a security team that can perform different kinds of tests that help to discover these security holes and fix them, however, a good developer should have some knowledge about the secure coding habits, and at least have an idea about the common security issues and how to avoid them 17
  • 18. OWASP Top 10 list Open Web Application Security Project : A worldwide not-for-profit charitable organization focused on improving the security of software They publish a lot of materials mainly about software security and security practices, they also make top 10 list of common vulnerabilities found in the current online web apps every year 2017 Top 10 list : https://www.owasp.org/images/7/72/OWASP_Top_10-2017_%28en%29.pdf.pdf 18
  • 19. 19
  • 20. Checking your dependencies Checking the packages/versions you use for known bugs or vulnerabilities , you can use tools like snyk https://snyk.io/ 20
  • 22. Before making your app live, you need to test its performance in terms of ● Speed (How much it take to respond/operate) ● Load handling (How many requests/operations it can take without going down) ● The weak points in your system (I/O operations bottleneck ..etc) ● Your system reaction when -Suddenly- a spike hits it You need to figure out the breaking points of your system and how much load it can tolerate 22
  • 23. Metric example { “Response time” “Error rate” “Peak response time” “Memory/cpu utilization” } 23
  • 24. Are my tests needs to be tested with other tests? 24 Are my tests good enough?
  • 25. Test quality gates 25 ● Code review ● Test coverage ● Writing your tests before you write your code and make sure they all fail at the first time -> TDD
  • 27. Test Coverage Report Example: Calc add function ✓ should return 3 when the add 1 and 2 ✓ should throw error!! ✓ should throw that we should provide all the parameters 3 passing (14ms) ----------|----------|----------|----------|----------|-------------------| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ----------|----------|----------|----------|----------|-------------------| All files | 100 | 100 | 100 | 100 | | calc.js | 100 | 100 | 100 | 100 | | ----------|----------|----------|----------|----------|-------------------| 27 Istanbuljs
  • 29. After removing a test case 29
  • 31. That was an introduction for the basics, see you soon in much deeper discussion in each topic 31