Sharing session with topic : Software Testing
Workshop Black Box Testing with Jmeter, Automated Testing with JBehave & Serenity and also Unit Testing with Spring Boot
Thanks to Blibli.com for giving me this topic
2. About Me
Name : Ahmad Widardi
Email : awidardi@gmail.com
LinkedIn : bit.ly/awidardi
Interests : Competitive Programming, Cyber Security, Software Engineering
3. Outline
● Introduction to Software Testing
● Demo Manual Black Box Testing with Jmeter
● Demo Automated Black Box Testing with JBehave + Serenity
● Demo Manual White Box Unit Testing with Spring
5. Why Testing?
● Software ALWAYS contains bugs, even the best developer will makes mistake someday
● Many bugs are hard to realized and can cause software failures
● Software Failures can also cost money, time, and much energy to solve that
● Testing assures the quality of a software and accelerates software development
6. Requirement vs Spesification
● Requirements is the input to a development phase
● Specification is the output to a development phase
7. Validation vs Verification
● Validation : The Software should confirms to its specification ( output )
● Validation : “Are we building the product right?”
● Verification : The Software should confirms to its requirement ( input )
● Verification : “Are we building the right product?”
9. Testing Methodology
● Testing consists into 2 types of methodology :
○ Black Box Testing
○ White Box Testing
● Keyword :
○ Black Box Testing : done without knowing the code
○ White Box Testing : done by analyzing the code
10. Black Box Testing
● Specification-based testing ( output - oriented )
● No knowledge of internal code
● Techniques :
○ Equivalence Partitioning
○ Boundary Value Analysis
○ Decision Table
○ State Transition
● Sources : https://www.youtube.com/watch?v=7T4DGEXht40
11. Black Box Testing
● Equivalence Partitioning : dividing test conditions
○ Case : a field which accept numeric values
○ Test conditions:
■ Enter numeric value
■ Enter alpha-numeric value
■ Enter alphabet
● Boundary Value Analysis : use test conditions to get valid boundaries and invalid boundaries
○ Case : a field which accept numeric values from 15 to 25
○ Test conditions :
■ Take boundaries -1, boundaries, and boundaries +1
■ So we’ll test 14, 15, 16, 24, 25, and 26
12. ● Decision Table : Deal with combination of inputs and focusing on conditions ( as input ) and
actions ( as output )
● State Transition
○ Pick test cases from an application where we need to test different system transition
○ Can be applied when app gives different output for the same input, depending on what has happened in the earlier
state
Black Box Testing
13. White Box Testing
● Structure-based testing
● Knowledge of internal code in required
● Techniques :
○ Statement Coverage : each statement of code should be tested at least once
○ Branch Coverage : each branching method / if-else should be tested for all cases
○ Condition Coverage : each possible condition should be tested
○ etc...
● Sources : https://www.youtube.com/watch?v=3bJcvBLJViQ
15. Testing Levels
● Testing levels consists into 4 types :
○ Unit Testing
■ White Box, tested by Developers
○ Integration Testing
■ White Box / Black Box, tested by Developers
○ System Testing
■ Black Box / White Box, tested by Testers
○ Acceptance Testing
■ Black Box, tested by Users
16. Unit Test
● Find bugs or errors in level of function, classes, etc
● The most basic testing that should be done by the developer itself
● Ensure that the functions, classes, etc are working well without error
● Of course, it is white box testing
17. Integration Testing
● After all components ( functions, methods, classes, etc ) are tested with unit test, we need to
do integration test to make sure that the communication between controller - database -
service, or communication between interfaces, even communication between different
microservices are working well
● Should be done by developers
● From its definition, we can call this is white box testing, but can be called black box since
maybe we don’t know the code we will integrate with
18. System Testing
● Unit test completed, system is already integrated
● Usually test something with some requirement
● Example : Stress Testing, Performance Testing, Usability, etc
● Done by Testers ( can be QA )
● We don’t need to know the code inside, so usually it is Black Box Testing
19. Acceptance Testing
● Unit test completed, system is already integrated
● Usually test something with some requirement
● Done by Users / Customer
● Since it is tested by Customer, it is Black Box Testing
22. Load Testing 1 ( part 1 )
● Open jmeter.sh ( inside bin folder )
● Create new Test Plan ( Ctrl + N )
● Customize whatever you want for the name of test plan
● Right click at Test Plan and choose Add -> Threads (Users) -> Thread Group
● Thread means number of users that will simulate the test
● Threading
○ Choose the Thread Group, customize its name
○ Set Action to be taken after a Sampler error to Continue
○ Number of Threads : number of users that simulate the test
○ Ramp-Up period : total time needed for all users send requests completely
○ Loop Count : total loop for each user
23. Load Testing 1 ( part 2 )
● HTTP Request :
○ From Thread Group add sampler -> Http Request
○ Set server name to ugm.ac.id
● Capturing the results
○ From Thread Group add Listener -> View Results in Table
○ From Thread Group add Listener -> Graph Results
24. Load Testing 1 ( part 3 )
● Let’s try with these settings
● In Thread Group try to set with this following setting
○ Setting 1
■ Number of Threads : 1
■ Ramp-Up Period : 1
■ Loop Count : 1
■ After that, start itu ( click green play button )
■ See the result
■ Clear all results to clear the result
○ Try that setting for ( 10, 60, 4 ) and ( 1000, 1, 1000 )
■ Note ( a, b, c ) means ( Num of threads, ramp-up period, loop count )