karate.callSingle not found .feature file in karate-config.js - testing

I'm using karate v0.9.6, and it's wonderful tool.
I have a >1000 scenarios, each of them need to token for work, so i use callSingle in karate-config.js for creating and caching tokens. I use standalone jar file.
Part of my karate-config.js:
var auth_cfg = {
server: env,
credentials: karate.properties['credentials']};
var result = karate.callSingle('classpath:credentials/generate_tokens.feature', auth_cfg);
I'm using .sh file like this:
rm -rf target &&
java -Xmx2048m \
-Dlogback.configurationFile=cfg/logs_debug.xml \
-jar \
-Dcredentials=data.json \
karate-1.0.1.jar -e https://my-server/ \
--tags ~fixme \
--tags ~ignore \
--threads 4 \
features/services/simple_plan.feature
And, it's working perfectly on v.0.9.6 long time.
But, when I'm try to upgrade to v 1.0 or 1.0.1, a give an error:
org.graalvm.polyglot.PolyglotException: not found: credentials/generate_tokens.feature
I found this issue: https://github.com/intuit/karate/issues/1515
But examples not working for me. I'm trying use "file:" and karate.properties['karate.config.dir'] + '/features/auth/auth.feature'.
Always i got an error:
not found: credentials/generate_tokens.feature
Who else has faced this problem?

As you can see in the discussion of #1515 - this is why we'd really like more folks to try the RC versions and give us feedback (we spent months on this) instead of waiting for 1.0.
Yours seems to be an edge case where you are using the stand-alone JAR and a custom shell script.
My first suggestion is to use the -w flag. This is a new argument in 1.0 which can set the "current working directory", but it should default correctly in your case.
The second suggestion is to set the classpath for the JVM. Use this as a reference: https://stackoverflow.com/a/58398958/143475 - and once you do that, classpath: will work as you expect.
Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and I have to say that unless you can help us fix this, you may have to remain on 0.9.6 for a while. Sorry.

Peter Thomas, thank you for fast response!
I modify callSingle function, and .feature file wich called by callSingle - change "classpath:" to "file:"
karate.callSingle('file:credentials/generate_tokens.feature', auth_cfg)
,
# read credentials
* def authdata = read('file:credentials/' + credentials)
and it's works now. Before, when i change classpath: to file: i, probably made a mistake.
Thanks for so awesome testing framework!

Related

Why Apache dont activate Saxon/C extension?

i have installed Saxon/C extension step by step, by this documentation: http://zf4.biz/blog/installing-the-saxon-c-php-extension
I must install it for PHP5, so this documentation was great. It all works fine and if i use this "php -m | grep saxon -i" command they shows me the extension:
PHP Warning: Module 'Saxon/C' already loaded in Unknown on line 0
Saxon/C
But in the phpinfo(); the extension is not listet on.
Anybody know why this dont works?
This bug issue is related to the issue #4151. The call to the method getUnderlyingValue() should take not arguments
On line 836 of the file php5_saxon.cpp please replace:
obj = ooth->xdmNode->getUnderlyingValue(NULL);
With the following:
obj = ooth->xdmNode->getUnderlyingValue();
Alternatively you can download the following file which contains the fix:
php5_saxon.cpp
You should then be able to build the Saxon/c extension for PHP5. Installation instructions given here http://www.saxonica.com/saxon-c/doc/html/index.html

phantomjs does not honor debug: true in config file?

According to the phantomjs docs, the --config=<filename.json> is supposed to read configuration variables from the given file. This prints out debug information:
$ phantomjs --debug=true ~/Downloads/phantomjs-2.1.1-macosx/examples/detectsniff.js http://example.com
But the following does not:
$ phantomjs --config=config.json ~/Downloads/phantomjs-2.1.1-macosx/examples/detectsniff.js http://example.com
where config.json contains the following:
{
"debug": true
}
I'm running v 2.1.1 of phantomjs (but you probably already guessed that...). Any ideas?
P.S.: I'm actually trying to track down another bug, but if I can't turn on debugging, I can't be sure if it's even getting my other config variables...
Looking through the source code it looks like it's one of the keys that do not translate directly (i.e. should be included in the list at the bottom of http://phantomjs.org/api/command-line.html).
The following works for me:
{
"printDebugMessages":true,
}

