Code Monkey home page Code Monkey logo

gauge-ruby's Introduction

Gauge-ruby

Actions Status Gem Contributor Covenant

This project adds ruby language plugin for gauge.

The plugin is authored in Ruby. It contains a launcher component (gauge-ruby.go) written in golang which is used to start the plugin from gauge.

Getting started

Pre-requisite

Installation

gauge install ruby

Create a gauge-ruby project

gauge init ruby

Run tests

gauge run specs

Alternate Installation options

Install specific version

  • Installing specific version
gauge install ruby --version 0.7.0

Offline installation

gauge install ruby --file gauge-ruby-0.7.0-linux.x86_64.zip

Build from Source

Requirements

Run bundle install to install all required gems.

Running bundle exec rake -T should give the list of all tasks available. Below sections detail some commonly used tasks.

Compiling

To build gauge-ruby.xxx.gem and the gauge-ruby executable for current platform use:

bundle exec rake compile

To build gauge-ruby.xxx.gem and the gauge-ruby for all supported platforms use:

bundle exec rake xcompile
Installing

After compiling

TO install the gauge-ruby.xxx.gem use:

bundle exec rake install

To install gauge-ruby plugin use (Note, this will uninstall gauge-ruby before installing the compiled version):

bundle exec rake force_install

Installing to a CUSTOM_LOCATION

bundle exec rake force_install[CUSTOM_LOCATION]
Creating distributable

Note: Run after compiling

bundle exec rake package

For distributable across platforms os, windows and linux for both x86_64 and arm64

bundle exec rake package_all

New distribution details need to be updated in the ruby-install.json file in gauge plugin repository for a new version update.

License

Apache License, Version 2.0

Copyright

Copyright ThoughtWorks, Inc.

gauge-ruby's People

Contributors

apoorva-ga avatar apoorvam avatar chadlwilson avatar debashis9012 avatar deepthigc avatar dependabot-preview[bot] avatar dependabot[bot] avatar kashishm avatar kaustavdm avatar luciferankon avatar mahendrakariya avatar navaneeth avatar negidharmendra avatar nehashri avatar nivedhasenthil avatar prateekbaheti avatar renovate[bot] avatar riju91 avatar shubhamsc avatar sriv avatar vishnukarthikl avatar zabil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gauge-ruby's Issues

Getting Protobuff exception while trying to execute Gauge

Expected behavior
I should be able to execute the Gauge specs

Actual behavior
Getting the following exception

warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.3-compliant syntax, but you are running 2.3.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
/Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/decoder.rb:86:in `decode': invalid message (ProtocolBuffers::DecodeError)
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:290:in `parse'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:296:in `parse'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/field.rb:615:in `deserialize'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/decoder.rb:60:in `decode'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:290:in `parse'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:296:in `parse'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:36:in `dispatch_messages'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:76:in `<module:Runtime>'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:29:in `<module:Gauge>'
	from /Users/sswaroop/.rvm/gems/ruby-2.3.1/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:27:in `<top (required)>'
	from -e:1:in `require'
	from -e:1:in `<main>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/user.spec:3 Connection closed [[::1]:53861] cause: EOF => 'On signup page'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/user.spec:4 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Fill in and send registration form'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/user.spec:18 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'On the customer page'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/user.spec:19 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Just registered customer is listed'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/customer.md:7 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'On the customer page'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/customer.md:15 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Search for customer "ScroogeMcduck"'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/customer.md:16 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'The customer "ScroogeMcduck" is listed'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/customer.md:23 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Search for customers <table:resources/user.csv>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:8 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Create a product <table>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:3 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'On product page'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:4 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Search for product <name>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:5 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Open description for product <name>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:22 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Verify product "author" as "John P. Baugh"'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:29 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Find and store productId for "The Way to Go"'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:30 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Open product edit page for stored productId'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:31 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Update product specifier to new value <table:resources/product_data.csv>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:32 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Check product specifier has new value <table:resources/product_data.csv>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/concepts/find_and_open_product.cpt:3 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'On product page'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/concepts/find_and_open_product.cpt:4 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Search for product <name>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/concepts/find_and_open_product.cpt:5 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Open description for product <name>'
