Project Functional Testing


3/28/20, at noon: minor changes are still possible, mainly for bug fixes. New test cases are unlikely to be added.

For purposes of this API description, all URLs are relative to the base url of http://localhost:8080/sar

The JSON used for testing purposes will match the format described in the project API.

Functional testing will begin only after the tester was able to build the project following your build instructions and then deploy the resulting .war file to a tomcat server. If your build scripts generate something else other than a .war file that's fine too, as long as the build & deploy instructions are clear and work as expected.

The specific actions taken by the tester before beginning functional acceptance testing are described here.

Values (in the expected response files) that are enclosed between angle brackets will be substituted with actual values we recorded in the previous testing steps. For example, if you see in the expected response "pid": "<pid1>" it means that the test will expect to see something like "pid": "79" when it runs, where 79 is the value that was returned in a previous response that we denoted as pid1.

If you think that what you see below is a lot of testing, then you should consider the fact that we're just scratching the surface testing: for instance, we have very few tests that validate how your application responds to invalid data in the request, and only one test for submitting requests that violate application logic. In fact, all the tests below represent a pretty minimalistic set of tests.

Below are the steps we'll take to test the functionality of your project.

NOTE: the testers reserve the right to do more extensive testing than the tests below, by either adding more tests or by changing the request payloads.

Lastly, your TA has developed a script that automates the testing of your project. The script takes performs the actions described in each test (GET, POST, PUT, DELETE) using the payload that needs to be submitted, as needed, and compares the output returned by your application with the expected output. Read more about how to run the script.

