A Cypress testing framework to perform UI and API automated testing
The only requirement for this project is to have Node.js version 12 or 14 and above installed on your machine.
npm installnpm run cypress openRun tests in headless mode on default browser bundled with cypress. Create new command or use commandline options to run on different browsers using --browser parameter to the run command
npm run cypress:run:chromeScenario: Use default shortened url https://bit.ly to load the site in a browser and validates https://bitly.com/ is loaded by verifying href of loaded page's window.location object.
Positive Tests
- Generate shortened url for https://bitly.com/ multiple times. Use them to verify page loaded is https://bitly.com/
- Test with shortened urls for urls having one or multiple paths in it
- Test with shortened urls for urls which can have parameter in it.
Negative Tests.
- Tamper shortened url. This can include changing charaters(test with some special characters as well) in domain, path.
- Add exta parameters to generated shortend url.
API test automated for Cat Fact REST API https://catfact.ninja/facts
Snenario: Validates status code 200 and some response data for the GET request
Swagger documentation for the api endpoint /facts was not working so below scenarios are based on response and general practise while testing REST api's
- Test response /for other expected objects in response of /facts GET request. Expected number of default items in data object, pagination links, current pagination based on default limit of per_page 10
- Verify type of expected attributes.
- Verify links object data.
- Verify with possible parameters, headers that is accepted by endpoint.
- Verify response code for error scenarios(bad request, 0 for limit parameter, unexpected value for type of parameters etc). Error messages are clear and correct response codes retured.
- Verify boudary conditions for parameters that takes number.
- Verify response for diffent parameters. Say for limit(page size), max_length(number of character in facts to filter for)
- Verify api is not throwing back any db or confidential info in error for security related checks.
- Verify api implements expected restriction with content type
- Verify http verbs that can be served by an endpoint.
- Test with unsupported methods and verify response having userfriendly error message and status code
- Possible performance validations when large number of requests are served by api.