[ValidationError] /Users/sswaroop/blogResearch/gauge-example-ruby/specs/products.md:6 write tcp [::1]:53857->[::1]:53861: use of closed network connection => 'Delete this product'
Ruby runner Failed. Reason: exit status 1
  Failed to initialize suite datastore. Error: write tcp [::1]:53857->[::1]:53861: use of closed network connection
Successfully generated html-report to => /Users/sswaroop/blogResearch/gauge-example-ruby/reports/html-report
Specifications:	0 executed	0 passed	0 failed	0 skipped
Scenarios:	0 executed	0 passed	0 failed	0 skipped

Total time taken: 8ms

Steps to replicate

  • Clone gauge-example-ruby
  • Execute gauge from command line. Getting the following exception

Version

Gauge version: 0.8.4.nightly-2017-05-10

Plugins
-------
html-report (4.0.0.nightly-2017-05-04)
java (0.6.3.nightly-2017-04-21)
ruby (0.4.0)
xml-report (0.2.0)

Hook messages not sent to gauge

Expected Behaviour

Messages in hooks (Gauge.write_message) during execution should be sent to Gauge via the ProtoExecutionResult.

Actual Behaviour

Any message written using Gauge.write_message in before_scenario, after_scenario, before_spec, after_spec, before_suite and after_suite hooks are not sent back to gauge.

Also, messages in before_step and step are sent to gauge after after_step hook is executed.
It should be sent to gauge as soon as that hook is executed.

Gem not available from a different RVM environment

I did gauge --init ruby from a directory which uses a .rvmrc file and a different gemset. .rvmrc has the following:

rvm use ruby-2.1.3@project-name --create

Now when I did init, gauge installed ruby into the above gemset. Now when I move to a different directory and initialize a new gauge project, and run gauge specs, it fails with error:

/Users/navaneethkn/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- gauge-runtime (LoadError)
    from /Users/navaneethkn/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'
Failed to start Gauge Ruby runner. exit status 1
Runner exited with error: exit status 1

I think the way ruby runner is packaged is wrong. It can't be a gem. If it has to be a gem, it should get installed to the global gem path where the you may need permissions. Ideally, it should search for the files in the plugin installed path and modify the load path to include this so that it always works irrespective of where it is installed

Table type should give out a hash

Currently, the Table type exposes rows and columns. One needs to remember the order of the columns and access it like rows[index].

Instead, Table could be a hash with column name as the key, allowing users to access row["column name"].

Getting ValidationError for steps with implementation

Expected behavior
Should get ValidationError only if steps do not have implementation.

Actual behavior
Getting ValidationError for steps with implementation

Steps to replicate

  • gauge init ruby
  • run specs
    bundle exec gauge run specs

Getting validation error for steps with implementation

Version

Gauge version: 0.9.8.nightly-2018-01-16
Commit Hash: bd76268

Plugins
-------
ruby (0.4.3.nightly-2018-01-17)

Refactor with step text is changing the parameter name

Expected behavior
The parameter name should not change until it is a new parameter

Actual behavior
The parameter name is being changed even with the refactored text retaining the old name.

Steps to replicate

  1. Create a project
gauge --init ruby
  1. With spec details
Specification Heading
=====================

This is an executable specification file. This file follows markdown syntax.
Every heading in this file denotes a scenario. Every bulleted point denotes a step.

To execute this specification, run

    gauge specs


* sdf"a"

Vowel counts in single word
---------------------------

tags: single word

* The word "gauge" has "3" vowels.

Vowel counts in multiple word
-----------------------------

This is the second scenario in this specification

Here's a step that takes a table

* Almost all words have vowels

     |Word  |Vowel Count|
     |------|-----------|
     |Gauge |3          |
     |Mingle|2          |
     |Snap  |1          |
     |GoCD  |1          |
     |Rhythm|0          |
  1. With implementation
