How do you POST to a URL in Capybara?

More recently I found this great blog post. Which is great for the cases like Tony and where you really want to post something in your cuke: For my case this became: def send_log(file, project) proj = Project.find(:first, :conditions => “name=”#{project}””) f = File.new(File.join(::Rails.root.to_s, file)) page.driver.post(“projects/” + proj.id.to_s + “/log?upload_path=” + f.to_path) page.driver.status_code.should eql 200 … Read more

How to read input data from an excel spreadsheet and pass it JSON payload in karate framework?

A few points: I recommend you look at Karate’s built-in data-table capabilities, it is far more readable, integrates into your test-script and you won’t need to depend on other software. Refer these examples: call-table.feature and dynamic-params.feature Next I would recommend using JSON instead of an Excel or CSV file, it is natively supported by Karate: … Read more

Reuse Cucumber steps

Note that the method for calling steps within steps has changed in recent versions of cucumber, which you’ll see if you get an error like “WARNING: Using ‘Given/When/Then’ in step definitions is deprecated, use ‘step’ to call other steps instead:/path/to/step_definitions/foo_steps.rb:631:in `block in ‘ “. See the cucumber wiki for details. The gist of the change … Read more

How to execute cucumber feature file parallel

Update: 4.0.0 version is available at maven central repository with bunch of changes.for more details go here. Update: 2.2.0 version is available at maven central repository. You can use opensource plugin cucumber-jvm-parallel-plugin which has many advantages over existing solutions. Available at maven repository <dependency> <groupId>com.github.temyers</groupId> <artifactId>cucumber-jvm-parallel-plugin</artifactId> <version>2.1.0</version> </dependency> First you need to add this plugin … Read more