Tho Q Luong
Hanoi, June 28, 2014
2
 Assuming listeners know:
 Fundamentals of OOP
 Basics of Java and PHP
 Convention in this talk: when saying “test”
I mean “test automation”, “automated test”
(vs. manual test)
Before Outline
Outline
3
• Introduction
• Testing Framework: JUnit
• Best Practice to Implement Unit Test
• FAQ
• Conclusion
Introduction
4
 Cool things that we were learnt in the school:
1. Algorithm and programming
2. UML and design
3. Test
4. Software project management
 Must utilize all of them to create a good app?
Introduction
5
 Definition of test automation:
“Test automation is the use of special software to control
the execution of tests and the comparison of actual
outcomes with predicted outcomes”
6
test and me: a love story
Introduction
Test and me
7
 Coding business services
 Try my best but my code still
has serious errors
 Developers in GUI layer
complain
 Testers complain
 And the world hates me
 Q: How to let they know I
am a good developer ?
 A: writing unit test
Business Service
GUI
Database
Three-tier application
Test and me: benefits of testing
8
 Save my life
 Improve product quality
 Save my energy when:
 Modify source code:
 Maintain, upgrade
 Fix bugs
 Identify bugs
 Avoid my silly and repetitive bugs
Testing Framework: JUnit
9
Testing Framework: JUnit
10
 JUnit is an unit testing framework for Java
 The most popular testing framework for Java
 Ported to other languages: CPP, PHP, C#, Ruby,
Javascript … (21 languages)
 Supported in IDEs: Netbeans, Eclipse
 Simple and easy to use
Testing Framework: JUnit
11
Test Class
Test Result
Expected Outcome
Testing Framework: JUnit
12
 Suite:
 Group tests from many classes
 Run test group as a single test execution
 Category:
 Group tests that are marked in sepecific classes
 Run test group as a single test execution
JUnit summary
13
 Keywords:
1. Assert.assertXXX()
2. @BeforeClass
3. @AfterClass
4. @Before
5. @After
6. @Test
7. Suite
8. Category
Best Practice
to
Implement Unit Test
14
Best Practice
15
 06 steps:
1. Identify test class, test method
example: to test UserService and AccessControlService:
create UserServiceTest with two method:
1. testUser(): CRUD and Find
2. testAccessControl(): assign, unassign and check permission
Best Practice
16
 06 steps:
2. Describe test
Best Practice
17
 06 steps: 3 + 4
3. Implement test: should prefix variables by step name
4. Join test into Single Test Category and run
Best Practice
18
 06 steps: 5 + 6
5. Create new suite or category if necessary
6. Join test into suitable suite(s) and/or category(s) and
run this suite(s) and/or category(s)
DEMO:
1. Single Test Category
2. Test Low Layer (Services)
3. Test High Layer (Controllers)
4. Load Test
----------
FAQ
19
FAQ
20
 Q: what is test-driven development?
 A: “is a software development process that replies on
the repetion of very short development cycle:
1. Add a test
2. Run all tests and see if the new one fails
3. Write some code
4. Run tests
5. Refactor code
And repeat”
 Related to the test-first programming concepts of XP
FAQ
21
 Q: It is already 100K LOC, with no tests. Is it over?
 A: NO, this is the good time to try writing tests
FAQ
22
 Q: what is mock object?
 A: Simulate objects that mimic behavior of real objects
 Used in a unit test when real object is impracticial
 Q: have you ever used a mock framework in test?
 A: NO
 Q: what are disadvantages of writing unit tests?
 A: Slow down the release time
FAQ
23
 Q: Do good developers not need to write test?
 NO, because good developers will work with more
sophisticated projects
 Q: Do good products have good tests and vice
versa?
 Maybe YES
Conclusion
24
 Test Automation lengthens coder life
and improves software quality
 JUnit is easy to use
 Let start writing unit test to build a better life!
Thank you!
25

More Related Content