require 'test/unit'
include Test::Unit::Assertions

@vowels = nil;

step 'sdf<vowels>' do |vowels|
   @vowels = vowels.scan(/./);
end

step 'The word <word> has <count> vowels.' do |word, expectedCount|
  assert_equal(expectedCount.to_i, count_vowels(word))
end

step 'Almost all words have vowels <table>' do |wordsTable|
  wordsTable.rows().each do |row|
    word = row[0];
    expectedCount = row[1].to_i
    actualCount = count_vowels(word)
    assert_equal(expectedCount, actualCount)
  end
end

def count_vowels(string)
  string.count(@vowels.to_s)
end
  1. Refactor the step using the step text in the spec
    gauge --refactor "sdf"a"" "Vowels in English language are ."
  2. This refactors the step and renames the parameter to arg_vowels

Version

Gauge version: 0.5.1.nightly-2016-07-10

Plugins
-------
html-report (2.1.1.nightly-2016-07-08)
java (0.4.2.nightly-2016-07-07)
ruby (0.2.1)

$ gauge specs /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- gauge_runtime

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

  • Installed gauge using .pkg into macOS Sierra (osx 10.12.3) installing all language options.

  • Successfully initiated project.

  • Error on gauge specs:

$ gauge specs
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- gauge_runtime (LoadError) from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'
from -e:1:in `

'
Ruby runner Failed. Reason: exit status 1
Failed to start gauge API: Runner with pid 44476 quit unexpectedly(exit status 1).

screen shot 2017-04-05 at 11 42 12

$ gem list

*** LOCAL GEMS ***

bigdecimal (default: 1.2.0)
bundler (1.14.6)
CFPropertyList (2.2.8)
io-console (default: 0.4.2)
json (default: 1.7.7)
libxml-ruby (2.6.0)
minitest (default: 4.3.2)
nokogiri (1.5.6)
psych (default: 2.0.0)
rake (default: 0.9.6)
rdoc (default: 4.0.0)
rubygems-update (2.6.11)
sqlite3 (1.3.7)
test-unit (default: 2.0.0.0)

Implementation is broken when script has errors

test.spec:

# Test

## Test1

* test

step_implementation.rb:

step "test" do
    puts this should fail # syntax error
end

This should have failed with a decent message. But it crashed with the following message.

/Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:64:in `write': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:64:in `serialize_field_value'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protoc* testfers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:51:in `serialize_field'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:38:in `block in encode'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:15:in `each'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:15:in `encode'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:248:in `serialize'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:255:in `serialize_to_string'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/field.rb:611:in `serialize'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:38:in `block in encode'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:15:in `each'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:15:in `encode'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:248:in `serialize'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:255:in `serialize_to_st" Press ? for help             |  1
ring'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/field.rb:611:in `serialize'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:38:in `block in encode'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:15:in `each'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/encoder.rb:15:in `encode'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:248:in `serialize'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/ruby-protocol-buffers-1.5.1/lib/protocol_buffers/runtime/message.rb:255:in `serialize_to_string'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/gauge-ruby-0.0.3/lib/gauge-runtime.rb:40:in `write_message'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/gauge-ruby-0.0.3/lib/gauge-runtime.rb:35:in `handle_message'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/gauge-ruby-0.0.3/lib/gauge-runtime.rb:18:in `dispatch_messages'
    from /Users/navaneethkn/.rvm/gems/ruby-2.1.3@fundhive/gems/gauge-ruby-0.0.3/lib/gauge-runtime.rb:57:in `<top (required)>'
    from /Users/navaneethkn/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /Users/navaneethkn/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /Users/navaneethkn/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from -e:1:in `<main>'
Failed to start Gauge Ruby runner. exit status 1e of closed network connection
Runner exited with error: exit status 1

The following failures occured:

/Users/navaneethkn/projects/spectra/rewrite/fundhive/functional-tests/specs/test.spec : Test
 Test1:
     test
Connection closed [127.0.0.1:60498] cause: EOF

use of closed network connectionuse of closed network connectionuse of closed network connectionuse of closed network connection

