Nowadays, these tests by using WebDriver are useful in regression testing but we need more efficient feedback to developers if backend has any issues. In this topic, we will introduce the way to be approach the automated API and learn the technical automation with Retrofit & Cucumber.
Our workshop will be including the following:
1. Warm Up - Some questions to interact with audience
2. Context - The Future of Software QA and Test Automation
3. Techniques - Introduce Cucumber & Retrofit
4. Demo - Project Demo and Mini Demo
5. Practices - Assignment for audience - Group activities
6. Q&A
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
[DN Scrum Breakfast] API Automation Testing Using Retrofit & Cucumber
1. API Automation Testing
Using Retrofit & Cucumber
June 2, 2018
Axon Active Vietnam - https://www.axonactive.com
Axon Active Da Nang - Axon Vibe Automation Team
2. June 2, 2018 Basel Department - Automation Team 2
Axon Vibe Automation Team
3. Agenda
• Context – How the Future of Test Automation Affects You
• Techniques – Introduce Cucumber & Retrofit 2
• Demo – Project Demo and Mini Demo
• Practices – Assignment for Audience
• Q&A
June 2, 2018 Basel Department - Automation Team 3
8. Cucumber
Examples
Scenario: get all articles
When requesting get all articles
Then the request get all articles successfully
Scenario: create an article
When requesting create an article
Then the request creating an article successfully
June 2, 2018 Basel Department - Automation Team 8
9. Cucumber
What are the benefits?
• It is helpful to involve business
stakeholders who can't easily read
code
• Cucumber focuses on end-user
experience
• Style of writing tests allow for
easier reuse of code in the tests
• Quick and easy set up and
execution
• Efficient tool for testing
June 2, 2018 Basel Department - Automation Team 9
10. Retrofit 2
What is Retrofit?
• Retrofit is a type-safe HTTP client for Android
and Java
• Developed by Square, Inc.
June 2, 2018 Basel Department - Automation Team 10
11. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 11
12. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 12
13. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 13
14. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 14
• Interface to declare HTTP request
• Object to map with returned JSON data
• Retrofit builder
15. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 15
Interface
16. How to use Retrofit
Interface
June 2, 2018 Basel Department - Automation Team 16
17. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 17
• Interface to declare HTTP request
• Object to map with returned JSON data
• Retrofit builder
18. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 18
19. How to use Retrofit
Object
June 2, 2018 Basel Department - Automation Team 19
20. How to use Retrofit
June 2, 2018 Basel Department - Automation Team 20
• Interface to declare HTTP request
• Object to map with returned JSON data
• Retrofit builder
21. How to use Retrofit
Adapter
June 2, 2018 Basel Department - Automation Team 21
22. How to use Retrofit
Interface
June 2, 2018 Basel Department - Automation Team 22
23. How to use Retrofit
Instantiate an implement of interface class
June 2, 2018 Basel Department - Automation Team 23
24. How to use Retrofit
Send request to API
June 2, 2018 Basel Department - Automation Team 24
25. Mini - Demo
Structure of
Framework:
June 2, 2018 Basel Department - Automation Team 25
26. Mini - Demo
Configure url in local.properties file to build baseURL
June 2, 2018 Basel Department - Automation Team 26
27. Mini - Demo
Workflow of
Framework:
June 2, 2018 Basel Department - Automation Team 27
29. Practices
Feature: Employee
As a user, I want to update and delete information for
employee
Scenario: Update Employee - PUT: v1/update/{id}
Scenario: Delete Employee - DELETE: v1/delete/{id}
June 2, 2018 Basel Department - Automation Team 29
Assignment
30. Practices
Gitlab to get codebase:
https://gitlab.com/ttthu.dsna/api-automation-retrofit
June 2, 2018 Basel Department - Automation Team 30
32. June 2, 2018 Basel Department - Automation Team 32
33. June 2, 2018 Basel Department - Automation Team 33
Editor's Notes
Divide everyone to 5 groups and send link to get source code for them
Guide them to config to run source code
Most software testing right now is done by manual testers, while automation represents no more than 30% of testing.
Also notice that of the automated testing done, the vast majority of it is UI testing.
http://typescriptprotractor.blogspot.com
Most software testing right now is done by manual testers, while automation represents no more than 30% of testing.
Also notice that of the automated testing done, the vast majority of it is UI testing.
http://typescriptprotractor.blogspot.com