python-behave

How to Allure-behave generate report from test cases. Allure generated only one report from one test case

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-18 08:45:14
问题 When I use this step from here twice: $ behave -f allure_behave.formatter:AllureFormatter -o %allure_result_folder% ./features And then $ allure serve %allure_result_folder% There is always 1 test case. How can I manage to sum test cases? I want to see test cases. I've run also this code twice: behave -f allure_behave.formatter:AllureFormatter -o results ./features and then: allure generate results/ -o report/ But still, I get only 1 test case. I want to see for example similar outcome 回答1: I

how to fail the step explicitly in behave step implementation

风流意气都作罢 提交于 2021-02-16 18:27:32
问题 I want to explicitly fail the step in behave when I encounter an exception eg. I am writing the code according to behave documentation - from behave import * @when('verify test fails.*?(?P<param_dict>.*)') def test_logger(context, param_dict): try: logger.info("testing the logger. this is info message") logger.info(1/0) except Exception as e: logger.error("arrived at exception: "+str(e)) fail("failed with exception: "+str(e)) but it throws this error: NameError: name 'fail' is not defined I

how to fail the step explicitly in behave step implementation

别说谁变了你拦得住时间么 提交于 2021-02-16 18:27:29
问题 I want to explicitly fail the step in behave when I encounter an exception eg. I am writing the code according to behave documentation - from behave import * @when('verify test fails.*?(?P<param_dict>.*)') def test_logger(context, param_dict): try: logger.info("testing the logger. this is info message") logger.info(1/0) except Exception as e: logger.error("arrived at exception: "+str(e)) fail("failed with exception: "+str(e)) but it throws this error: NameError: name 'fail' is not defined I

Howto to write a step implementation that supports multiple words

家住魔仙堡 提交于 2021-02-10 16:22:46
问题 Example Gherkin # Gherkin snip When waiting for 30 seconds # or When waiting for 5 s I want to implement above steps in one step definition. I tried the following step implementation. from behave import * use_step_matcher("re") @when(u"waiting for (?P<time>\d+) (s|seconds)") def step_impl(context, time): pass When running this results in this error: TypeError: step_impl() got multiple values for keyword argument 'time' Behave extracts it as a parameter. What's a good practice for doing this?

Howto to write a step implementation that supports multiple words

断了今生、忘了曾经 提交于 2021-02-10 16:22:08
问题 Example Gherkin # Gherkin snip When waiting for 30 seconds # or When waiting for 5 s I want to implement above steps in one step definition. I tried the following step implementation. from behave import * use_step_matcher("re") @when(u"waiting for (?P<time>\d+) (s|seconds)") def step_impl(context, time): pass When running this results in this error: TypeError: step_impl() got multiple values for keyword argument 'time' Behave extracts it as a parameter. What's a good practice for doing this?

Sending Keys Using Splinter

╄→尐↘猪︶ㄣ 提交于 2020-08-22 05:36:47
问题 I want to test an autocomplete box using Splinter. I need to send the 'down' and 'enter' keys through to the browser but I'm having trouble doing this. I am currently finding an input box and typing 'tes' into that box successfully context.browser.find_by_xpath(\\some\xpath\).first.type('tes') What I want to do next is to send some keys to the browser, specifically the 'down' key (to select the first autocomplete suggestion) then send the 'enter' key to select that autocomplete element. I've

How use pipe character inside Examples table of Behave test .feature file?

只谈情不闲聊 提交于 2020-06-16 02:21:17
问题 I have a Behave Scenario outline where I need to use pipe character - | as a cell value inside Examples table. But I don't know how to escape this character to not be treated as column separator. I'm getting Malformed table error when I try to use \| sequence. 回答1: As far as I can tell, it is not possible to escape cell delimiters as of version 1.2.5 (current at the time of posting). The relevant code is in the action_table method. This is how it splits a line into cells: cells = [cell.strip(

In behave, how do you run a scenario only?

别来无恙 提交于 2020-05-14 14:37:28
问题 I have a 'behave' feature that has a lot of tests on it. I only need to run a specific scenario for development needs. How do I do it? (preferably on the command line) 回答1: To run only a single scenario you can use -n with the name of the scenario: $ behave -n 'clicking the button "foo" should bar the baz' I'm using single quotes above to keep the name of the scenario as one argument for -n . Otherwise, the shell will pass each word of the scenario name as a separate argument. 回答2: If you

Undefined step definitions in Pycharm

安稳与你 提交于 2020-01-25 10:32:06
问题 When I press Alt+Enter, I see Inspection 'Undefined Step' options. However, I should see the intention action Create Step Definition. I have the Gherkin plugin installed. https://i.imgur.com/hFADmzR.png I cannot test because i get the info in my cmd: ConfigError: No steps directory in 'C:\WINDOWS\system32\features' Thanks in advance... i cant find answer to my problem online. Feature: sign in to a pre-signed form As a user I want to login and what happens Scenario: Log in with valid data

Move the headings from top of Cucumber's Data Table to side - Python

风流意气都作罢 提交于 2020-01-07 04:07:40
问题 I am looking for the ways to change the headings of Cucumber's Data Table to the side. So it will make the feature file readable. Ordinary way: | Name | Email | Phone No. | ......... | | John | i@g.net | 098765644 | ......... | It can be a very wide data table and I would have to scroll back and forth. Desired way: | Name | John | | Email | i@g.net | | Phone No. | 098765444 | . . . There are a small number of examples in Java and Ruby. But I am working with Python. I had tried many different