PDF
Python and test
PPT
Unit testing
PPTX
Testing JavaScript Applications
PPTX
JavaScript Unit Testing
PPT
Unit Testing
PPTX
Unit testing & TDD concepts with best practice guidelines.
PPTX
Unit testing
PDF
An Introduction to Test Driven Development
Python and test
Unit testing
Testing JavaScript Applications
JavaScript Unit Testing
Unit Testing
Unit testing & TDD concepts with best practice guidelines.
Unit testing
An Introduction to Test Driven Development

What's hot (19)

PDF
Test driven development
PPTX
Test-Driven Development
PDF
Engaging IV&V Testing Services for Agile Projects
PDF
Test Driven Development (TDD)
PPTX
Test Driven Development (TDD) Preso 360|Flex 2010
PPTX
Test driven development in .Net - 2010 + Eclipse
PPTX
Software Quality via Unit Testing
PPT
TDD (Test Driven Design)
PDF
Agile Programming Systems # TDD intro
DOCX
TestDrivenDeveloment
PDF
Test Driven Development
PPTX
Unit Testing in Action - C#, NUnit, and Moq
PDF
Android Devops : Master Continuous Integration and Delivery
PPTX
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
PDF
Testing practicies not only in scala
PPTX
Test driven development
PPTX
Understanding Unit Testing
PPTX
Unit Tests And Automated Testing
Test driven development
Test-Driven Development
Engaging IV&V Testing Services for Agile Projects
Test Driven Development (TDD)
Test Driven Development (TDD) Preso 360|Flex 2010
Test driven development in .Net - 2010 + Eclipse
Software Quality via Unit Testing
TDD (Test Driven Design)
Agile Programming Systems # TDD intro
TestDrivenDeveloment
Test Driven Development
Unit Testing in Action - C#, NUnit, and Moq
Android Devops : Master Continuous Integration and Delivery
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Testing practicies not only in scala
Test driven development
Understanding Unit Testing
Unit Tests And Automated Testing
Ad

Similar to Introduction to test automation in java and php (20)

PPTX
Presentation sem 1.pptx
DOCX
Test driven development and unit testing with examples in C++
PDF
SE2_Lec 21_ TDD and Junit
PPTX
Unit Testing
PDF
Unit testing (eng)
PPTX
DotNet unit testing training
PPT
Junit Interview Questions-ppt
PPTX
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
PPTX
Software Testing interview - Q&A and tips
PPTX
TDD - Agile
PPTX
SE2018_Lec 20_ Test-Driven Development (TDD)
PPTX
Software presentation
PPT
Unit testing php-unit - phing - selenium_v2
PPT
SE2011_10.ppt
PPT
Google test training
PPT
Test Driven Development
PPT
Automated Software Testing Framework Training by Quontra Solutions
PPTX
Tools for Software Testing
PPTX
Test Driven Development
PPTX
Making the Unstable Stable - An Intro To Testing
Presentation sem 1.pptx
Test driven development and unit testing with examples in C++
SE2_Lec 21_ TDD and Junit
Unit Testing
Unit testing (eng)
DotNet unit testing training
Junit Interview Questions-ppt
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Software Testing interview - Q&A and tips
TDD - Agile
SE2018_Lec 20_ Test-Driven Development (TDD)
Software presentation
Unit testing php-unit - phing - selenium_v2
SE2011_10.ppt
Google test training
Test Driven Development
Automated Software Testing Framework Training by Quontra Solutions
Tools for Software Testing
Test Driven Development
Making the Unstable Stable - An Intro To Testing
Ad

Recently uploaded (20)

PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
Microsoft Office 365 Crack Download Free
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Guide to Food Delivery App Development.pdf
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
AI Guide for Business Growth - Arna Softech
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PDF
AI-Powered Fuzz Testing: The Future of QA
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
E-Commerce Website Development Companyin india
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
PDF
Visual explanation of Dijkstra's Algorithm using Python
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Microsoft Office 365 Crack Download Free
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
GSA Content Generator Crack (2025 Latest)
CNN LeNet5 Architecture: Neural Networks
Guide to Food Delivery App Development.pdf
Tech Workshop Escape Room Tech Workshop
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Download Adobe Photoshop Crack 2025 Free
AI Guide for Business Growth - Arna Softech
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
AI-Powered Fuzz Testing: The Future of QA
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
E-Commerce Website Development Companyin india
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
Visual explanation of Dijkstra's Algorithm using Python
How to Use SharePoint as an ISO-Compliant Document Management System
Practical Indispensable Project Management Tips for Delivering Successful Exp...
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业