Opening a project shows all steps as undefined

Expected behavior
Only steps with no definition should be highlighted

Actual behavior
All steps are highlighted as undefined.

Note: The issue gets resolved on switching between .rb file and spec file.

Steps to replicate

Version

Gauge version: 0.9.8.nightly-2018-01-19
Commit Hash: 0c66ca4

Plugins
-------
ruby (0.4.3.nightly-2018-01-18)

Add support to filter hooks by tags

Add the ability for users to be able to specify one or more tags when defining hooks. These hooks would be executed when it meets the tag criteria

Linux: unexpected failure message in otherwise successful execution

Expected behavior

No error since the playback looks successful.

Actual behavior

Failed to start Gauge Ruby runner. exit status 1

Steps to reproduce

I run gauge specs from bash on xubuntu.
The playback execution is working

Maybe related to:

warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.1-compliant syntax, but you are running 2.3.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

Gauge version

gauge -v
Gauge version: 0.5.1

Plugins
-------
html-report (2.1.0)
ruby (0.2.1)

creating a debug session using pry or bye bug when

When I enter a debug session using pry or byebug and I enter text
gauge forces me to enter each character on a separate line.

Steps to reproduce ( using pry)

  • create a scenario
  • create a step
  • put binding.pry in the step
  • run gauge specs

when the code reaches the binding.pry it will enter the Pry REPEL
when you enter text it will put one character per line.

INFO] Executing specification: Specification Heading
[INFO] Executing scenario: First scenario
[INFO] hello gauge
[INFO]
INFO pry(main)>
[INFO] e
[INFO] x
[INFO] i
[INFO] t
[INFO] !
[INFO]

I am using the following versions.

Gauge version: 0.2.1

Plugins

html-report (1.1.0)
ruby (0.1.0)

Step implementation parameter count should be validated.

Expected Behaviour

If there is a step implementation such as this:

step 'The word <word> has <count> vowels.' do |word,sdf, expectedCount|
  assert_equal(expectedCount.to_i, count_vowels(word))
end

Then gauge run specs should skip the scenarios using this step.

Actual Behaviour

Gauge continues to execute the steps.

Gauge version

Gauge version: 0.9.1

Plugins
-------
csharp (0.10.1)
html-report (4.0.1)
java (0.6.5)
js (2.0.0)
ruby (0.4.1)
xml-report (0.2.0)

Using table.rows unable to access the column values by column name

Expected behavior
If I am able to access wordsTable[i]['Word'], I should be able to access row['Word']

Actual behavior
This is not implemented and hence we get no implicit conversion of String into Integer

**Steps to replicate

  1. create a project
gauge --init ruby
  1. Give the implementation
require 'test/unit'
include Test::Unit::Assertions

@vowels = nil;

step 'Vowels in English language are <vowels>.' do |vowels|
   @vowels = vowels.scan(/./);
end

step 'The word <word> has <count> vowels.' do |word, expectedCount|
  assert_equal(expectedCount.to_i, count_vowels(word))
end

step 'Almost all words have vowels <table>' do |wordsTable|
  wordsTable.rows().each do |row|
    puts row['Word']
    word = row[0];
    expectedCount = row[1].to_i
    actualCount = count_vowels(word)
    assert_equal(expectedCount, actualCount)
  end
end

def count_vowels(string)
  string.count(@vowels.to_s)
end

This gives the error no implicit conversion of String into Integer

Version

Gauge version: 0.5.1.nightly-2016-07-10

Plugins
-------
html-report (2.1.1.nightly-2016-07-08)
java (0.4.2.nightly-2016-07-07)
ruby (0.2.1)

Update Parser to add ruby 2.3 support.

This warning is thrown by Parser right now:

[INFO] warning: parser/current is loading parser/ruby22, which recognizes

[INFO] warning: 2.2.3-compliant syntax, but you are running 2.2.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

Updating to parser 2.3 should fix it. This should be done when parser 2.3 is released.

Multithread parallel run for Ruby runner

