From e6aaa43866185a3e2304c4e744bd9d3a82c4ced5 Mon Sep 17 00:00:00 2001 From: HoolaBoola Date: Fri, 11 Dec 2020 19:16:23 +0200 Subject: [PATCH] Added search by tag cucumber tests --- .../java/recommendation_library/Stepdefs.java | 17 ++++++ .../searchByTags.feature | 54 +++++++++++-------- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/test/java/recommendation_library/Stepdefs.java b/src/test/java/recommendation_library/Stepdefs.java index 4ddddc6..891a0c4 100644 --- a/src/test/java/recommendation_library/Stepdefs.java +++ b/src/test/java/recommendation_library/Stepdefs.java @@ -64,6 +64,11 @@ public void commandBookSelected() { inputLines.add("1"); } + @When("command search tags is selected") + public void commandSearchTagsSelected() { + inputLines.add("10"); + } + @When("command list all is selected") public void commandAllListingSelected() { inputLines.add("1"); @@ -208,9 +213,21 @@ public void systemWillRespondWith(String expectedOutput) { @Then("app lists a recommendation with author {string}, title {string}, description {string}, isbn {string}, and page count {string}") public void listingAddedBookRecommendation(String author, String title, String description, String isbn, String pageCount) { + System.err.println(author); + System.err.println(title); + System.err.println(description); + System.err.println(isbn); + System.err.println(pageCount); + System.err.println(String.join("\n", inputLines)); io = new StubIO(inputLines); + System.err.println(io); + dao = new InMemoryRecommendationDao(); + System.err.println(dao); + ui = new UserInterface(io, dao); + System.err.println(ui); + ui.run(); String addDate = java.time.LocalDate.now().toString(); diff --git a/src/test/resources/RecommendationLibrary/searchByTags.feature b/src/test/resources/RecommendationLibrary/searchByTags.feature index 4acb124..568aaf9 100644 --- a/src/test/resources/RecommendationLibrary/searchByTags.feature +++ b/src/test/resources/RecommendationLibrary/searchByTags.feature @@ -1,10 +1,16 @@ -Feature: As a user I can list my recommendations +Feature: As a user I can search a recommendation by tag - Scenario: user can list added book recommendations + Scenario: user can list added book tags Given command add is selected When command book is selected And book recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest" and page count "10" is added - And command list is selected + And command edit is selected + And command book is selected + And title "TitleTest" is entered + And field to edit "6" is entered + And tag "eka" is entered + And command search tags is selected + And field to edit "eka" is entered And command list books is selected Then app lists a recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest", and page count "10" @@ -12,31 +18,27 @@ Feature: As a user I can list my recommendations Given command add is selected When command video is selected And video recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest" is added - And command list is selected + And command edit is selected + And command video is selected + And title "TitleTest" is entered + And field to edit "5" is entered + And tag "eka" is entered + And command search tags is selected + And field to edit "eka" is entered And command list videos is selected Then app lists a recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest" - - Scenario: user can list all recommendations when video is added - Given command add is selected - When command video is selected - And video recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest" is added - And command list is selected - And command list all is selected - Then app lists a recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest" - - Scenario: user can list all recommendations - Given command add is selected - When command book is selected - And book recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest" and page count "10" is added - And command list is selected - And command list all is selected - Then app lists a recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest", and page count "10" - + Scenario: user can list added blog recommendations Given command add is selected When command blog is selected And blog recommendation with title "TitleTest", author "AuthorTest", description "DescriptionTest" and url "www.blog.fi" is added - And command list is selected + And command edit is selected + And command blog is selected + And title "TitleTest" is entered + And field to edit "5" is entered + And tag "eka" is entered + And command search tags is selected + And field to edit "eka" is entered And command list blogs is selected Then app lists a recommendation with title "TitleTest", author "AuthorTest", description "DescriptionTest" and url "www.blog.fi" @@ -44,6 +46,12 @@ Feature: As a user I can list my recommendations Given command add is selected When command podcast is selected And podcast recommendation with title "TitleTest", name "TestName", author "AuthorTest" and description "DescriptionTest" is added - And command list is selected + And command edit is selected + And command podcast is selected + And title "TitleTest" is entered + And field to edit "5" is entered + And tag "eka" is entered + And command search tags is selected + And field to edit "eka" is entered And command list podcasts is selected Then app lists a podcast recommendation with title "TitleTest", name "TestName", author "AuthorTest" and description "DescriptionTest"