Part 2 (API Testing Scenario) - Coding Challenge
Part 1 - Frontend Testing Scenario - Home Loan Bank Calculator: https://github.com/AzySir/HomeLoanCalculator
# You recently applied for a role of Automation Test Engineer and have made it to the short list of candidates. Since we are looking for someone who can create an automated test framework, we require you to complete the following exercise.
The task consists of programming exercises relating to frontend and API testing. In addition, it also contains related testing questions.
Our developers have finished coding a borrowing calculator and would like to make sure that the calculator continues to work as they make other changes to the page. They have asked you to build automated tests covering various use cases to verify that the calculator is working properly. They intend to run these tests as part of continuous testing.
The current working production page is here: https://www.anz.com.au/personal/home-loans/calculators-tools/much-borrow/
Develop the following three tests:
- A person with the following details: a. Single, b. 0 dependants, c. buying a home to live in, d. with income of $80,000, e. other income $10,000, f. living expenses $500, g. current home loan repayments $0, h. other loan repayments $100, i. other commitments $0 j. and total credit card limits $10,000 has a borrowing estimate of $479,000.
- Clicking the ‘start over’ button clears the form.
- When entering only $1 for Living expenses and leaving all other fields as zero, clicking ‘Work out how much I could borrow’ returns the following message “Based on the details you've entered, we're unable to give you an estimate of your borrowing power with this calculator. For questions, call us on 1800 100 641.”
• You will need to create a project in either JavaScript or Java with minimal dependencies
• The project should use Cucumber (gherkin - BDD) with an open source UI test automation runtime of your choice (e.g. Puppeteer, WebdriverIO)
• The tests should target a browser of your choice (e.g. Chrome, Firefox)
• The tests should run through Command Line Interface in order to support CI/CD
• All tests should pass and produce new results every time they are run
• The solution should output results to JSON or XML and be able to generate HTML reports from the output file.
Your new team has an upcoming need to implement API testing. They do not have prior experience in that field and have requested you to create a project that will give them a template on how a proper testing solution should be setup and utilised. They intend to run the solution as part of continuous testing.
They have asked you to implement an API testing solution against an open API weather station available from the following URL. Please note that you will to register with the website in order to utilise their API. https://openweathermap.org/stations
Using the API specification detailed in the URL above, develop the following tests:
- Validate that attempt to register a weather station without an API key will return the following in message body.
cod : 401
message : "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."
- Successfully register two stations with the following details and verify that HTTP response code is 201.
-
Using “[GET] /stations” API verify that the stations were successfully stored in the DB and their values are the same as specified in the registration request.
-
Delete both of the created stations and verify that returned HTTP response is 204.
-
Repeat the previous step and verify that returned HTTP response is 404 and that message body contains “message”: “Station not found".
Please complete the solutions and share them via public repository in GitHub. Please do not use ANZ Bank in any of the references. The repositories should contain clear instructions (README.md) on how to setup, tests and generate report as well as specify where to find results.
-
What other possible scenario would you suggest for given page? Suggest 3-5 with your suggestion.
-
If this test was part of a much larger test suite, how would you speed it up to test particular flow?
-
Which approaches could be used to reduce overall execution time? Describe how they could be implemented into your code base.
-
Sometimes UI tests can fail unpredictably. For example, the page may not have fully loaded before test automation attempts to click a button on a webpage. How would you improve reliability of these tests without increasing execution time?
-
From your experience, what is the focus of UI Automation testing – Integration, Functional or Acceptance testing? Briefly explain why.
Good luck!