karate

Dynamic scenario freezes when called using afterFeature hook

六眼飞鱼酱① 提交于 2020-05-28 06:56:34
问题 Strange behaviour when I call a feature file for test clean using afterFeature hook. The cleanup feature file is called correctly because I can see the print from Background section of the file, but for some reason the execution hangs for Scenario Outline. I have tried running feature with Junit5 runner and also in IntelliJ IDE by right clicking on feature file but get the same issue, the execution hangs. This is my main feature file: Feature: To test afterFeature hook Background: * def num1

Dynamic scenario freezes when called using afterFeature hook

点点圈 提交于 2020-05-28 06:55:50
问题 Strange behaviour when I call a feature file for test clean using afterFeature hook. The cleanup feature file is called correctly because I can see the print from Background section of the file, but for some reason the execution hangs for Scenario Outline. I have tried running feature with Junit5 runner and also in IntelliJ IDE by right clicking on feature file but get the same issue, the execution hangs. This is my main feature file: Feature: To test afterFeature hook Background: * def num1

Buffer in JS file isn't recognized (API tests automation with Karate Framework)

故事扮演 提交于 2020-05-24 04:47:26
问题 We're automating our test with karate framework. In one of our features we need to decode a token and get a scope in the response. Everything works well, except this code in js. function(token) { return JSON.parse(new Buffer(token.split('.')[1],'base64').toString('ascii')).scope; } Error: Caused by: <eval>:2 ReferenceError: "Buffer" is not defined Caused by: jdk.nashorn.internal.runtime.ECMAException In official tutorials it is said that javascript is 'native' to karate, so we don't

How do i use javascript executor in Karate UI

落爺英雄遲暮 提交于 2020-05-22 09:42:08
问题 Firstly, Karate UI automation is really awesome tool. I am kind of enjoying it while writing the UI tests using Karate. I ran into a situation where in, i was trying to fetch the shadowRoot elements. I read few similar posts related to javascript executor with karate and learnt that it is already answered. it is recommended to use driver.eval. But in Karate 0.9.5 there is no eval, it has script() or scriptAll(). I have gone through documentation couple of times to figure out how i can fetch

Karate Runner with ExecutionHook listener

喜欢而已 提交于 2020-05-16 22:38:48
问题 @Peter - As per your suggestion from my previous queries, I have used ExecutionHooks to implement ReportPortal. I am finding difficulties in passing all the required values from my Runner to Base Runner. Below is my configuration- BaseRunner.java Results results = Runner.parallel(tags,path,ScenarioName,Collections.singletonList(new ScenarioReporter()),threads,karateOutputPath); Runner.java @KarateOptions(tags = { "@Shakedown" }, features = "classpath:tests/Shakedown" ) I want to understand

Karate: How can we retrieve the value from called feature file

拟墨画扇 提交于 2020-05-16 02:22:43
问题 I have two parameter in feature file A and I pass those values to another feature file called B. But I am unable to retrieve the values as expected in Feature file B CODE: Feature File A: And def Response = response And def token = response.metaData.paging.token And def totalPages = response.metaData.paging.totalPages * def xyz = """ function(times){ for(currentPage=1;currentPage<=times;currentPage++){ karate.log('Run test round: '+(currentPage)); karate.call('ABC.feature', {getToken:token,

Karate framework symbol encoding in url

随声附和 提交于 2020-05-14 05:57:35
问题 I have this: Background: * url 'http://localhost:15672/api/exchanges/%2F/my_exchange' Scenario: Given path 'publish' Problem here is that the url is being resolved as: http://localhost:15672/api/exchanges///my_exchange/publish instead of: http://localhost:15672/api/exchanges/%2F/my_exchange/publish Thanks EDITED: I will improve the question. I uploaded a very simple project here: https://github.com/italktothewind/karate-encoding It has a wiremock listening to /bar/%2F/foo This feature is

After updating from 0.9.2 to 0.9.5 getting the error “java.lang.IllegalArgumentException: Illegal group reference”

故事扮演 提交于 2020-05-13 07:49:23
问题 My test suite was working fine until it was using the version 0.9.2. I have a test runner with KarateOptions in it to specify the feature files that are to be executed @KarateOptions(tags = {"~@ignore"}, features = { "src/test/java/com/pro/api/tests/features/beforesuitescenarios/feature1.feature", "src/test/java/com/pro/api/tests/features/customerscenarios/feature2.feature", "src/test/java/com/pro/api/tests/features/servicerequestscenarios/feature3.feature", "src/test/java/com/pro/api/tests

After updating from 0.9.2 to 0.9.5 getting the error “java.lang.IllegalArgumentException: Illegal group reference”

百般思念 提交于 2020-05-13 07:48:45
问题 My test suite was working fine until it was using the version 0.9.2. I have a test runner with KarateOptions in it to specify the feature files that are to be executed @KarateOptions(tags = {"~@ignore"}, features = { "src/test/java/com/pro/api/tests/features/beforesuitescenarios/feature1.feature", "src/test/java/com/pro/api/tests/features/customerscenarios/feature2.feature", "src/test/java/com/pro/api/tests/features/servicerequestscenarios/feature3.feature", "src/test/java/com/pro/api/tests

Karate: Is there a http-request hook in karate, that gets called automatically after every API call, and whose behaviour I can modify?

自古美人都是妖i 提交于 2020-05-05 14:27:47
问题 I want a common implementation to write the: request-body, request-method & response-body to an output file for all the HTTP requests that I make in any of the karate feature files. I have read through the documentation, and the closest option that I found was the afterScenario hook. However this doesn't help me in cases where I want to make multiple API calls in the same scenario. I also tried using karate.prevRequest object by passing it to java function that I wrote. While this helps me