[DRE-commits] [ruby-aruba] 63/74: Split up feature test

Hideki Yamane henrich at moszumanska.debian.org
Sat Nov 28 01:16:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository ruby-aruba.

commit 33ba011decddc3009e425be294e72f931c338cf5
Author: Dennis Günnewig <dg1 at ratiodata.de>
Date:   Fri Nov 27 09:26:38 2015 +0100

    Split up feature test
---
 features/output.feature               | 90 -----------------------------------
 features/steps/command/output.feature | 71 +++++++++++++++++++++++++++
 features/steps/command/stderr.feature | 68 ++++++++++++++++++++++++++
 features/steps/command/stdout.feature | 47 +++++++++++++++++-
 4 files changed, 184 insertions(+), 92 deletions(-)

diff --git a/features/output.feature b/features/output.feature
index bd09f71..666d2a1 100644
--- a/features/output.feature
+++ b/features/output.feature
@@ -7,96 +7,6 @@ Feature: All output of commands which were executed
   Background:
     Given I use a fixture named "cli-app"
 
-  @requires-aruba-version-1
-  Scenario: Detect output from all processes normal and interactive ones
-    Given an executable named "bin/cli1" with:
-    """
-    #!/usr/bin/env bash
-    echo 'This is cli1'
-    """
-    And an executable named "bin/cli2" with:
-    """
-    #!/usr/bin/env ruby
-
-    while input = gets do
-      break if "" == input
-      puts input
-    end
-    """
-    And a file named "features/output.feature" with:
-    """
-    Feature: Run command
-      Scenario: Run command
-        When I run `cli1`
-        When I run `cli2` interactively
-        And I type "This is cli2"
-        And I type ""
-        Then the stdout should contain exactly:
-        \"\"\"
-        This is cli1
-        \"\"\"
-        And the stdout should contain exactly:
-        \"\"\"
-        This is cli2
-        \"\"\"
-    """
-    When I run `cucumber`
-    Then the features should all pass
-
-  Scenario: Detect stdout from all processes
-    When I run `printf "hello world!\n"`
-    And I run `cat` interactively
-    And I type "hola"
-    And I type ""
-    Then the stdout should contain:
-      """
-      hello world!
-      """
-    And the stdout should contain:
-      """
-      hola
-      """
-    And the stderr should not contain anything
-
-  Scenario: Detect stderr from all processes
-    When I run `bash -c 'printf "hello world!\n" >&2'`
-    And I run `bash -c 'cat >&2 '` interactively
-    And I type "hola"
-    And I type ""
-    Then the stderr should contain:
-    """
-    hello world!
-    """
-    And the stderr should contain:
-    """
-    hola
-    """
-    And the stdout should not contain anything
-
-  Scenario: Detect stderr from all processes (deprecated)
-    When I run `bash -c 'printf "hello world!\n" >&2'`
-    And I run `bash -c 'cat >&2 '` interactively
-    And I type "hola"
-    And I type ""
-    Then the stderr should contain:
-    """
-    hello world!
-    hola
-    """
-    And the stdout should not contain anything
-
-  Scenario: Detect output from named source
-    When I run `printf 'simple'`
-    And I run `cat` interactively
-    And I type "interactive"
-    And I type ""
-    Then the output from "printf 'simple'" should contain "simple"
-    And the output from "printf 'simple'" should contain exactly "simple"
-    And the output from "printf 'simple'" should contain exactly:
-      """
-      simple
-      """
-    And the output from "cat" should not contain "simple"
 
   Scenario: Detect stdout from named source
     When I run `printf 'hello'`