Download the data to be submitted and expected responses here.

  1. Validate that there are no accounts to be returned when the applicatin runs for the first time ( GET /accounts ). The response should be an empty JSON array.
  2. Validate that there are no rides to be returned when the applicatin runs for the first time ( GET /rides ). The response should be an empty JSON array.
  3. Verify that bad data POST-ed ( POST /accounts ) in order to create an account will return a 400 (Bad Request) error. View the data for the POST. Here is the expected response.
  4. Create an account ( POST /accounts ) using valid data. The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /accounts/<aid1>. View data for the POST. Here is the expected response.
  5. Update the account identified by <aid1> ( PUT /accounts/<aid1> ). View data for the PUT. The HTTP response should be 204 (No content) with an empty body.
  6. Try to create a ride with account <aid1> ( POST /rides ). The HTTP response should be 400 (Bad Request) because account <aid1> is not active. View the data for the POST. Here is the expected response.
  7. Activate account <aid1> ( PUT /accounts/<aid1>/status ). The HTTP response should be 204 (No content) with an empty body. View data for the PUT request.
  8. Try again to create a ride with account <aid1> ( POST /rides ). The HTTP response should be 201 (Created) because account <aid1> is now active, and the HTTP header should contain a 'Location' link to /rides/<rid1>. View the data for the POST. Here is the expected response.
  9. Create a second account ( POST /accounts ). The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /accounts/<aid2>. View data for the POST. Here is the expected response.
  10. Create a third account ( POST /accounts ). The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /accounts/<aid3>. View data for the POST. Here is the expected response.
  11. Search rides ( GET /rides?from=barrington&to=&date= ). The HTTP response should be 200 (OK). Here is the expected response.
  12. Request a resource that doesn't exist ( GET /rides/1073807359 ). The HTTP response should be 404 (Not Found).
  13. View ride detail ( GET /rides/<rid1> ). The HTTP response should be 200 (OK). Here is the expected response.
  14. Try to create a join ride request with account <aid2> ( POST /rides/<rid1>/join_requests ). The HTTP response should be 400 (Bad Request) because account <aid2> is not active. View the data for the POST. Here is the expected response.
  15. Activate account <aid2> ( PUT /accounts/<aid2>/status ). The HTTP response should be 204 (No content) with an empty body. View data for the PUT request.
  16. Try again to create a join ride request with account <aid2> ( POST /rides/<rid1>/join_requests ). The HTTP response should be 201 (Created) because account <aid2> is now active, and the HTTP header should contain a 'Location' link to /rides/<rid1>/join_requests/<jid1>. View the data for the POST. Here is the expected response.
  17. View <rid1> messages ( GET /rides/<rid1>/messages ). The request should return 200 (OK). The body of the response should be an empty JSON array.
  18. Account <aid2> adds a message to <rid1> ( POST /rides/<rid1>/messages ). The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /rides/<rid1>/messages/<mid1>. View data for the POST. Here is the expected response.
  19. Account <aid1> adds a message to <rid1> ( POST /rides/<rid1>/messages ). The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /rides/<rid1>/messages/<mid1>. View data for the POST. Here is the expected response.
  20. View <rid1> messages ( GET /rides/<rid1>/messages ). The request should return 200 (OK). Here is the expected response.
  21. Check rider ratings ( GET /accounts/<aid2>/rider ). The request should return 200 (OK). Here is the expected response.
  22. Approve join ride request <jid1> ( PATCH /rides/<rid1>/join_requests/<jid1> ). The request should return 200 (OK) with an empty body. View data for the PATCH.
  23. Confirm passenger pickup <jid1> ( PATCH /rides/<rid1>/join_requests/<jid1> ). The request should return 200 (OK) with an empty body. View data for the PATCH.
  24. Check driver ratings ( GET /accounts/<aid1>/driver ). The request should return 200 (OK). Here is the expected response.
  25. Rate account (as the driver) ( POST /accounts/<aid2>/ratings ). The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /accounts/<aid2>/ratings/<sid1>. View data for the POST. Here is the expected response.
  26. Attempt to rate an account (as a rider) but for a ride the passenger was not a part of. ( POST /accounts/<aid1>/ratings ). The request should return 400 (Bad Request) because "sent_by_id" didn't participate in <rid1>. View data for the POST. Here is the expected response.
  27. Rate account (as the rider) ( POST /accounts/<aid1>/ratings ). The request should return 201 (Created) and the HTTP header should contain a 'Location' link to /accounts/<aid1>/ratings/<sid2>. View data for the POST. Here is the expected response.
  28. Check rider ratings ( GET /accounts/<aid2>/rider ). The request should return 200 (OK). Here is the expected response.
  29. Check driver ratings ( GET /accounts/<aid1>/driver ). The request should return 200 (OK). Here is the expected response.
  30. Create a new ride with account <aid1> ( POST /rides ). The HTTP response should be 201 (Created) and the HTTP header should contain a 'Location' link to /rides/<rid2>. View the data for the POST. Here is the expected response.
  31. View ride detail ( GET /rides/<rid2> ). The HTTP response should be 200 (OK). Here is the expected response.
  32. View all rides ( GET /rides ). The HTTP response should be 200 (OK). Here is the expected response.
  33. Search accounts ( GET /accounts?key= ). The request should return 200 (OK). Here is the expected response.
  34. Search accounts with a different "key" ( GET /accounts?key=312 ). The request should return 200 (OK). Here is the expected response.
  35. View a list of available reports ( GET /reports ). Make a note of <pid1> (Rides posted between two dates) and <pid2> (Rides taken between two dates). Here is the expected response.
  36. Get the "Rides posted between two dates" (<pid1>) report ( GET /reports/<pid1> ). Here is the expected response.
  37. Get the "Rides posted between two dates" (<pid1>) report with date filtering ( GET /reports/<pid1>?start_date=15-Apr-2020&end_date= ). Here is the expected response.
  38. Get the "Rides taken between two dates" (<pid2>) report ( GET /reports/<pid2>?start_date=14-Apr-2020&end_date=14-Apr-2020 ). Here is the expected response.
  39. Delete ride <rid2> ( DELETE /rides/<rid2> ). The request should return 204 (No Content).
  40. View ride detail for <rid2> ( GET /rides/<rid2> ). The HTTP response should be 404 (Not Found).

Last update: Apr 13, 2020 Virgil Bistriceanu cs445 Computer Science