Currently gauge ruby is single threaded. So multi-thread parallel run is not available.
Explore if we can make it event driven so that tests are non blocking, like js

Getting an error even after the successful run

Expected behavior
After running the gauge specs successfully I should not get a failure message

Actual behavior
Getting Failed to start Gauge Ruby runner. exit status 1 after the successful run of gauge specs

Steps to replicate

  1. Create a ruby project
gauge --init ruby
  1. Give the implementation
require 'test/unit'
include Test::Unit::Assertions

@vowels = nil;

step 'Vowels in English language are <vowels>.' do |vowels|
   @vowels = vowels.scan(/./);
end

step 'The word <word> has <count> vowels.' do |word, expectedCount|
  assert_equal(expectedCount.to_i, count_vowels(word))
end

step 'Almost all words have vowels <table>' do |wordsTable|
  wordsTable.rows().each do |row|
    word = row[0];
    expectedCount = row[1].to_i
    actualCount = count_vowels(word)
    assert_equal(expectedCount, actualCount)
  end
end

def count_vowels(string)
  string.count(@vowels.to_s)
end
  1. run the specs.
gauge specs
# Specification Heading
  ## Vowel counts in single word     ✔ ✔
  ## Vowel counts in multiple word   ✔ ✔

Successfully generated html-report to => /Users/sswaroop/work/rubytest/reports/html-report
Failed to start Gauge Ruby runner. exit status 1
Specifications: 1 executed  1 passed    0 failed    0 skipped
Scenarios:  2 executed  2 passed    0 failed    0 skipped

It is successful, but we get the following error
Failed to start Gauge Ruby runner. exit status 1

Unable to start Gauge API

Expected behavior
Gauge specs must be executed when the command gauge specs is run in the command line

Actual behavior
In the released Gauge-ruby version Getting the following exception

/Users/sswaroop/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- gauge_runtime (LoadError)
	from /Users/sswaroop/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'
Ruby runner Failed. Reason: exit status 1
Failed to start gauge API: Runner with pid 44302 quit unexpectedly(exit status 1).

Version

Gauge version: 0.8.4.nightly-2017-05-10

Plugins
-------
html-report (4.0.0.nightly-2017-05-04)
java (0.6.3.nightly-2017-04-21)
ruby (0.4.0)
xml-report (0.2.0)

Duplicate step implementations for steps with no duplicates

Expected behavior
Should get duplicate step implementation only if steps have multiple implementations.

Actual behavior
Switching between spec file and ruby file, we get duplicate step implementation on all steps defined in the file.

Steps to replicate

  • Create a new gauge-ruby project
  • Switch between spec and .rb file

Note: The duplicate step implementation highlight on all steps.

Version

Gauge version: 0.9.8.nightly-2018-01-19
Commit Hash: 0c66ca4

Plugins
-------
ruby (0.4.3.nightly-2018-01-18)

Bug on story getgauge/gauge-vscode#85

Screenshot is being taken even when screenshot_on_failure = false

Expected behavior
In the reports.properties of the gauge-tests ci-ruby if screenshot_on_failure = false then screen shot should not be taken.

Actual behavior
The screen shot should not be taken irrespective of screenshot_on_failure = false

Version

Gauge version: 0.6.2.nightly-2016-08-04

Plugins
-------
csharp (0.9.1.nightly-2016-07-25)
html-report (2.2.0.nightly-2016-08-10)
java (0.5.1.nightly-2016-07-25)
ruby (0.3.1.nightly-2016-07-25)

Add support for sandboxed execution

Depending on the granularity chosen (scenario/spec/suite) the execution should be sandboxed, so that

  • includes are added and destroyed after the run
  • datastore and other states are purged and refreshed

during the lifetime of every scope.

After Refactor statistics are wrong

Expected behavior
Refactoring should indicate the number files i.e specs, concepts, code statistics correctly

Actual behavior
After a successful refactor, one spec and one code file was changed. However the statistics is shown below.

gauge --refactor "Vowels in English language are <vowels>." "sdf"
1 specifications changed.

