getgauge / gauge-python Goto Github PK
View Code? Open in Web Editor NEWPython language runner for Gauge
License: MIT License
Python language runner for Gauge
License: MIT License
From @sguptatw on April 20, 2018 1:47
Actual behavior
Statistics are not reflected after a change
07:14:07.195 --> notif: textDocument/didOpen: {"textDocument":{"uri":"file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py","languageId":"python","version":1,"text":"from getgauge.python import step, before_scenario, Messages\n\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\n\ndef number_of_vowels(word):\n return len([elem for elem in list(word) if elem in vowels])\n\n\n# --------------------------\n# Gauge step implementations\n# --------------------------\n\n@step(\"The word \u003cword\u003e has \u003cnumber\u003e vowels.\")\ndef assert_no_of_vowels_in(word, number):\n assert str(number) == str(number_of_vowels(word))\n\n\n@step(\"Vowels in English language \u003cvowels\u003e\")\ndef assert_default_vowels(given_vowels):\n\n Messages.write_message(\"Given vowels are {0}\".format(given_vowels))\n assert given_vowels == \"\".join(vowels)\n\n\n@step(\"Almost all words have vowels \u003ctable\u003e\")\ndef assert_words_vowel_count(table):\n actual = [str(number_of_vowels(word)) for word in table.get_column_values_with_name(\"Word\")]\n expected = [str(count) for count in table.get_column_values_with_name(\"Vowel Count\")]\n assert expected == actual\n\n\n# ---------------\n# Execution Hooks\n# ---------------\n\n@before_scenario()\ndef before_scenario_hook():\n assert \"\".join(vowels) == \"aeiou\"\n\n@step(\"some\")\ndef some():\n assert False, \"Add implementation code\"\n\n@step(\"something\")\ndef something():\n assert False, \"Add implementation code\"\n\n@step(\"aaa\")\ndef aaa():\n assert False, \"Add implementation code\"\n"}}
07:14:07.544 <-- notif: textDocument/publishDiagnostics: {"uri":"file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/specs/some.spec","diagnostics":[{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":16}},"severity":1,"code":"@step(\"implement step\")\ndef implement_step():\n assert False, \"Add implementation code\"\n","message":"Step implementation not found"}]}
07:14:08.160 --> request #24: textDocument/codeLens: {"textDocument":{"uri":"file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py"}}
07:14:08.160 --> notif: $/cancelRequest: {"id":24}
07:14:08.290 <-- result #24: textDocument/codeLens: [{"range":{"start":{"line":13,"character":0},"end":{"line":13,"character":14}},"command":{"title":"0 reference(s)","command":"gauge.showReferences","arguments":["file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py",{"line":13,"character":0},"The word {} has {} vowels."]}},{"range":{"start":{"line":18,"character":0},"end":{"line":18,"character":14}},"command":{"title":"0 reference(s)","command":"gauge.showReferences","arguments":["file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py",{"line":18,"character":0},"Vowels in English language {}"]}},{"range":{"start":{"line":25,"character":0},"end":{"line":25,"character":14}},"command":{"title":"0 reference(s)","command":"gauge.showReferences","arguments":["file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py",{"line":25,"character":0},"Almost all words have vowels {}"]}},{"range":{"start":{"line":40,"character":0},"end":{"line":40,"character":14}},"command":{"title":"0 reference(s)","command":"gauge.showReferences","arguments":["file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py",{"line":40,"character":0},"some"]}},{"range":{"start":{"line":44,"character":0},"end":{"line":44,"character":14}},"command":{"title":"1 reference(s)","command":"gauge.showReferences","arguments":["file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py",{"line":44,"character":0},"something"]}},{"range":{"start":{"line":48,"character":0},"end":{"line":48,"character":14}},"command":{"title":"1 reference(s)","command":"gauge.showReferences","arguments":["file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py",{"line":48,"character":0},"aaa"]}}]
07:14:08.471 --> notif: textDocument/didChange: {"textDocument":{"uri":"file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py","version":2},"contentChanges":[{"text":"from getgauge.python import step, before_scenario, Messages\n\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\n\ndef number_of_vowels(word):\n return len([elem for elem in list(word) if elem in vowels])\n\n\n# --------------------------\n# Gauge step implementations\n# --------------------------\n\n@step(\"The word \u003cword\u003e has \u003cnumber\u003e vowels.\")\ndef assert_no_of_vowels_in(word, number):\n assert str(number) == str(number_of_vowels(word))\n\n\n@step(\"Vowels in English language \u003cvowels\u003e\")\ndef assert_default_vowels(given_vowels):\n\n Messages.write_message(\"Given vowels are {0}\".format(given_vowels))\n assert given_vowels == \"\".join(vowels)\n\n\n@step(\"Almost all words have vowels \u003ctable\u003e\")\ndef assert_words_vowel_count(table):\n actual = [str(number_of_vowels(word)) for word in table.get_column_values_with_name(\"Word\")]\n expected = [str(count) for count in table.get_column_values_with_name(\"Vowel Count\")]\n assert expected == actual\n\n\n# ---------------\n# Execution Hooks\n# ---------------\n\n@before_scenario()\ndef before_scenario_hook():\n assert \"\".join(vowels) == \"aeiou\"\n\n@step(\"some\")\ndef some():\n assert False, \"Add implementation code\"\n\n@step(\"something\")\ndef something():\n assert False, \"Add implementation code\"\n\n@step(\"aaa\")\ndef aaa():\n assert False, \"Add implementation code\"\n\n@step(\"implement step\")\ndef implement_step():\n assert False, \"Add implementation code\"\n"}]}
07:14:08.472 --> request #25: textDocument/codeLens: {"textDocument":{"uri":"file:///c%!A(MISSING)/work/testFolder/pythonexamples/basic1/step_impl/step_impl.py"}}
07:14:08.673 <-- result #25: textDocument/codeLens: null
Steps to replicate
gauge-python
projectVersion
Gauge version: 0.9.8.nightly-2018-04-19
Commit Hash: 58298e2
Plugins
-------
python (0.3.0.nightly-2018-04-18)
Copied from original issue: getgauge/gauge#1014
Expected behavior
Remove the unused property
Actual behavior
In a newly created python project, python.properties has a property PYTHONUNBUFFERED
. This is an unused property
Steps to replicate
Version
Gauge version: 0.9.8.nightly-2018-03-06
Commit Hash: 4f23723
Plugins
-------
python (0.2.4.nightly-2018-03-06)
Actual behavior
The IDE features are not working as expected
Steps to replicate
IDE features are not available
Version
Gauge version: 0.9.8
Commit Hash: 61d692c
Plugins
-------
python (0.3.0.nightly-2018-04-13)
Pip Version
Name: getgauge
Version: 0.3.0.dev20180413
Summary: Enables Python support for Gauge
Home-page: https://github.com/getgauge/gauge-python
Author: Gauge Team
Author-email: [email protected]
License: MIT
Location: /Users/sswaroop/Library/Python/2.7/lib/python/site-packages
Requires: protobuf, redBaron, ptvsd, grpcio
Actual behavior
The CPU usage on starting a gauge-python
project is almost 100%
Steps to replicate
gauge-python
projectNote the CPU usage
Expected behavior
Should be able to debug without getting an error
Actual behavior
Getting the following errors
Steps to replicate
gauge-python
project.The above error was observed on Windows.
Version
Gauge version: 0.9.8.nightly-2018-02-28
Commit Hash: d997b9a
Plugins
-------
python (0.2.4.nightly-2018-02-28)
Bug on story #33
Expected behavior
Should be able to run specs
Actual behavior
Getting the following error
Traceback (most recent call last):
File "start.py", line 6, in <module>
from getgauge import api
ModuleNotFoundError: No module named 'getgauge'
Failed to start gauge API: Runner with pid 12876 quit unexpectedly(exit status 1).
Steps to replicate
gauge init python
gauge run specs
Version
python
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Gauge version: 0.9.8.nightly-2018-01-19
Commit Hash: 0c66ca4
Plugins
----------
python (0.2.3)
Refer getgauge/gauge-csharp#55
Expected behavior
The init.py files are required to make Python treat the directories as containing packages; This should not be listed for where to generate the step implementation.
Actual behavior
The init.py is being listed in the file list suggestions
Steps to replicate
Create step implementation
In the list of files that come up, init.py is shown. This should not be in the list
Version
Gauge version: 0.9.8
Plugins
-------
csharp (0.10.2.nightly-2018-03-27)
email-report (0.0.1)
html-report (4.0.4.nightly-2018-03-28)
java (0.6.7.nightly-2018-03-16)
js (2.2.0.nightly-2018-03-29)
python (0.2.5)
report-seed (0.0.1)
ruby (0.4.3.nightly-2018-03-16)
screenshot (0.0.1)
xml-report (0.2.1.nightly-2018-03-28)
pip show getgauge
Name: getgauge
Version: 0.2.5
Summary: Enables Python support for Gauge
Home-page: https://github.com/getgauge/gauge-python
Author: Gauge Team
Author-email: [email protected]
License: MIT
Location: c:\python36\lib\site-packages
Requires: protobuf, redBaron, ptvsd
You are using pip version 9.0.2, however version 9.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Running the example test after gauge init python
(0.9.0) with an empty @before_step()
or @after_step()
hook results in an error. This problem does not occur e.g. with the Ruby language runner using gauge init ruby
.
Expected behavior: no error, all tests run and pass OK
Actual behavior:
$ gauge run
Python: 3.6.1
Exception occurred while loading step implementations from file: step_impl\step_impl.py.
Traceback (most recent call last):
File "C:\conda3\lib\site-packages\getgauge\impl_loader.py", line 50, in import_file
importlib.import_module(os.path.splitext(rel_path.replace(os.path.sep, '.'))[0])
File "C:\conda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\bdd-demo\test\step_impl\step_impl.py", line 40, in <module>
@before_step()
TypeError: before_step() missing 1 required positional argument: 'obj'
# Specification Heading
## Vowel counts in single word P P
## Vowel counts in multiple word P P
Successfully generated html-report to => C:\bdd-demo\test\reports\html-report
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 2 executed 2 passed 0 failed 0 skipped
Total time taken: 140ms
gauge init python
in itstep_impl/step_impl.py
:@before_step()
def before_step_hook():
pass
gauge run
getgauge
package version: 0.2.0I have Windows 10 and Python 3.6.4 installed.
When I run the gauge init python example the following error occurs
Traceback (most recent call last):
File "start.py", line 4, in <module>
from colorama import Style, init
ModuleNotFoundError: No module named 'colorama'
Failed to start gauge API: Runner with pid 6576 quit unexpectedly(exit status 1).
I would assume with a fresh gauge python project, running the example would simply work
gauge init python
gauge run
Gauge version: 0.9.7
Commit Hash: bc9784c
Plugins
-------
gauge-jira (0.0.1)
html-report (4.0.3)
java (0.6.6)
js (2.1.0)
report-seed (0.0.1)
screenshot (0.0.1)
spectacle (0.1.2)
xml-report (0.2.0)
Expected behavior
Should be able to run spec after generating the step from spec
Actual behavior
from getgauge. python import step
is added after the step definitions. So getting TypeError: 'NoneType' object is not callable
Steps to replicate
gauge-python
projectThe type error is displayed
Version
Gauge version: 0.9.8.nightly-2018-04-26
Commit Hash: 5bd699e
Plugins
-------
python (0.3.0.nightly-2018-04-25)
Related to issue getgauge/gauge-vscode#119
From @sguptatw on February 12, 2018 10:43
Actual behavior
Refactoring is successful, but the specification file starts showing parse errors for the refactored step.
Steps to replicate
gauge-python
projectThe word "gauge" has "3" vowels.
to The word "gauge" has "3" vowels something
Note: The implementation file and specification file have changed. The refactoring is successful. But the newly refactored step is shown as undefined.
Version
Gauge version: 0.9.8.nightly-2018-02-02
Commit Hash: bff4f46
Plugins
-------
python (0.2.4.nightly-2018-02-11)
Bug on story - getgauge/gauge-vscode#81
Copied from original issue: getgauge/gauge-vscode#137
Expected behavior
Duplicate step implementation should be given only when current impl files have duplicate implementations
Actual behavior
Renaming an impl file gives duplicate step implementation
Steps to replicate
gauge-python
projectDuplicate step implementations given in diagnostics
Version
Gauge version: 0.9.8.nightly-2018-04-26
Commit Hash: 5bd699e
Plugins
-------
csharp (0.10.3.nightly-2018-04-11)
html-report (4.0.4.nightly-2018-04-11)
java (0.6.7.nightly-2018-04-24)
js (2.2.0.nightly-2018-04-20)
python (0.3.0.nightly-2018-04-26)
ruby (0.5.0.nightly-2018-04-16)
screenshot (0.0.1)
xml-report (0.2.1.nightly-2018-04-05)
On both 0.1.3 and 0.1.2 versions of the plugin, I am getting this error when trying to initialize a new project:
Traceback (most recent call last):
File "./start.py", line 5, in
from getgauge.impl_loader import load_impls, copy_skel_files
ImportError: cannot import name copy_skel_files
Failed to initialize project. exit status 1
System Info:
MacOS 10.11.3
Python 2.7.12
getgauge 0.0.4
Gauge 0.5.0
I've successfully installed the python plugin version 0.1.1 and it initializes the project just fine. It's only the last 2 versions that aren't working for me.
Expected behavior
gauge run should work seamlessly
Actual behavior
Getting Connection refused error
Failed Step: Execute the spec "basic context execution" and ensure failure
Specification: specs/terminologies/context_execution.spec:85
Error Message: java.lang.AssertionError: [Execute : gauge run --simple-console --verbose specs/basic context execution.spec]
Command "run --simple-console --verbose specs/basic context execution.spec" did not complete successfully.
STDOUT:
Python: 3.6.4
Traceback (most recent call last):
File "start.py", line 36, in <module>
main()
File "start.py", line 19, in main
s = connection.connect()
File "/Users/vagrant/Library/Python/3.6/lib/python/site-packages/getgauge/connection.py", line 10, in connect
s.connect(('127.0.0.1', int(os.environ['GAUGE_INTERNAL_PORT'])))
ConnectionRefusedError: [Errno 61] Connection refused
[ValidationError] /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/specs/basic context execution.spec:4 Connection closed [127.0.0.1:65486] cause: EOF => 'First context'
[ValidationError] /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/specs/basic context execution.spec:5 write tcp 127.0.0.1:65500->127.0.0.1:65486: use of closed network connection => 'Second context'
[ValidationError] /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/specs/basic context execution.spec:9 write tcp 127.0.0.1:65500->127.0.0.1:65486: use of closed network connection => 'First Scenario step'
[ValidationError] /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/specs/basic context execution.spec:13 write tcp 127.0.0.1:65500->127.0.0.1:65486: use of closed network connection => 'Second Scenario step'
[ValidationError] /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/specs/basic context execution.spec:18 write tcp 127.0.0.1:65500->127.0.0.1:65486: use of closed network connection => 'Normal step3'
[ValidationError] /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/specs/basic context execution.spec:19 write tcp 127.0.0.1:65500->127.0.0.1:65486: use of closed network connection => 'Normal step4'
Failed to initialize suite datastore. Error: write tcp 127.0.0.1:65500->127.0.0.1:65486: use of closed network connection
Successfully generated html-report to => /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/context_exec87_883696489502404363/reports/html-report/index.html
Specifications: 0 executed 0 passed 0 failed 0 skipped
Scenarios: 0 executed 0 passed 0 failed 0 skipped
Total time taken: 42ms
STDERR:
Stacktrace:
org.assertj.core.api.AbstractAssert.failWithMessage(AbstractAssert.java:112)
com.thoughtworks.gauge.test.common.ExecutionSummaryAssert.hasSuccess(ExecutionSummaryAssert.java:122)
com.thoughtworks.gauge.test.implementation.Execution.assertOn(Execution.java:109)
com.thoughtworks.gauge.test.implementation.Execution.executeSpecAndEnsureFailure(Execution.java:94)
Observed on
At the scenario level, the DataStoreFactory get command fails and returns a keyerror instead of the value previously entered.
getgauge
package version, run pip3 show getgauge
to get it: Version: 0.2.1Actual behavior
Only the basic template is available
Proposed behavior
python-selenium
for initializing a project with webdriver.Version
Gauge version: 0.9.8.nightly-2018-03-05
Commit Hash: 63aeb3b
Plugins
-------
python (0.2.4.nightly-2018-02-28)
Expected behavior
Should capture screenshot on failure
Actual behavior
Getting Failed to take screenshot using gauge_screenshot.
Steps to replicate
gauge-python
projectSpecification 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
* Vowels in English language are "aeiu".
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 |
Failed to take screenshot using gauge_screenshot.
[Errno 2] No such file or directory
Version
Gauge version: 0.9.8.nightly-2018-02-26
Commit Hash: 77c642d
Plugins
-------
dotnet (0.0.1.nightly-2018-02-14)
html-report (4.0.4.nightly-2018-01-11)
java (0.6.7.nightly-2018-02-23)
js (2.1.1.nightly-2018-02-27)
python (0.2.4.nightly-2018-02-27)
ruby (0.4.3.nightly-2018-02-13)
spectacle (0.1.3.nightly-2017-10-26)
Expected behavior
The messages in hooks should be displayed
Actual behavior
The message from step hooks are displayed but others are not
Steps to replicate
gauge-python
project
@before_scenario()
def before_scenario_hook():
assert "".join(vowels) == "aeiou"
Messages.write_message("before scenario")
@before_step
def before_step_hook():
Messages.write_message("before step hook")
@after_step
def after_step_hook():
Messages.write_message("after step hook")
@before_scenario
def before_scenario_hook1():
Messages.write_message("before scenario hook")
@after_scenario
def after_scenario_hook():
Messages.write_message("after scenario hook")
@before_spec
def before_spec_hook():
Messages.write_message("before spec hook")
@after_spec
def after_spec_hook():
Messages.write_message("after spec hook")
@before_suite
def before_suite_hook():
Messages.write_message("before suite hook")
@after_suite
def after_spec_hook1():
Messages.write_message("after suite hook")
In the html-report, only step hooks are displayed
Version
Gauge version: 0.9.8.nightly-2018-04-19
Commit Hash: 58298e2
Plugins
-------
html-report (4.0.4.nightly-2018-04-11)
java (0.6.7.nightly-2018-04-19)
python (0.3.0.nightly-2018-04-18)
ruby (0.5.0.nightly-2018-04-16)
xml-report (0.2.1.nightly-2018-04-05)
PS <user>> pip show getgauge
Name: getgauge
Version: 0.3.0.dev20180418
Summary: Enables Python support for Gauge
Home-page: https://github.com/getgauge/gauge-python
Author: Gauge Team
Author-email: [email protected]
License: MIT
Location: c:\python36\lib\site-packages
Requires: protobuf, redBaron, ptvsd, grpcio
You are using pip version 9.0.2, however version 10.0.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
From @galacticgumshoe
In order to use Python 3 on mac, I have to use 'python3' command. Otherwise, if I just run 'python' command it runs as Python 2(default version). Getgauge
package uses python
command to run the tests, So it uses python 2 and mac doesn't recommend to change the default python to python3 because many Apple- or third-party software are dependent on that(https://docs.python.org/3/using/mac.html).
There should be a mechanism where users can specify the python version which will be used to run the specs. For more details refer #5.
Expected behavior
If python nightly is python (0.2.5.nightly-2018-03-20), then the user should be able to install
pip install --pre getgauge==0.2.5.dev.20180320
Actual behavior
Getting the error
Could not find a version that satisfies the requirement getgauge==0.2.5.dev.20180320 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4.dev20180207, 0.2.4.dev20180208, 0.2.4.dev20180209, 0.2.4.dev20180211, 0.2.4.dev20180215, 0.2.4.dev20180216, 0.2.4.dev20180220, 0.2.4.dev20180223, 0.2.4.dev20180227, 0.2.4.dev20180228, 0.2.4.dev20180302, 0.2.4.dev20180306, 0.2.4.dev20180307, 0.2.4.dev20180308, 0.2.4.dev20180312, 0.2.4.dev20180316, 0.2.5.dev20180319, 0.2.5)
No matching distribution found for getgauge==0.2.5.dev.20180320
Steps to replicate
pip install --pre getgauge==0.2.5.dev.20180320
Getting the above error
Current behavior
pip install getgauge is required
Proposed behavior
A user with only gauge installed should be able to work after initializing a project
Steps to replicate
gauge run specs
gives Failed to start gauge APIgauge-python plugin is installed but getgauge is not installed on pip
Version
Gauge version: 0.9.8.nightly-2018-04-19
Commit Hash: 58298e2
Plugins
-------
html-report (4.0.4.nightly-2018-04-11)
python (0.3.0.nightly-2018-04-18)
Related to getgauge/gauge-vscode#211
Every time we set up a new machine to run the gauge python, I run into issue where
from getgauge import api
step fails.
We have to remove , reinstall and somehow it comes. Or manually get the getgauge files and put it there from other machine.
We follow the instructions given here : http://gauge-python.readthedocs.io/en/latest/installation.html
and always used pip to install the getgauge
getgauge
package version, run pip3 show getgauge
to get it : 0.1.7Hi I keep getting
Plugin python 0.0.2 is already installed.
Philip-Beadle-MacBook-Pro:specs philipbeadle$ gauge --init python
create manifest.json
create specs
create specs/example.spec
create env
create env/default
create env/default/default.properties
Traceback (most recent call last):
File "./start.py", line 4, in <module>
from getgauge import connection, processor
ImportError: No module named getgauge
Failed to initialize. exit status 1
and theres no steps file created either.
Getting the network connection closed
Traceback (most recent call last):
File "start.py", line 26, in <module>
main()
File "start.py", line 22, in main
processor.dispatch_messages(s)
File "C:\Python36\lib\site-packages\getgauge\processor.py", line 215, in dispatch_messages
processors[request.messageType](request, response, socket)
File "C:\Python36\lib\site-packages\getgauge\processor.py", line 144, in _cache_file
reload_steps(request.cacheFileRequest.content, request.cacheFileRequest.filePath)
File "C:\Python36\lib\site-packages\getgauge\static_loader.py", line 26, in reload_steps
load_steps(content, file_name)
File "C:\Python36\lib\site-packages\getgauge\static_loader.py", line 13, in load_steps
red = RedBaron(content)
File "C:\Python36\lib\site-packages\redbaron\redbaron.py", line 36, in __init__
self.node_list = base_nodes.NodeList.from_fst(baron.parse(source_code), parent=self, on_attribute="root")
File "C:\Python36\lib\site-packages\baron\baron.py", line 49, in parse
tokens = tokenize(source_code, False)
File "C:\Python36\lib\site-packages\baron\baron.py", line 70, in tokenize
return mark_indentation(inner_group(space_group(_tokenize(group(split(pouet)), print_function))))
File "C:\Python36\lib\site-packages\baron\indentation_marker.py", line 24, in mark_indentation
return list(mark_indentation_generator(sequence))
File "C:\Python36\lib\site-packages\baron\indentation_marker.py", line 85, in mark_indentation_generator
the_indentation_level_changed = get_space(current) is None or get_space(current) != indentations[-1]
File "C:\Python36\lib\site-packages\baron\indentation_marker.py", line 38, in get_space
if len(node) < 3 or len(node[3]) == 0:
Expected behavior
Clicking on the stacktrace should take the user to the code line with the issue
Actual behavior
It takes the user to the next line of the code with the issue
Steps to replicate
gauge-python
projectThe user is taken to the next line where the error occurred.
Version
Gauge version: 0.9.8.nightly-2018-04-26
Commit Hash: 5bd699e
Plugins
-------
python (0.3.0.nightly-2018-04-26)
Hi,
I was running my gauge python code, and I found a problem.
Let's say there is an a.py, it has an @step
decorator like below:
from getgauge.python import step
@step('run a')
def this_is_a():
print('running a')
def this_is_another_a():
print('running another a')
And there is another script, let's say b.py that imports a.py as below:
from step_impl.ZeusLibrary import a
from getgauge.python import step
@step('run b')
def this_is_b():
a.this_is_another_a()
Now let's run the gauge spec as below shows:
Spec
=====================
Case
------------------
* run a
* run b
, it will throw ValidationError because it cannot find @step('run a')
.
The workaround is if I want to use the function in a.py, I must import it inside a function in b.py instead of importing it globally.
Console output as below:
Python: 3.5.2
[ValidationError] /Users/xxx/Documents/xxx/specs/1.spec:7: 1 => 'run a'
Creating tagged execution hooks does not work for specs (untested with scenarios).
The table of values referenced in this issue:
| search_terms |
| MKS Instruments |
| RF Power Generator |
| PECVD plasma enhanced vapour deposition |
Having a table of values at the specification level causes tags
to be lost/ignored within the execution context. This can be verified by using the following execution hooks:
# ---------------
# Execution Hooks
# ---------------
@before_spec()
def before_spec(exec_cxt):
print("\nbefore_scenario_hook: websearch\n")
print(exec_cxt)
context.driver = webdriver.Chrome()
context.driver.implicitly_wait(10)
@after_spec()
def after_spec(exec_cxt):
print("\nafter_scenario_hook: websearch\n")
print(exec_cxt)
context.driver.quit()
This produces output like:
$ gauge --tags "websearch" specs
Python: 3.6.1
# Web Search
before_scenario_hook: websearch
ExecutionInfo: { Specification: { name: Web Search, is_failing: False, tags: , file_name: C:\test\gauge\specs\websearch.spec }, Scenario: { name: , is_failing: False, tags: }, Step: { text: , is_failing: False } }
## User visits google.com P P P P
|search_terms |
|---------------|
|MKS Instruments|
## User searches using google.com P P P P
|search_terms |
|------------------|
|RF Power Generator|
## User searches using google.com P P P P
|search_terms |
|---------------------------------------|
|PECVD plasma enhanced vapour deposition|
## User searches using google.com P P P P
after_scenario_hook: websearch
ExecutionInfo: { Specification: { name: Web Search, is_failing: False, tags: , file_name: C:\test\gauge\specs\websearch.spec }, Scenario: { name: User searches using google.com, is_failing: False, tags: google search }, Step: { text: Element "//div[@id='resultStats']" appears within "5" seconds, is_failing: False } }
Successfully generated html-report to => C:\test\gauge\reports\html-report
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 2 executed 2 passed 0 failed 0 skipped
Total time taken: 14.827s
In particular, notice that ExecutionInfo['Specification']['tags']
is EMPTY.
Removing the table of values and any scenarios that use <search_terms>
results in ExecutionInfo['Specification']['tags']
being populated correctly. Instructions for doing this are provided in the Workarounds section under Steps to Reproduce.
Output when spec-level tables and scenarios that use them are removed:
$ gauge --tags "websearch" specs
Python: 3.6.1
# Web Search
before_scenario_hook: websearch
ExecutionInfo: { Specification: { name: Web Search, is_failing: False, tags: websearch, file_name: C:\test\gauge\specs\websearch.spec }, Scenario: { name: , is_failing: False, tags: }, Step: { text: , is_failing: False } }
## User visits google.com P P P P
after_scenario_hook: websearch
ExecutionInfo: { Specification: { name: Web Search, is_failing: False, tags: websearch, file_name: C:\test\gauge\specs\websearch.spec }, Scenario: { name: User visits google.com, is_failing: False, tags: visit google }, Step: { text: Look for "//input[@value='Google Search']", is_failing: False } }
Successfully generated html-report to => C:\test\gauge\reports\html-report
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 1 executed 1 passed 0 failed 0 skipped
Total time taken: 8.986s
In particular, notice that ExecutionInfo['Specification']['tags']
is NOT EMPTY.
This behavior may be a bug with Gauge itself.
Install selenium. Install Chrome webdriver to PATH
.
step_impl/websearch.py
Note that the @before_spec
and @after_spec
hooks are tagged with websearch
from getgauge.python import *
# step, after_suite, Messages, DataStoreFactory
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
# ---------------
# Execution Hooks
# ---------------
@before_spec("<websearch>")
def before_spec():
context.driver = webdriver.Chrome()
context.driver.implicitly_wait(10)
@after_spec("<websearch>")
def after_spec():
context.driver.quit()
class Context(object):
pass
context = Context()
# --------------------------
# Gauge step implementations
# --------------------------
@step('Visit <url>')
def test_visit_url(url):
if not (url.startswith("http://") or url.startswith("https://")):
context.driver.get("http://"+ url)
else:
context.driver.get(url)
assert url in context.driver.current_url
@step('Look for <xpath>')
def test_find_element(xpath):
try:
e = context.driver.find_element_by_xpath(xpath)
except:
Messages.write_message('Could not find element with xpath "%s"' % xpath)
assert isinstance(e, WebElement) is True
return e
@step('Element <xpath> appears within <wait_time> seconds')
def test_wait_and_find_element(xpath, wait_time):
try:
e = WebDriverWait(context.driver, float(wait_time)).until(EC.presence_of_element_located((By.XPATH, xpath)))
except:
Messages.write_message('Could not find element with xpath "%s"' % xpath)
assert isinstance(e, WebElement) is True
return e
@step('Enter <search_terms> into <xpath>')
def test_enter_data_into_element(search_terms, xpath):
e = test_find_element(xpath)
e.send_keys(search_terms)
assert e.get_attribute('value') == search_terms
@step('Click <xpath>')
def test_click_element(xpath):
e = test_find_element(xpath)
e.click()
specs/websearch.spec
# Web Search
Tags: websearch
| search_terms |
| MKS Instruments |
| RF Power Generator |
| PECVD plasma enhanced vapour deposition |
This is a demo specification for puppeting a Google Chrome instance which is used to search the web.
To execute this specification, run
gauge specs
## User visits google.com
Tags: visit google
In this scenario, the user visits google.com and sees: the google logo (img), a search box (input), and a search button (input).
* Visit "google.com"
* Look for "//img[@alt='Google']"
* Look for "//input[@name='q' and @value='']"
* Look for "//input[@value='Google Search']"
## User searches using google.com
Tags: google search
In this scenario, the user navigates to google.com and performs a few searches.
* Visit "google.com"
* Enter <search_terms> into "//input[@name='q']"
* Click "//button[@value='Search' and @aria-label='Google Search']"
* Element "//div[@id='resultStats']" appears within "5" seconds
gauge
gauge --tags "websearch" specs
Expected behaviour:
The before_spec
and after_spec
hooks are executed, correctly instantiating the Selenium webdriver at the start of the spec and then closing the browser at the end of the spec.
Actual behaviour:
None of the tagged-execution hooks are run.
Workarounds:
<search_terms>
table at specification level. Remove any scenarios that use <search_terms>
.Updated specs/websearch.spec
# Web Search
Tags: websearch
This is a demo specification for puppeting a Google Chrome instance which is used to search the web.
To execute this specification, run
gauge specs
## User visits google.com
Tags: visit google
In this scenario, the user visits google.com and sees: the google logo (img), a search box (input), and a search button (input).
* Visit "google.com"
* Look for "//img[@alt='Google']"
* Look for "//input[@name='q' and @value='']"
* Look for "//input[@value='Google Search']"
This is undesirable because it requires removing tests, or defining them in an inconvenient manner (e.g. hardcoded values instead of dynamic values from table).
# ---------------
# Execution Hooks
# ---------------
@before_spec()
def before_spec():
context.driver = webdriver.Chrome()
context.driver.implicitly_wait(10)
@after_spec()
def after_spec():
context.driver.quit()
Unfortunately, now the before_spec
and after_spec
hooks will be run for ALL specs (undesirable for suites containing multiple disparate specs).
getgauge
package version, run pip3 show getgauge
to get it: 0.2.0Expected behavior
Should not get use of closed network connection
Actual behavior
Getting the error
Steps to replicate
gauge init python
Generate stub
for this step - copy the implementation* The word "gauge" has "3" vowels.
Note: We get the error -
use of closed network connection Code: 0
Version
Gauge version: 0.9.8.nightly-2018-02-15
Commit Hash: dfbaee0
Plugins
-------
python (0.2.4.nightly-2018-02-16)
Bug on story #19
I have initialized my gauge project at ~/GitHub/sceo-test-suite on my local system. I have a docker compose file which I am running to simulate my testing environment, and I placed that in a new directory called ~/GitHub/sceo-test-suite/compose/message-pull-producer. So far I've had to "hard code" an absolute path to this file in my Python code (/Users/myuser/GitHub/sceo-test-suite/compose/message-pull-producer), which won't work if any of my other co-workers wants to clone this project and run it on their systems. I also need to promote this to a Ubuntu OpenStack server in my CICD environment to automate the system tests. So I really need relative pathing to work. For example, if I am currently in ~/GitHub/sceo-test-suite and I run 'gauge --dir . specs' I get this error when my Python code is using os.getcwd():
.IOError: [Errno 2] No such file or directory: '/Users/myuser/.gauge/plugins/python/0.1.3/compose/message-pull-producer-environment/docker-compose.yml'
You can see that my present working directory has somehow shifted from where I executed the gauge command to start in ~/.gauge/plugins/python/0.1.3. It expects then that I essentially have initialized my project in the plugin subdirectory and will always be working from there. Effectively ignoring the '--dir .' I passed in at runtime.
Actual behavior
IDE features stops working after a couple of projects are added to the workspaces
Steps to replicate
Note: Currently I am able to work with 2 projects in workspace. For the third project, IDE features do not work as expected. This may be a performance issue. The number of projects to be added to replicate the issue can differ.
Version
Gauge version: 0.9.8
Commit Hash: 8166611
Plugins
-------
python (0.2.4.nightly-2018-02-11)
Proposed behavior
User should be indicated about the mismatch until it is fixed
Current behavior
The user can see the mismatch by comparing
gauge version
and pip show getgauge
When I run tests in Gauge and they fail, I expect Gauge to take screenshots and put them into the fancy html report. Currently they do not, we see "Failed to take screenshot using gauge screenshot"
getgauge
: 0.2.2Error in running gauge python suite after latest update.
Remove all and reinstall from scratch
update getgauge to latest 0.2.2/0.2.3 [both tried]
Same configuration on another machine with High Sierra works fine.
Getting error while running the default project -
gauge run specs/
TEST: opening 'start'
Python: 2.7.10
[ValidationError] /Users/ets-qa-macmini/Documents/tesproj/specs/example.spec:12 Step implementation not found => 'Vowels in English language are "aeiou".'
api.log shows below
19:36:41.518 Sending API response: messageType:UnsupportedApiMessageResponse messageId:42 unsupportedApiMessageResponse:<>
10:33:18.465 Api Request Received: messageType:GetStepValueResponse messageId:165 stepValueRequest:<stepText:"The word has vowels." >
getgauge
package version, run pip show getgauge
to get itExpected behavior
If screenshot is not installed, it should be installed and screenshot should be captured
Actual behavior
Getting the error
Failed to take screenshot using gauge_screenshot.
[WinError 2] The system cannot find the file specified
Steps to replicate
screenshot
is uninstalled/not installed.gauge-python
project@before_suite
def before_suite_hook():
assert 1==2
Messages.write_message("before suite hook")
The above errors is displayed
A nightly pipeline should be configured for python.
Expected behavior
The parameter names in signature should be independent of parameter values
Actual behavior
The names generated for the parameter is based on the parameter value
Steps to replicate
gauge-python
projectUpload file <file:specs/something.txt>
The implementation has the file path mentioned in the annotation text
@step("Upload file:specs/something.txt")
def upload(file:specs/something.txt):
assert False, "Add implementation code"
Version
Gauge version: 0.9.8.nightly-2018-03-29
Commit Hash: b79de74
Plugins
-------
html-report (4.0.4.nightly-2018-03-28)
python (0.2.6.nightly-2018-03-26)
screenshot (0.0.1)
Expected behavior
Should be able to execute specs
Actual behavior
[Error - 11:20:58] Failed to read execution status information. Reason: File /Users/sswaroop/work/python/basic/.gauge/executionStatus.json doesn't exist.
[Info - 11:20:58] Connection to server got closed. Server will restart.
Steps to replicate
Version
Gauge version: 0.9.8.nightly-2018-02-13
Commit Hash: 7d3dc0a
Plugins
-------
python (0.2.4.nightly-2018-02-11)
Expected behavior
When a shutdown/exit call is made by the client, the Python orphan process should be killed
Actual behavior
The Python orphan process is not killed
Steps to replicate
There are orphan Python processes.
Version
Gauge version: 0.9.8
Commit Hash: 61d692c
Plugins
-------
python (0.3.0.nightly-2018-04-13)
I'm getting an error running gauge --init python. I have installed getgauge-0.1.1.
Please advise.
Thanks, Bernd
$ gauge --init python
create manifest.json
create specs
create specs/example.spec
create env
create env/default
create env/default/default.properties
/usr/bin/env: python -u: No such file or directory
$ gauge -v
Gauge version: 0.4.0
Plugins
-------
html-report (2.1.0)
java (0.3.4)
python (0.1.1)
Vscode debugger should be attached when user debug mode is on
Change the package name and structure so that it's
from gauge import step, before_scenario, Messages
Maintain backward compatibility by adding deprecations in the old style i.e
from getgauge.python import step, before_scenario, Messages
Expected behavior
Should be able to debug seamlessly
Actual behavior
Debug adapter process has terminated unexpectedly
Steps to replicate
gauge-python
projectThe message appears
Debug adapter process has terminated unexpectedly
Version
Gauge version: 0.9.8.nightly-2018-04-26
Commit Hash: 5bd699e
Plugins
-------
python (0.3.0.nightly-2018-04-26)
Runner console logs should be logged to the log file when started as daemon.
When gauge is running as lsp server, runner console should be redirected to lsp.log.
When gauge is running as api daemon, runner console should be redirected to api.log.
In the above two cases, runner should log to the log files with proper formatting. Current log file format for gauge is 'HH:MM:ss.l'. (eg :- 12:50:11.221)
When gauge is started in CLI, console should be the standard output. It should not log with timestamp.
I installed gauge-python with gauge --install python
, made the init gauge --init python
then tried to run it with gauge specs/example.spec
but the result is not really what I expected :).
Did I missed something?
gauge specs/example.spec
# Specification Heading
## Vowel counts in single word Traceback (most recent call last):
File "./start.py", line 18, in <module>
main()
File "./start.py", line 14, in main
processor.dispatch_messages(s)
File "/usr/local/lib/python2.7/site-packages/getgauge/processor.py", line 142, in dispatch_messages
processors[request.messageType](request, response, socket)
File "/usr/local/lib/python2.7/site-packages/getgauge/processor.py", line 75, in _execute_before_scenario_hook
run_hook(request, response, registry.before_scenario(tags), execution_info)
File "/usr/local/lib/python2.7/site-packages/getgauge/executor.py", line 24, in run_hook
if len(inspect.signature(hook).parameters) == 0:
AttributeError: 'module' object has no attribute 'signature'
Error Message: Connection closed [127.0.0.1:63970] cause: EOF
Stacktrace:
Error Message: write tcp 127.0.0.1:63969->127.0.0.1:63970: use of closed network connection
Stacktrace:
Failed to initialize scenario datastore. Error: write tcp 127.0.0.1:63969->127.0.0.1:63970: use of closed network connection
write tcp 127.0.0.1:63969->127.0.0.1:63970: use of closed network connection
Error Message: write tcp 127.0.0.1:63969->127.0.0.1:63970: use of closed network connection
Stacktrace:
Error Message: write tcp 127.0.0.1:63969->127.0.0.1:63970: use of closed network connection
Stacktrace:
Unable to connect to plugin Html Report 2.1.0. proto: required field "SuiteExecutionResult.SuiteResult.SpecResults.ProtoSpec.PreHookFailure.StackTrace" not set
Specifications: 1 executed 0 passed 1 failed 0 skipped
Scenarios: 1 executed 1 passed 0 failed 1 skipped
Total time taken: 233ms
Actual behavior
The parameter name in the generated annotation after refactoring takes the value given in the text as the parameter name.
Find usages do not work
and step implementation is not recognized
Steps to replicate
gauge-python
projectVowels in English language are "aeiou"
to Vowels in English language are "aeiou" something else "" and "ddd"
Version
auge version: 0.9.8.nightly-2018-02-15
Commit Hash: dfbaee0
Plugins
-------
python (0.2.4.nightly-2018-02-16)
pip version
Name: getgauge
Version: 0.2.4.dev20180216
Summary: Enables Python support for Gauge
Home-page: https://github.com/getgauge/gauge-python
Author: Gauge Team
Author-email: [email protected]
License: MIT
Location: /Library/Python/2.7/site-packages
Requires: protobuf, redBaron
Bug on story - getgauge/gauge-vscode#81
Add the expected behavior/issue description/Actual behavior here
My gauge installation stopped working. It is throwing the following error message:
Traceback (most recent call last):
File "start.py", line 25, in
main()
File "start.py", line 17, in main
s = connection.connect()
File "/usr/local/lib/python3.5/site-packages/getgauge/connection.py", line 10, in connect
s.connect(('localhost', int(os.environ['GAUGE_INTERNAL_PORT'])))
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Failed to start gauge API: Runner with pid 20637 quit unexpectedly(exit status 1).
Gauge version
Gauge Python plugin version: getgauge (0.2.2)
Python version: 3.5.2
PIP3 version: pip 9.0.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
getgauge
package version, run pip3 show getgauge
to get it
Name: getgauge
Version: 0.2.2
Summary: Enables Python support for Gauge
Home-page: https://github.com/kashishm/gauge-python
Author: Kashish Munjal
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.5/site-packages
Requires: protobuf, redBaron, colorama
OS information
MAC OSX 10.12.6 Sierra using both the built-in terminal and iTerm2 3.1.2
Expected behavior
The IDE behavior should be available for python features
Actual behavior
The IDE features are not available
15:02:43.793 --> result #0: client/registerCapability: null
Traceback (most recent call last):
File "start.py", line 36, in <module>
main()
File "start.py", line 25, in main
processor.dispatch_messages(s)
File "/Users/sswaroop/Library/Python/2.7/lib/python/site-packages/getgauge/processor.py", line 218, in dispatch_messages
processors[request.messageType](request, response, socket)
KeyError: 31
15:02:43.925 notif #0: initialized: Connection closed [127.0.0.1:49653] cause: EOF
Steps to replicate
The above exception occurs
Version
auge version: 0.9.8.nightly-2018-04-05
Commit Hash: 51a094a
Plugins
-------
html-report (4.0.4.nightly-2018-03-30)
java (0.6.7.nightly-2018-04-05)
js (2.2.0.nightly-2018-03-29)
python (0.2.6.nightly-2018-03-28)
pip show getgauge
Name: getgauge
Version: 0.2.6.dev20180328
Summary: Enables Python support for Gauge
Home-page: https://github.com/getgauge/gauge-python
Author: Gauge Team
Author-email: [email protected]
License: MIT
Location: /.../Python/2.7/lib/python/site-packages
Requires: protobuf, redBaron, ptvsd
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.