This project is used to test Splunk movie API with Rest-Assured and TestNG.
- Sort the JSON response body by genre_ids and id;
- Test for duplicate images;
- Test the validation of poster_path links;
- Test the number of movies whose sum of "genre_ids" > 400 being no more than 7;
- Test for palindrome in titles;
- Test for titles to see if one contain the other;
- Test if the title and original title are match for each movie.
- Initial the TestMovieAPI.java class as:
TestMovieAPI test = new TestMovieAPI();
- Post new data onto the server by:
String movieName = "Superman";
Map<String, String> movie = new HashMap<>();
movie.put("name", movieName);
movie.put("description", "the best movie ever made");
test.testPost(movieName, movie);
- Perform the test based on the requirements and get the JSON body of the response
String body = test.testGet();
- Print out the Json after sorting with genre_ids and id
System.out.println("The sorted body of response: " + test.sortJson(body));
- Check if there are movies using the same poster
System.out.println("There are movies using the same poster: " + test.checkDups(body));
- Check if all poster_path links are valid
System.out.println("All poster_path links are valid: " + test.checkValidPath(body));
- Check if the number of movies whose sum of "genre_ids" > 400 should be no more than 7
System.out.println("There are " + test.CheckGenIds(body) + " movies whose sum of genre_ids > 400");
- heck if there is at least one movie in the database whose title has a palindrome in it
System.out.println("At least one movie whose title has a palindrome: " + test.checkPalindrome(body));
- Check if there are at least two movies in the database whose title contain the title of another movie
System.out.println("There are " + test.checkOverlap(body) + " movies whos title contain the title of another movie\n");
- Check if the title of each movie match its original title
System.out.println("The title and original_title are match: " + test.checkOriginalTitle(body));
- Check if the response code is 200
test.basicPingTest();