0 concepts changed.

0 files in code changed.

Steps to replicate

  1. Create a ruby project
gauge --init ruby
  1. Give the implementation
require 'test/unit'
include Test::Unit::Assertions

@vowels = nil;

step 'Vowels in English language are <vowels>.' do |arg_vowels| 
   @vowels = vowels.scan(/./);
end

step 'The word <word> has <count> vowels.' do |word, expectedCount|
  assert_equal(expectedCount.to_i, count_vowels(word))
end

step 'Almost all words have vowels <table>' do |wordsTable|
  wordsTable.rows().each do |row|
    word = row[0];
    expectedCount = row[1].to_i
    actualCount = count_vowels(word)
    assert_equal(expectedCount, actualCount)
  end
end

def count_vowels(string)
  string.count(@vowels.to_s)
end
  1. From the command line execute
gauge --refactor "Vowels in English language are <vowels>." "sdf"

The results show 0 changes in code however the code is successfully changed.

Version

Gauge version: 0.5.1.nightly-2016-07-10

Plugins
-------
html-report (2.1.1.nightly-2016-07-08)
java (0.4.2.nightly-2016-07-07)
ruby (0.2.1)

Unable to complete action gauge init ruby

Expected Behavior
I should be able to create a ruby project.

Actual Behavior
It gives a failure message with incomplete folder structure.

Steps to replicate

  1. On mac, the following steps
  2. gauge --install ruby
  3. mkdir rubytest
  4. cd rubytest
  5. gauge --init ruby
    I get the following failure
create  /Users/sswaroop/rubytest/step_implementations
 create  /Users/sswaroop/rubytest/step_implementations/step_implementation.rb
 create  /Users/sswaroop/rubytest/env/default/ruby.properties
 error  Failed to copy skel/env/ruby.properties. open /Users/sswaroop/rubytest/env/default/ruby.properties: no such file or directory
 create  /Users/sswaroop/rubytest/Gemfile
 append  /Users/sswaroop/rubytest/Gemfile
Running bundle install.. in /Users/sswaroop/rubytest
Failed to start Gauge Ruby runner. exec: "bundle": executable file not found in $PATH
Failed to initialize project. exit status 1

It creates incomplete folder structure.

Version

Gauge version: 0.4.1.nightly-2016-05-18

Plugins
-------
html-report (2.1.1.nightly-2016-05-19)
java (0.4.1.nightly-2016-05-17)
ruby (0.2.0.nightly-2016-05-17)

Find usages statistics are not appearing for a ruby implementation file

Expected behavior
Should be able to see usage statistics

Actual behavior
Statistics not displayed

Steps to replicate

  • gauge init ruby
  • Open a ruby file step_implementation.rb in VSCode

Version

Gauge version: 0.9.8.nightly-2018-01-16
Commit Hash: bd76268

Plugins
-------
ruby (0.4.3.nightly-2018-01-17)

Generate nightly and install locally

  • Version the nightlies
  • Gauge ruby gem should be made available as part of the plugin distributable (nightly only) and allow local install
  • Add build tasks for the above

Closes a network connection when there is a syntax error in ruby file

Expected behavior
Should give me a warning

Actual behavior

-e: /Users/sswaroop/rubytest/step_implementations/step_implementation.rb:7: syntax error, unexpected '|', expecting keyword_end (SyntaxError)
    |@@vowels|
     ^
/Users/sswaroop/rubytest/step_implementations/step_implementation.rb:41: syntax error, unexpected end-of-input, expecting keyword_end
[ValidationError] /Users/sswaroop/rubytest/specs/example.spec:12: Connection closed [[::1]:50844] cause: EOF => 'Vowels in English language are "aeiou".'
[ValidationError] /Users/sswaroop/rubytest/specs/example.spec:19: write tcp [::1]:50840->[::1]:50844: use of closed network connection => 'The word "gauge" has "3" vowels.'
[ValidationError] /Users/sswaroop/rubytest/specs/example.spec:29: write tcp [::1]:50840->[::1]:50844: use of closed network connection => 'Almost all words have vowels <table>'
Failed to start Gauge Ruby runner. exit status 1
  Failed to initialize suite datastore. Error: write tcp [::1]:50840->[::1]:50844: use of closed network connection

