From c5432d5804a5a2982c9b35c962c198fd695ecf08 Mon Sep 17 00:00:00 2001 From: virtus80 Date: Wed, 16 Dec 2015 10:43:18 +0200 Subject: [PATCH 1/5] added test-cases for adding coment - modified description of positive test-cases for article title and article with valid content - added positive and negative test-cases for adding comment to existing article --- .../antarcticle/ArticleManagementTest.groovy | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy index ce628563..702e4aa6 100644 --- a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy +++ b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy @@ -9,7 +9,7 @@ class ArticleManagementTest extends Specification { def 'article title positive cases'() { given: 'user is created and logged in' when: "user creates an article with $caseName" - then: 'article should not get created' + then: 'article should get created' where: caseName | articleTitle | messageIfCaseFailed 'Min boundary' | randomAlphabetic(1) | 'Could not create article with min title boundary' @@ -33,7 +33,7 @@ class ArticleManagementTest extends Specification { Users.signIn(); when: "user creates an article with $caseName" Article article = Articles.create(new Article(content: articleContent)) - then: 'article should not get created' + then: 'article should get created' Articles.assertArticleExists(article, messageIfCaseFailed) where: caseName | articleContent | messageIfCaseFailed @@ -105,5 +105,29 @@ class ArticleManagementTest extends Specification { 'second' | $randomLanguage | 'Could not create second translation of article' 'same language' | 'English' | 'Could not create translation of article on same language' } + + def 'comment adding positive cases'() { + given: 'user is created and logged in' + and: 'article is created and opened' + when: "user creates a comment with $caseName" + then: 'comment should be added' + where: + caseName | commentLength | messageIfCaseFailed + 'Min boundary' | randomAlphabetic(1) | 'Could not create comment with min length boundary' + 'Max boundary' | randomAlphabetic(65535) | 'Could not create comment with max length boundary' + 'Average length'| randomAlphabetic(3000) | 'Could not create comment of average length' + } + +def 'comment adding negative cases'() { + given: 'user is created and logged in' + and: 'article is created and opened' + when: "user creates a comment with $caseName" + then: 'comment should not get added' + where: + caseName | commentLength | messageIfCaseFailed + 'Empty comment' | '' | 'Empty comment was possible to create while this is not allowed'' + 'Too long comment' | randomAlphabetic(65536) | 'It was possible to create a comment with too long length' + 'Spaces in comment'| ' ' | 'Comment with only spaces should not be allowed!' + } } \ No newline at end of file From c7aff3c69ff5e693c4e1333b43e625dd1c6a71e9 Mon Sep 17 00:00:00 2001 From: virtus80 Date: Sat, 19 Dec 2015 22:53:32 +0200 Subject: [PATCH 2/5] Revert "added test-cases for adding coment" This reverts commit c5432d5804a5a2982c9b35c962c198fd695ecf08. --- .../antarcticle/ArticleManagementTest.groovy | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy index 702e4aa6..ce628563 100644 --- a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy +++ b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy @@ -9,7 +9,7 @@ class ArticleManagementTest extends Specification { def 'article title positive cases'() { given: 'user is created and logged in' when: "user creates an article with $caseName" - then: 'article should get created' + then: 'article should not get created' where: caseName | articleTitle | messageIfCaseFailed 'Min boundary' | randomAlphabetic(1) | 'Could not create article with min title boundary' @@ -33,7 +33,7 @@ class ArticleManagementTest extends Specification { Users.signIn(); when: "user creates an article with $caseName" Article article = Articles.create(new Article(content: articleContent)) - then: 'article should get created' + then: 'article should not get created' Articles.assertArticleExists(article, messageIfCaseFailed) where: caseName | articleContent | messageIfCaseFailed @@ -105,29 +105,5 @@ class ArticleManagementTest extends Specification { 'second' | $randomLanguage | 'Could not create second translation of article' 'same language' | 'English' | 'Could not create translation of article on same language' } - - def 'comment adding positive cases'() { - given: 'user is created and logged in' - and: 'article is created and opened' - when: "user creates a comment with $caseName" - then: 'comment should be added' - where: - caseName | commentLength | messageIfCaseFailed - 'Min boundary' | randomAlphabetic(1) | 'Could not create comment with min length boundary' - 'Max boundary' | randomAlphabetic(65535) | 'Could not create comment with max length boundary' - 'Average length'| randomAlphabetic(3000) | 'Could not create comment of average length' - } - -def 'comment adding negative cases'() { - given: 'user is created and logged in' - and: 'article is created and opened' - when: "user creates a comment with $caseName" - then: 'comment should not get added' - where: - caseName | commentLength | messageIfCaseFailed - 'Empty comment' | '' | 'Empty comment was possible to create while this is not allowed'' - 'Too long comment' | randomAlphabetic(65536) | 'It was possible to create a comment with too long length' - 'Spaces in comment'| ' ' | 'Comment with only spaces should not be allowed!' - } } \ No newline at end of file From 1451430d185c1d068bcc1bf4915326d9b87a4c08 Mon Sep 17 00:00:00 2001 From: virtus80 Date: Sat, 19 Dec 2015 23:08:23 +0200 Subject: [PATCH 3/5] added test-cases for adding comment - modified description of positive test-cases for article title and article with valid content; - added positive and negative test-cases for adding comment to existing article --- .../antarcticle/ArticleManagementTest.groovy | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy index ce628563..ec096d83 100644 --- a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy +++ b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy @@ -9,7 +9,7 @@ class ArticleManagementTest extends Specification { def 'article title positive cases'() { given: 'user is created and logged in' when: "user creates an article with $caseName" - then: 'article should not get created' + then: 'article should get created' where: caseName | articleTitle | messageIfCaseFailed 'Min boundary' | randomAlphabetic(1) | 'Could not create article with min title boundary' @@ -33,7 +33,7 @@ class ArticleManagementTest extends Specification { Users.signIn(); when: "user creates an article with $caseName" Article article = Articles.create(new Article(content: articleContent)) - then: 'article should not get created' + then: 'article should get created' Articles.assertArticleExists(article, messageIfCaseFailed) where: caseName | articleContent | messageIfCaseFailed @@ -105,5 +105,30 @@ class ArticleManagementTest extends Specification { 'second' | $randomLanguage | 'Could not create second translation of article' 'same language' | 'English' | 'Could not create translation of article on same language' } + + def 'comment adding positive cases'() { + given: 'user is created and logged in' + and: 'article is created and opened' + when: "user creates a comment with $caseName" + then: 'comment should be added' + where: + caseName | commentLength | messageIfCaseFailed + 'Min boundary' | randomAlphabetic(1) | 'Could not create comment with min length boundary' + 'Max boundary' | randomAlphabetic(65535) | 'Could not create comment with max length boundary' + 'Average length'| randomAlphabetic(3000) | 'Could not create comment of average length' + } + + def 'comment adding negative cases'() { + given: 'user is created and logged in' + and: 'article is created and opened' + when: "user creates a comment with $caseName" + then: 'validation error should be shown' + where: + caseName | commentLength | messageIfCaseFailed + 'Empty comment' | '' | 'Empty comment was possible to create while this is not allowed'' + 'Too long comment' | randomAlphabetic(65536) | 'It was possible to create a comment with too long length' + 'Spaces in comment'| ' ' | 'Comment with only spaces should not be allowed!' + } + } \ No newline at end of file From cee9e11b3a5d3c75dc396db5e81bad65e2ce5023 Mon Sep 17 00:00:00 2001 From: virtus80 Date: Sun, 20 Dec 2015 22:34:45 +0200 Subject: [PATCH 4/5] changed intents in test description - changed intents around 'and' --- .../antarcticle/ArticleManagementTest.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy index ec096d83..41c395b7 100644 --- a/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy +++ b/functional-tests-antarcticle/src/test/groovy/org/jtalks/tests/antarcticle/ArticleManagementTest.groovy @@ -44,7 +44,7 @@ class ArticleManagementTest extends Specification { def 'translation title positive cases'() { given: 'user is created and logged in' - and: 'article is created and opened' + and: 'article is created and opened' when: "user creates a translation with $caseName" then: 'translation should get created' where: @@ -56,7 +56,7 @@ class ArticleManagementTest extends Specification { def 'translation title negative cases'() { given: 'user is created and logged in' - and: 'article is created and opened' + and: 'article is created and opened' when: "user creates a translation with $caseName" then: 'translation should not get created' where: @@ -68,7 +68,7 @@ class ArticleManagementTest extends Specification { def 'translation content positive cases'() { given: 'user is created and logged in' - and: 'article is created and opened' + and: 'article is created and opened' when: "user creates a translation with $caseName" then: 'translation should get created' where: @@ -80,7 +80,7 @@ class ArticleManagementTest extends Specification { def "translation content negative cases"() { given: 'user is created and logged in' - and: 'article is created and opened' + and: 'article is created and opened' when: "user creates a translation with $caseName" then: 'translation of article should not get created' where: @@ -96,8 +96,8 @@ class ArticleManagementTest extends Specification { def "create second translation"() { given: 'user is created and logged in' - and: 'article is created and opened' - and: 'translation in English is created' + and: 'article is created and opened' + and: 'translation in English is created' when: "user creates a translation on $language" then: 'translation of article should get created' where: @@ -108,7 +108,7 @@ class ArticleManagementTest extends Specification { def 'comment adding positive cases'() { given: 'user is created and logged in' - and: 'article is created and opened' + and: 'article is created and opened' when: "user creates a comment with $caseName" then: 'comment should be added' where: @@ -120,7 +120,7 @@ class ArticleManagementTest extends Specification { def 'comment adding negative cases'() { given: 'user is created and logged in' - and: 'article is created and opened' + and: 'article is created and opened' when: "user creates a comment with $caseName" then: 'validation error should be shown' where: From 715692cec9650390016dff72e47b2919f37ddfb4 Mon Sep 17 00:00:00 2001 From: Stanislav Bashkyrtsev Date: Thu, 17 Dec 2015 09:45:08 +0300 Subject: [PATCH 5/5] Add class name into capabilities for saucelabs To distinguish between tests and form different job names. --- .../tests/jcommune/webdriver/JCommuneSeleniumConfig.java | 7 ++++--- .../tests/jcommune/webdriver/SeleniumSessionListener.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/JCommuneSeleniumConfig.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/JCommuneSeleniumConfig.java index 8a190fa4..e9bf4447 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/JCommuneSeleniumConfig.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/JCommuneSeleniumConfig.java @@ -47,15 +47,16 @@ public static Capabilities getCapabilities() { */ @BeforeSuite(alwaysRun = true) @Parameters({"webDriverUrl"}) - public void init(String webDriverUrl, String appUrl) throws Exception { + public void init(String webDriverUrl, String appUrl, String testName) throws Exception { JCommuneSeleniumConfig.appUrl = appUrl; webdriverType = getBrowser(); - initDriver(webDriverUrl); + initDriver(webDriverUrl, testName); Pages.createAllPages(driver); } - private void initDriver(String defaultSeleniumServerUrl) throws MalformedURLException { + private void initDriver(String defaultSeleniumServerUrl, String testName) throws MalformedURLException { DesiredCapabilities capabilities = new DesiredCapabilities(); + capabilities.setCapability("name", testName); capabilities.setCapability(CapabilityType.PLATFORM, getOs()); capabilities.setBrowserName(getBrowser()); capabilities.setVersion(getBrowserVersion()); diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/SeleniumSessionListener.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/SeleniumSessionListener.java index f889e67c..f2620f60 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/SeleniumSessionListener.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/SeleniumSessionListener.java @@ -69,7 +69,8 @@ public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { seleniumConfig = new JCommuneSeleniumConfig(); XmlSuite suite = testClass.getXmlTest().getSuite(); try { - seleniumConfig.init(suite.getParameter("webDriverUrl"), suite.getParameter("appUrl")); + seleniumConfig.init(suite.getParameter("webDriverUrl"), suite.getParameter("appUrl"), + currentTestClass.getSimpleName()); } catch (Exception e) { logger.error("Unexpected error during Selenium configuration.", e); throw new RuntimeException(e);