cucumber

How to convert a DataTable in Cucumber to a List of objects?

泄露秘密 提交于 2019-12-08 06:25:58
问题 Original Title: What does scalar mean in Cucumber DataTables in Java? From this reference: Java provides several scalar types. These include primitive numeric types, plus boolean and char. Every scalar (primitive) type has an associated wrapper class or reference type. Reading the javadocs: /** * Converts the table to a List. * * If {@code itemType} is a scalar type the table is flattened. * * Otherwise, the top row is used to name the fields/properties and the remaining * rows are turned

Do we have any annotation in cucumber where it will run before any of the tests in the feature file?

邮差的信 提交于 2019-12-08 05:23:20
问题 @Before method will run before every scenario. Do we have an annotation where it run before any of the scenarion and an annotation after all the scenarios have been executed ? 回答1: You can use gerkin with qaf where you can use different TestNG listeners and annotations. In addition to that if you are using webdriver you can get additional driver and element listeners support. For example package my.test.pkg public class MyClass{ @BeforeSuite public void beforeSuite() { //get executed before

Passing Custom Headers to Selenium from Capybara

安稳与你 提交于 2019-12-08 04:19:31
We use custom headers to authenticate our web apps. An http proxy service intercepts requests, confirms the authenticity of the user and then injects custom headers into the request. In order to test the app, I need to write those headers into the request before it hits my ApplicationController methods. Right now, the current hack works for all my non-javascript tests: # in hooks.rb Before do require 'capybara/driver/rack_test_driver' module Capybara::Driver class Authentic < RackTest def env super.merge('My-Custom-Header' => "foo") end end end Capybara.register_driver(:authentic) do |app|

how use tests written in Selenium and Cucumber-JVM with JMeter?

筅森魡賤 提交于 2019-12-08 04:00:20
问题 I have set of functional tests written in Selenium and Cucumber-JVM, I use maven to run them by Cucumber tags. Now I need to use some of those tests with JMeter to check performance. How can I do it? 回答1: I believe that you can just Compile your tests into .jar file(s) Copy the .jar file(s) into JMeter classpath tests files - under /lib/junit folder of your JMeter installation dependency files - under /lib folder Add JUnit Request Sampler and choose required test from "Classname" and "Test

Hook up in cucumber check for scenario failure in java

余生颓废 提交于 2019-12-08 03:45:22
问题 While I was reading how to add a cleanup for a cucumber scenario on failure I got this piece of code in the internet. After do |s| if s.failed? #If you are on an iOS Device $driver.quit sleep(time_for_driver_ready) #else reset end end This is in ruby. I am working in java and is there any way to implement s.failed? in java, because in java the after method declaration does not include a scenario variable. 回答1: You can pass the Scenario as a parameter to the After hook, the framework will

Cucumber not serializing date string from datatable in feature file to a LocalDate field inside my pojo

房东的猫 提交于 2019-12-08 03:36:21
问题 Im trying to figure out how to parse date fields from my cucumber feature files in my step definitions. class Person{ String name LocalDate dob } scenario: do something with people Given list of people: |name|dob| | john| 20-09-2001| @Given("^list of people:") public void doSomething(List<Person> people) { } Please note i have no access to the Person class, Im sure i have to either write my own converter or register a converter written by someone from some library, after searching around the

Setting timezone in Protractor e2e tests

隐身守侯 提交于 2019-12-08 02:51:50
问题 I have some Protractor e2e tests in which I deal with timezone. On my local machine they pass, on Appveyor they don't. I found out it's a timezone setting issue (different settings on Appveyor). Is there a way to set the timezone at the start of the test suite and bring it back the old one at the end? I tried this solution (so please don't mark this as duplicate): Set browser timezone in a Protractor test which I found to be a very ugly workaround. Anything prettier? 回答1: You could use

Cucumber @Before hook runs twice @After once

[亡魂溺海] 提交于 2019-12-08 02:34:29
问题 to all. Curently writing a little BDD Test automation framework, using Java11+Junit5+Cucumber+Selenium, build tool: Graddle. Created a little test for validating Google title. When starting test, using Test task in Graddle or running CucumberRunner class, in both cases getting the same result: two times @Before method is executed, once @After method is executed and one browser windows is staying open. After added one more test, the same situation, only 4 browsers are opened, 2 of them are

WatiN pressTab doesn't press tab

放肆的年华 提交于 2019-12-08 02:25:10
问题 Has anyone found a means to press tab with watiN in Internet explorer? 回答1: Do you mean you want to press the tab key itself, or just click on an HTML element that looks like a tab? For the latter use the Click method against the appropriate element (Div, Span etc). Otherwise you could try SendKeys instead of PressTab. e.g.: IE ie = new IE("http://www.google.com"); ie.AutoClose = false; ie.TextField(Find.ByName("q")).Click(); SendKeys.SendWait("{TAB}"); The above example will set the focus

How correctly config rails test to run it in browser? ( site_prism, cucumber, capybara, selenium webdriver )

扶醉桌前 提交于 2019-12-08 01:57:10
问题 I am writing test for rails app, I use site_prism, capybara, selenium and cucumber. How can I setup Selenium driver to run my tests in browser (firefox)? For example, it is one of features: Given /^I navigate to Dashboard page$/ do @page = DashboardPage.new # Dashboardpage is inheritor of SitePrism::Page @page.load @page.login_form.login_field.set 'admin' @page.login_form.password_field.set 'test' @page.login_form.signin_button.click @page.title.include? 'Dashboard' end This is my features