Steps to replicate

  1. Create a ruby project
  2. Give the following implementation
@@vowels;

step 'Vowels in English language are <vowels>.' do |vowels|
  @@vowels = Set.new [];
  vowels.scan(/./).each do |vowel|
    @@vowels.add(vowel)
    |@@vowels|
  end
end
  1. run the specs and you will see the error

Version

Gauge version: 0.5.1.nightly-2016-07-10

Plugins
-------
html-report (2.1.1.nightly-2016-07-08)
java (0.4.2.nightly-2016-07-07)
ruby (0.2.1)

Refactoring is giving a undefined method error

Expected Behavior
Refactoring should not give us an error

Actual Behavior
Getting the following error with parameter mismatch in step annotation and implementation.

Cannot perform refactoring: undefined method `children' for nil:NilClass 

Steps to replicate

  1. Create a spec
Specification Heading
=====================
ability to add product
----------------------
tags: shopping basket

* Add "product" to basket1
  1. Create an implementation with parameter mismatch
step 'Add <product> to basket1' do 
  puts product
  assert_equal(product, 'product')
  assert_equal(name, 'Gauge')
end
  1. refactor from the command line
gauge --refactor "Add \"product\" to basket1" "Add \"product\" to basket2"

getting the above error.

Version

Gauge version: 0.6.1.nightly-2016-07-25

Plugins
-------
csharp (0.9.1.nightly-2016-07-25)
html-report (2.1.1.nightly-2016-07-20)
java (0.5.1.nightly-2016-07-25)
ruby (0.3.1.nightly-2016-07-25)

uninitialized constant DataStoreFactory?

gauge-ruby (0.3.1)

In one step define, copy the following lines from the manual:
// Adding value
scenario_store = DataStoreFactory.scenario_datastore;
scenario_store.put("element-id", "455678");

exec gauge specs/ , error occus:
Specification: specs/example.spec:19
Error Message: uninitialized constant DataStoreFactory
Stacktrace:
/home/tigerlei/work/test/step_implementations/step_implementation.rb:7:in block in <top (required)>' /home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/executor.rb:38:in execute_step'
/home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/processors/execute_step_request_processor.rb:30:in process_execute_step_request' /home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/message_processor.rb:52:in call'
/home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/message_processor.rb:52:in process_message' /home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:53:in handle_message'
/home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:37:in dispatch_messages' /home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:76:in module:Runtime'
/home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:29:in <module:Gauge>' /home/tigerlei/.gem/ruby/2.3.0/gems/gauge-ruby-0.3.1/lib/gauge_runtime.rb:27:in <top (required)>'
/usr/local/ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in require' /usr/local/ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require'
/usr/local/ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'

On test failure print step implementation snippet

To easily debug test failures.
Print a snippet of the Step implementation with the line that failed and decrease verbosity of the stack trace.

e.g.

# Specification Heading
  ## Vowel counts in single word	 ✘
        Failed Step: The word "gauge" has "3" vowels.
        Specification: specs/example.spec:18
        Error Message: <3> expected but was
        <4>.
        Stacktrace:
        > 11 | assert_equal(expected_count.to_i, 4)
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:11:in `block in <top (required)>'

  ## Vowel counts in multiple word	 ✘
        Failed Step: Almost all words have vowels
        Specification: specs/example.spec:28
        Error Message: <3> expected but was
        <0>.
        Stacktrace:
        > 20 | assert_equal(expected_count, actual_count)
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:20:in `block (2 levels) in <top (required)>'
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:16:in `each'
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:16:in `block in <top (required)>'


  Error Message: no block given (yield)
  Stacktrace:
  > 29 | assert_fail_assertion()
  /Users/apoorvag/tmp/step_implementations/step_implementation.rb:29:in `block in <top (required)>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.