Target Platform: Windows
Task #1: Functional test suite
-
Create a fake http server in Python with API that behaves similar to https://swapi.dev/ It should support the same three end-points (people/xx/, planets/xx/, starships/xx/) and can always return the same json response for any id passed. For some specific ids e.g. >100 should return a 404 Not Found error with a json body that describes the problem. The server should keep a log file that logs all the incoming requested URLs and response codes.
-
Create an automated test suite (using test framework like Robot Framework) that: a) prepares the test environment by starting the http server b) runs test cases per end-point that verify both happy path (sends back a valid json response with the expected values) or edge cases (e.g. id not found) c) shuts down the environment d) prints out the test execution results to the console
Task #2: Performance test suite
-
Extend the http server to incur a random small delay per http request.
-
Create a performance test suite that: a) prepares the test environment by starting the http server b) accesses one of the end-points continuously for a time duration e.g. 1 minute (sequential access is fine) c) for each access it keeps track of the response time on the client side d) shuts down the environment e) prints out mean & standard deviation of the response time for the end-point
------------ Build & RUN --------------------
Step 1:
$ docker build -t robot-image .
Step 2:
a. Functional test suite
$ docker run -ti --rm -v $(pwd):/XM_exercise robot-image /bin/bash -c "robot --outputdir functional_logs star_wars_functional.robot"
b. Performance test suite
$ docker run -ti --rm -v $(pwd):/XM_exercise robot-image /bin/bash -c "robot --outputdir performance_logs star_wars_performance.robot"