Unable to use classpath or relative path to read json payload data - karate

I have written a Karate scenario where my login is performed from a separate .feature file. I have the following directory structure:
src/test/java/feature/common/common.feature
When i want to call the above common feature file from another feature file which is in different folder (as below) it does not work:
src/test/java/feature/tests/test.feature
I have tried the following:
1.
callonce read('feature/common/common.feature')
and it does not work.
If i were to use classpath how would i write this call?

Using classpath: you will be able to access contents inside src/test/java if you follow standard karate workspace structure
Inorder to call / read,
* call read('classpath:feature/common/common. feature')
simply src/test/java can be replaced with classpath:
Refer reading files from karate document for more

Related

I want to pass my SBT build version as dynamic parameter to a parameter in yaml file. How to do it?

Have a scenario where my yaml file has a config for application. I am passing "s3://[Shelfscrpti folder name]/1.1.5 SNAPSOT
Need help to get the snapshot part alone as a dynamic parameter.

How to use a generated file by script in Bamboo as artifact

I create a Python file to generate a json file with Bamboo script job. Now I need to upload the generated file to S3. How can I make it as artifact, from that I can reuse it in the next jobs?
To make Bamboo identify a json file as artifact, all you need to do is to define an artifact definition as described in the official documentation. This way, you can make Bamboo recognise the json file produced from the script task(/job?).
Then, make the artifact shareable as described on this page - Sharing artifacts so that next jobs can use them.

how to pass user properties file to JMETER through commant prompt

I am using JMETER for load testing. I have large number of user properties in my plan. Its not recommended to pass all these through command prompt because of size issues. I am aware that we can put all the properties in some .properties file and use that file. Like we have the user.properties file in JMETER. But I want to make my own properties file and it should be loaded after the jmeter.properties file. Can anyone guide me how I can do that.
I have gone through a link
http://www.testautomationguru.com/jmeter-property-file-reader-a-custom-config-element/
But not getting how are the following steps to be done
Download this zip file which contains a jar file.
tag-jmeter-extn-1.0.zip (784 downloads)
Go to JMETER_HOME/lib/ext foler.
Place the jar file & Restart JMeter.
Once yo launch the JMeter, You will see ‘Property File Reader’ as given below.
Thankyou
I created the plugin. Did you place the jar file in the /lib/ext folder?
If yes, then close the jmeter and launch again. Under Config Elements - you would see Property File Reader. Give the path of the property file to be read.
You can add as many Property File Reader elements as you want for each property file.
If you do not want to use any external plugin, you can simply pass the property files to the test as shown below.
jmeter -n -t test.jmx -p c/path/to/prop.properties
The main idea of using the plugin is to read the user property file during the design phase/GUI as well. Property File Reader will work in both GUI/non-GUI modes.

How can I write into a file within an Eclipse bundle?

I have an xml configuration file located into my plugin resources. I want to update this file whenever in the plugin happens some event. I found some methods to find and read the contents of a file located my plugin classpath, but I'm looking for a way to write into such a file.
Is there any way?
Many thanks.
That location (the install directory) is intended to be read-only since it may be shared in a network install scenario. I suggest you instead write the XML file to your plugin's state location which is intended for just this purpose:
String path = Activator.getDefault().getStateLocation().toString();
I should add that this gives you a fully qualified path to the directory created by Eclipse for any files your plugin wants to store. This directory is unique to your plugin.

Reading XSL file from project directory instead of local drive in Mule

I am using XSLT transformer component in Mule Studio. Till now, I am reading the .xsl file from my local drive. But ,I want to make it system independent and read the xsl sheet from classpath.
Any suggestions on what to mention in the path?
According to the documentation, the xsl-file attribute is:
The full path to the XSL template file to use when performing the
transformation. This can be a path on the local file system or on the
classpath. This attribute is not required if the <xslt-text>
element has been set.
Therefore you should be able to specify a classpath resource with it.