SlideShare a Scribd company logo
1 of 10
Unit Test Programming -
Session 1
Amin Arab
Sharivar 98
Tosan
https://www.linkedin.com/in/amin-arab-a653b13a/
ISTQB
V Model
Test Pyramid
JUnit
• Maven Dependencies
• Basic Annotation of Test
• Assertion
• Property
• List
• Map
• Expected Exceptions Test
• Parameterized Test
• Timeout Test
• Organize Test
• Suite Test
• Category Test
• Ignore a Test
• Order Test
JUnit vs TestNG
Feature JUnit 4 TestNG
test annotation @Test @Test
run before all tests in this suite have run — @BeforeSuite
run after all tests in this suite have run — @AfterSuite
run before the test — @BeforeTest
run after the test — @AfterTest
run before the first test method that belongs to any of these
groups is invoked
— @BeforeGroups
run after the last test method that belongs to any of these groups
is invoked
— @AfterGroups
run before the first test method in the current class is invoked @BeforeClass @BeforeClass
run after all the test methods in the current class have been run @AfterClass @AfterClass
run before each test method @Before @BeforeMethod
run after each test method @After @AfterMethod
ignore test @ignore @Test(enbale=false)
expected exception @Test(expected = ArithmeticException.class) @Test(expectedExceptions = ArithmeticException.class)
timeout @Test(timeout = 1000) @Test(timeout = 1000)
JUnit 5
• Features
• The entire framework was contained in a single jar library
• JUnit 5 allows multiple runners to work simultaneously
• JUnit 5 makes good use of Java 8 features
• Differences
• JUnit Platform – this module scopes all the extension frameworks we might
be interested in test execution, discovery, and reporting
• JUnit Vintage – this module allows backward compatibility with JUnit 4 or
even JUnit 3
Mocking
• Hello mocking , goodbey Weblogic
• RunWith
• InjectMocks
• Mock
• Adding Behavior
• Verifying Behavior
• Expecting Calls
• PowerMock
• Set Private property
References
• https://www.mkyong.com/tutorials/junit-tutorials/
• https://www.baeldung.com/junit-5-migration
Codes
• https://github.com/aminarab/JUnit-training
• https://github.com/aminarab/Mockito-Training

More Related Content

What's hot

Implementing TDD in for .net Core applications
Implementing TDD in for .net Core applicationsImplementing TDD in for .net Core applications
Implementing TDD in for .net Core applicationsAhmad Kazemi
 
Unit Testing with Python
Unit Testing with PythonUnit Testing with Python
Unit Testing with PythonMicroPyramid .
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1Anand kalla
 
Winning the battle against Automated testing
Winning the battle against Automated testingWinning the battle against Automated testing
Winning the battle against Automated testingElena Laskavaia
 
Unit testing in Force.com platform
Unit testing in Force.com platformUnit testing in Force.com platform
Unit testing in Force.com platformChamil Madusanka
 
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...iMasters
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitweili_at_slideshare
 
Test-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftTest-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftAmey Tavkar
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And MockingJoe Wilson
 
Unit testing (workshop)
Unit testing (workshop)Unit testing (workshop)
Unit testing (workshop)Foyzul Karim
 
Moq presentation
Moq presentationMoq presentation
Moq presentationLynxStar
 
Unit testing in swift 2 - The before & after story
Unit testing in swift 2 - The before & after storyUnit testing in swift 2 - The before & after story
Unit testing in swift 2 - The before & after storyJorge Ortiz
 
Unit Testing Using N Unit
Unit Testing Using N UnitUnit Testing Using N Unit
Unit Testing Using N UnitGaurav Arora
 
Unit testing using jasmine in Javascript
Unit testing using jasmine in JavascriptUnit testing using jasmine in Javascript
Unit testing using jasmine in JavascriptDeepak More
 
Intro To Unit and integration Testing
Intro To Unit and integration TestingIntro To Unit and integration Testing
Intro To Unit and integration TestingPaul Churchward
 

What's hot (20)

Implementing TDD in for .net Core applications
Implementing TDD in for .net Core applicationsImplementing TDD in for .net Core applications
Implementing TDD in for .net Core applications
 
Unit Testing with Python
Unit Testing with PythonUnit Testing with Python
Unit Testing with Python
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
 
Winning the battle against Automated testing
Winning the battle against Automated testingWinning the battle against Automated testing
Winning the battle against Automated testing
 