Introduction to test automation in java and php

  • 1. Tho Q Luong Hanoi, June 28, 2014
  • 2. 2  Assuming listeners know:  Fundamentals of OOP  Basics of Java and PHP  Convention in this talk: when saying “test” I mean “test automation”, “automated test” (vs. manual test) Before Outline
  • 3. Outline 3 • Introduction • Testing Framework: JUnit • Best Practice to Implement Unit Test • FAQ • Conclusion
  • 4. Introduction 4  Cool things that we were learnt in the school: 1. Algorithm and programming 2. UML and design 3. Test 4. Software project management  Must utilize all of them to create a good app?
  • 5. Introduction 5  Definition of test automation: “Test automation is the use of special software to control the execution of tests and the comparison of actual outcomes with predicted outcomes”
  • 6. 6 test and me: a love story Introduction
  • 7. Test and me 7  Coding business services  Try my best but my code still has serious errors  Developers in GUI layer complain  Testers complain  And the world hates me  Q: How to let they know I am a good developer ?  A: writing unit test Business Service GUI Database Three-tier application
  • 8. Test and me: benefits of testing 8  Save my life  Improve product quality  Save my energy when:  Modify source code:  Maintain, upgrade  Fix bugs  Identify bugs  Avoid my silly and repetitive bugs
  • 10. Testing Framework: JUnit 10  JUnit is an unit testing framework for Java  The most popular testing framework for Java  Ported to other languages: CPP, PHP, C#, Ruby, Javascript … (21 languages)  Supported in IDEs: Netbeans, Eclipse  Simple and easy to use
  • 11. Testing Framework: JUnit 11 Test Class Test Result Expected Outcome
  • 12. Testing Framework: JUnit 12  Suite:  Group tests from many classes  Run test group as a single test execution  Category:  Group tests that are marked in sepecific classes  Run test group as a single test execution
  • 13. JUnit summary 13  Keywords: 1. Assert.assertXXX() 2. @BeforeClass 3. @AfterClass 4. @Before 5. @After 6. @Test 7. Suite 8. Category
  • 15. Best Practice 15  06 steps: 1. Identify test class, test method example: to test UserService and AccessControlService: create UserServiceTest with two method: 1. testUser(): CRUD and Find 2. testAccessControl(): assign, unassign and check permission
  • 16. Best Practice 16  06 steps: 2. Describe test
  • 17. Best Practice 17  06 steps: 3 + 4 3. Implement test: should prefix variables by step name 4. Join test into Single Test Category and run
  • 18. Best Practice 18  06 steps: 5 + 6 5. Create new suite or category if necessary 6. Join test into suitable suite(s) and/or category(s) and run this suite(s) and/or category(s) DEMO: 1. Single Test Category 2. Test Low Layer (Services) 3. Test High Layer (Controllers) 4. Load Test ----------
  • 20. FAQ 20  Q: what is test-driven development?  A: “is a software development process that replies on the repetion of very short development cycle: 1. Add a test 2. Run all tests and see if the new one fails 3. Write some code 4. Run tests 5. Refactor code And repeat”  Related to the test-first programming concepts of XP
  • 21. FAQ 21  Q: It is already 100K LOC, with no tests. Is it over?  A: NO, this is the good time to try writing tests
  • 22. FAQ 22  Q: what is mock object?  A: Simulate objects that mimic behavior of real objects  Used in a unit test when real object is impracticial  Q: have you ever used a mock framework in test?  A: NO  Q: what are disadvantages of writing unit tests?  A: Slow down the release time
  • 23. FAQ 23  Q: Do good developers not need to write test?  NO, because good developers will work with more sophisticated projects  Q: Do good products have good tests and vice versa?  Maybe YES
  • 24. Conclusion 24  Test Automation lengthens coder life and improves software quality  JUnit is easy to use  Let start writing unit test to build a better life!