diff --git a/features/steps/command/output.feature b/features/steps/command/output.feature
index 2d3408b..17f3f72 100644
--- a/features/steps/command/output.feature
+++ b/features/steps/command/output.feature
@@ -515,3 +515,74 @@ Feature: All output of commands which were executed
     """
     When I run `cucumber`
     Then the features should all pass
+
+  @requires-aruba-version-1
+  Scenario: Detect output from all processes normal and interactive ones
+    Given an executable named "bin/cli1" with:
+    """
+    #!/usr/bin/env bash
+    echo 'This is cli1'
+    """
+    And an executable named "bin/cli2" with:
+    """
+    #!/usr/bin/env ruby
+
+    while input = gets do
+      break if "" == input
+      puts input
+    end
+    """
+    And a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `cli1`
+        When I run `cli2` interactively
+        And I type "This is cli2"
+        And I type ""
+        Then the stdout should contain exactly:
+        \"\"\"
+        This is cli1
+        \"\"\"
+        And the stdout should contain exactly:
+        \"\"\"
+        This is cli2
+        \"\"\"
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  Scenario: Detect output from named source
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `printf 'simple'`
+        And I run `cat` interactively
+        And I type "interactive"
+        And I type ""
+        Then the output from "printf 'simple'" should contain "simple"
+        And the output from "printf 'simple'" should contain exactly "simple"
+        And the output from "printf 'simple'" should contain exactly:
+        \"\"\"
+        simple
+        \"\"\"
+        And the output from "cat" should not contain "simple"
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  Scenario: Detect second output from named source with custom name
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I set the environment variable "ARUBA_TEST_VAR" to "first"
+        And I run `bash -c 'printf $ARUBA_TEST_VAR'`
+        Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "first"
+        When I set the environment variable "ARUBA_TEST_VAR" to "second"
+        And I run `bash -c 'printf $ARUBA_TEST_VAR'`
+        Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "second"
+    """
+    When I run `cucumber`
+    Then the features should all pass
diff --git a/features/steps/command/stderr.feature b/features/steps/command/stderr.feature
new file mode 100644
index 0000000..aefd3f9
--- /dev/null
+++ b/features/steps/command/stderr.feature
@@ -0,0 +1,68 @@
+Feature: STDERR of commands which were executed
+
+  In order to specify expected output
+  As a developer using Cucumber
+  I want to use the "the stderr should contain" step
+
+  Background:
+    Given I use a fixture named "cli-app"
+
+  Scenario: Detect stderr from all processes
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `bash -c 'printf "hello world!\n" >&2'`
+        And I run `bash -c 'cat >&2 '` interactively
+        And I type "hola"
+        And I type ""
+        Then the stderr should contain:
+        \"\"\"
+        hello world!
+        \"\"\"
+        And the stderr should contain:
+        \"\"\"
+        hola
+        \"\"\"
+        And the stdout should not contain anything
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  Scenario: Detect stderr from all processes (deprecated)
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `bash -c 'printf "hello world!\n" >&2'`
+        And I run `bash -c 'cat >&2 '` interactively
+        And I type "hola"
+        And I type ""
+        Then the stderr should contain:
+        \"\"\"
+        hello world!
+        hola
+        \"\"\"
+        And the stdout should not contain anything
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  Scenario: Detect stderr from named source
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `bash -c 'printf hello >&2'`
+        And I run `printf goodbye`
+        Then the stderr from "bash -c 'printf hello >&2'" should contain "hello"
+        And the stderr from "bash -c 'printf hello >&2'" should contain exactly "hello"
+        And the stderr from "bash -c 'printf hello >&2'" should contain exactly:
+        \"\"\"
+        hello
+        \"\"\"
+        And the stdout from "bash -c 'printf hello >&2'" should not contain "hello"
+        And the stderr from "printf goodbye" should not contain "hello"
+    """
+    When I run `cucumber`
+    Then the features should all pass
diff --git a/features/steps/command/stdout.feature b/features/steps/command/stdout.feature
index 1384ee8..a34865f 100644
--- a/features/steps/command/stdout.feature
+++ b/features/steps/command/stdout.feature
@@ -1,8 +1,8 @@
-Feature: Stdout of commands which were executed
+Feature: STDOUT of commands which were executed
 
   In order to specify expected output
   As a developer using Cucumber
-  I want to use the "the output should contain" step
+  I want to use the "the stdout should contain" step
 
   Background:
     Given I use a fixture named "cli-app"
@@ -64,3 +64,46 @@ Feature: Stdout of commands which were executed
     """
     When I run `cucumber`
     Then the features should all pass
+
+  Scenario: Detect stdout from all processes including interactive ones
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `printf "hello world!\n"`
+        And I run `cat` interactively
+        And I type "hola"
+        And I type ""
+        Then the stdout should contain:
+        \"\"\"
+        hello world!
+        \"\"\"
+        And the stdout should contain:
+        \"\"\"
+        hola
+        \"\"\"
+        And the stderr should not contain anything
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  Scenario: 
+    Given a file named "features/output.feature" with:
+    """
+    Feature: Run command
+      Scenario: Run command
+        When I run `printf 'hello'`
+        And I run `printf 'goodbye'`
+        Then the stdout from "printf 'hello'" should contain "hello"
+        And the stdout from "printf 'hello'" should contain exactly "hello"
+        And the stdout from "printf 'hello'" should contain exactly:
+        \"\"\"
+        hello
+        \"\"\"
+        And the stderr from "printf 'hello'" should not contain "hello"
+        And the stdout from "printf 'goodbye'" should not contain "hello"
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git



More information about the Pkg-ruby-extras-commits mailing list