Unit testing in Force.com platform
Unit testing in Force.com platformUnit testing in Force.com platform
Unit testing in Force.com platform
 
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
 
Action filter
Action filterAction filter
Action filter
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
Tdd in swift
Tdd in swiftTdd in swift
Tdd in swift
 
Test-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftTest-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in Swift
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
Unit testing (workshop)
Unit testing (workshop)Unit testing (workshop)
Unit testing (workshop)
 
Moq presentation
Moq presentationMoq presentation
Moq presentation
 
Unit testing in swift 2 - The before & after story
Unit testing in swift 2 - The before & after storyUnit testing in swift 2 - The before & after story
Unit testing in swift 2 - The before & after story
 
Unit Testing Using N Unit
Unit Testing Using N UnitUnit Testing Using N Unit
Unit Testing Using N Unit
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
Unit testing using jasmine in Javascript
Unit testing using jasmine in JavascriptUnit testing using jasmine in Javascript
Unit testing using jasmine in Javascript
 
JMockit
JMockitJMockit
JMockit
 
Intro To Unit and integration Testing
Intro To Unit and integration TestingIntro To Unit and integration Testing
Intro To Unit and integration Testing
 

Similar to Unit Test Programming - Session 1

TestNG introduction
TestNG introductionTestNG introduction
TestNG introductionDenis Bazhin
 
20070514 introduction to test ng and its application for test driven gui deve...
20070514 introduction to test ng and its application for test driven gui deve...20070514 introduction to test ng and its application for test driven gui deve...
20070514 introduction to test ng and its application for test driven gui deve...Will Shen
 
TestNG vs JUnit: cease fire or the end of the war
TestNG vs JUnit: cease fire or the end of the warTestNG vs JUnit: cease fire or the end of the war
TestNG vs JUnit: cease fire or the end of the warOleksiy Rezchykov
 
TestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingTestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingBethmi Gunasekara
 
How To Use Ignore Annotation In JUnit
How To Use Ignore Annotation In JUnitHow To Use Ignore Annotation In JUnit
How To Use Ignore Annotation In JUnitBugRaptors
 
Agile Testing Strategy
Agile Testing StrategyAgile Testing Strategy
Agile Testing Strategytharindakasun
 
Formulating Agile Testing Strategy
Formulating Agile Testing StrategyFormulating Agile Testing Strategy
Formulating Agile Testing StrategyTharinda Liyanage
 
MythBusters: Functional Testing Edition
MythBusters: Functional Testing EditionMythBusters: Functional Testing Edition
MythBusters: Functional Testing EditionSmartBear
 
Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5Jimmy Lu
 

Similar to Unit Test Programming - Session 1 (20)

Test ng
Test ngTest ng
Test ng
 
TestNG introduction
TestNG introductionTestNG introduction
TestNG introduction
 
Junit
JunitJunit
Junit
 
20070514 introduction to test ng and its application for test driven gui deve...
20070514 introduction to test ng and its application for test driven gui deve...20070514 introduction to test ng and its application for test driven gui deve...
20070514 introduction to test ng and its application for test driven gui deve...
 
TestNG vs JUnit: cease fire or the end of the war
TestNG vs JUnit: cease fire or the end of the warTestNG vs JUnit: cease fire or the end of the war
TestNG vs JUnit: cease fire or the end of the war
 
TestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingTestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit Testing
 
TestNG
TestNGTestNG
TestNG
 
testng
testngtestng
testng
 
Selenium TestNG
Selenium TestNGSelenium TestNG
Selenium TestNG
 
Test ng tutorial
Test ng tutorialTest ng tutorial
Test ng tutorial
 
Introduction to JUnit
Introduction to JUnitIntroduction to JUnit
Introduction to JUnit
 
TestNG vs. JUnit4
TestNG vs. JUnit4TestNG vs. JUnit4
TestNG vs. JUnit4
 
How To Use Ignore Annotation In JUnit
How To Use Ignore Annotation In JUnitHow To Use Ignore Annotation In JUnit
How To Use Ignore Annotation In JUnit
 
Testing with Junit4
Testing with Junit4Testing with Junit4
Testing with Junit4
 
Agile Testing Strategy
Agile Testing StrategyAgile Testing Strategy
Agile Testing Strategy
 