File upload issue in CI

I am using CI and facing a problem while uploading file.
It gives a message mentioned below.
==================================================
Severity: Warning
Message: escapeshellarg() has been disabled for security reasons
Filename: libraries/Upload.php
Line Number: 1066
In some answers, I found that it is a server issue and CI has nothing to do with it. Now, is there any way to upload file bypassing the escapeshellarg() or is there any libraries I can use that doesn't require escapeshellarg()?
Please help.
I'm not sure which specific version of CI you're using, but the latest version does a check for that function before using it.
Take a look at the code here:
$cmd = function_exists('escapeshellarg')
? 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1'
: 'file --brief --mime '.$file['tmp_name'].' 2>&1';
I'd say either upgrade or update the code manually.

output_path not working in behat 2.4.0?

I'm experiencing problems with HTML formatter and the output_path in behat. I'm using cmd:
behat --format=html --out=output.html --config /www/config/behat.yml test.feature
Simplified config (behat.yml) looks like this:
default:
formatter:
name: html
parameters:
output_path: /www/features/output
The problem is that no matter what output_path I set, the output.html is always placed inside same directory, where is behat.yml (/www/config). Can anybody see what am I doing wrong?
Thanks a lot for help!
UPDATE Behat v 2.4.3 use the output dir same as current dir (not the same as config), but still output_path parameter in behat.yml seems not working.
consider using the command line args and see if the issue still happens
for example:
/bin/behat --config=/pathToYML -f pretty,progress,junit --out path/to/output/file/for/pretty,,path/to/junit/output/file /path/to/behat/features/folder
The command line stuff seems to want all three if you don't specify something it will output to console which is why there are , , between pretty and path
This could hold a clue as to why you are having a problem if the command line wants more than one option by default you might need to configure your yaml for that as well.
Our shell script just feeds the command line what we want dynamically instead of doing guess work with yaml configs. Good luck
I had the same issue with behat 2.4.0, this was a known bug that was fixed on version 2.4.3.
Installation method #2 (PHAR) in the guide unfortunately only gives you version 2.4.0 at the time of writting... So in order to fix this you'll have to use the composer method #1.
Hope that helps!

Hadoop configurations seem not to be read

Every time when I try to start my mapreduce application (in standalone Hadoop), it tries to put stuff in the tmp directory, which it can't:
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-username\mapred\staging\username-1524148556\.staging to 0700
It ties to use an invalid path (slashes should be the other way around for cygwin).
I set hadoop.tmp.dir in core-site.xml (in the conf folder of Hadoop), but it seems that the config file is never read (if I put syntax errors in the file, it makes no difference). I added:
--config /home/username/hadoop-1.0.1/conf
To the command, but no difference. I also tried:
export HADOOP_CONF_DIR=/home/username/hadoop-1.0.1/conf
but also that does not seem to have an effect....
Any pointers on why the configs would not be read, or what else I am failing to see here?
Thanks!
It's not that the slashes are inverted, it's that /tmp is a cygwin path which actually maps to /cygwin/tmp or c:\cygwin\tmp. since hadoop is java and doesn't know about cygwin mappings, it takes /tmp to mean c:\tmp.
there's an awful lot of stuff to patch if you want to get 1.0.1 running on cygwin.
see: http://en.wikisource.org/wiki/User:Fkorning/Code/Hadoop-on-Cygwin
I found the following link useful, it seems that the problem stands with newer version of Hadoop. I'm using version 1.0.4 and I'm still facing this problem.
http://comments.gmane.org/gmane.comp.jakarta.lucene.hadoop.user/25837
UPDATED: in Mahout 0.7 and for the ones who use the "Mahoot in Action" book example, you shoud change the example code as follows:
File outFile = new File("output");
if (!outFile.exists()) {
outFile.mkdir();
}
Path output = new Path("output");
HadoopUtil.delete(conf, output);
KMeansDriver.run(conf, new Path("testdata/points"), new Path("testdata/clusters"),
output, new EuclideanDistanceMeasure(), 0.001, 10,
true, 0.1, true);