Formulating Agile Testing Strategy
Formulating Agile Testing StrategyFormulating Agile Testing Strategy
Formulating Agile Testing Strategy
 
MythBusters: Functional Testing Edition
MythBusters: Functional Testing EditionMythBusters: Functional Testing Edition
MythBusters: Functional Testing Edition
 
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
 
Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5
 
Junit
JunitJunit
Junit
 

More from Amin Arab

JavaEE Session 3
JavaEE Session 3JavaEE Session 3
JavaEE Session 3Amin Arab
 
JavaEE 8 Introduction - Session 3
JavaEE 8 Introduction - Session 3JavaEE 8 Introduction - Session 3
JavaEE 8 Introduction - Session 3Amin Arab
 
JavaEE 8 Introduction - Session 2
JavaEE 8 Introduction - Session 2JavaEE 8 Introduction - Session 2
JavaEE 8 Introduction - Session 2Amin Arab
 
JavaEE 8 Introduction - Session 1
JavaEE 8 Introduction - Session 1JavaEE 8 Introduction - Session 1
JavaEE 8 Introduction - Session 1Amin Arab
 
Unit test programming session 2
Unit test programming   session 2Unit test programming   session 2
Unit test programming session 2Amin Arab
 
Micro service session 2
Micro service   session 2Micro service   session 2
Micro service session 2Amin Arab
 
Micro service session 1
Micro service   session 1Micro service   session 1
Micro service session 1Amin Arab
 

More from Amin Arab (10)

Session 4
Session 4Session 4
Session 4
 
JavaEE Session 3
JavaEE Session 3JavaEE Session 3
JavaEE Session 3
 
JavaEE 8 Introduction - Session 3
JavaEE 8 Introduction - Session 3JavaEE 8 Introduction - Session 3
JavaEE 8 Introduction - Session 3
 
JavaEE 8 Introduction - Session 2
JavaEE 8 Introduction - Session 2JavaEE 8 Introduction - Session 2
JavaEE 8 Introduction - Session 2
 
JavaEE 8 Introduction - Session 1
JavaEE 8 Introduction - Session 1JavaEE 8 Introduction - Session 1
JavaEE 8 Introduction - Session 1
 
Unit test programming session 2
Unit test programming   session 2Unit test programming   session 2
Unit test programming session 2
 
Micro service session 2
Micro service   session 2Micro service   session 2
Micro service session 2
 
Micro service session 1
Micro service   session 1Micro service   session 1
Micro service session 1
 
Docker
DockerDocker
Docker
 
Dev ops
Dev opsDev ops
Dev ops
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

Unit Test Programming - Session 1

  • 1. Unit Test Programming - Session 1 Amin Arab Sharivar 98 Tosan https://www.linkedin.com/in/amin-arab-a653b13a/
  • 5. JUnit • Maven Dependencies • Basic Annotation of Test • Assertion • Property • List • Map • Expected Exceptions Test • Parameterized Test • Timeout Test • Organize Test • Suite Test • Category Test • Ignore a Test • Order Test
  • 6. JUnit vs TestNG Feature JUnit 4 TestNG test annotation @Test @Test run before all tests in this suite have run — @BeforeSuite run after all tests in this suite have run — @AfterSuite run before the test — @BeforeTest run after the test — @AfterTest run before the first test method that belongs to any of these groups is invoked — @BeforeGroups run after the last test method that belongs to any of these groups is invoked — @AfterGroups run before the first test method in the current class is invoked @BeforeClass @BeforeClass run after all the test methods in the current class have been run @AfterClass @AfterClass run before each test method @Before @BeforeMethod run after each test method @After @AfterMethod ignore test @ignore @Test(enbale=false) expected exception @Test(expected = ArithmeticException.class) @Test(expectedExceptions = ArithmeticException.class) timeout @Test(timeout = 1000) @Test(timeout = 1000)
  • 7. JUnit 5 • Features • The entire framework was contained in a single jar library • JUnit 5 allows multiple runners to work simultaneously • JUnit 5 makes good use of Java 8 features • Differences • JUnit Platform – this module scopes all the extension frameworks we might be interested in test execution, discovery, and reporting • JUnit Vintage – this module allows backward compatibility with JUnit 4 or even JUnit 3
  • 8. Mocking • Hello mocking , goodbey Weblogic • RunWith • InjectMocks • Mock • Adding Behavior • Verifying Behavior • Expecting Calls • PowerMock • Set Private property