Karate get's hang while passing tag from the command line - karate

DEBUG com.intuit.karate.Suite - waiting for 5 features to complete
My CLI:
clean test -Dtest=TestRunner#testParallel -DPATH="/api" -DTAGS="#tag1"
Karate Version
com.intuit.karate
karate-apache
0.9.6

Related

Cannot run karate tests with CLI

I'm not able to execute tests using the CLI. The runner works. I'm using version 0.9.5.RC5 with maven command: " mvn test -f pom.xml exec:java -Dexec.mainClass=com.intuit.karate.cli.Main -Dexec.args='-d' -Dexec.classpathScope=test"
Here is the error:
ERROR com.intuit.karate - driver config / start failed: failed to construct class by name: karate-http.properties not found, aborting, options: {type=chrome, target=null}
I java karate-apache, karate-core and karate-junit4 as dependencies. The java version is 13
We don't yet support Java > 12: https://github.com/intuit/karate/tree/develop#getting-started
EDIT: use Karate 1.0

[karate][standalone v0.9.1] Error : could not find or read file: file:xxx/yyy/zzz/./karate-config.js

I am only using the latest standalone karate jar to test my API on a docker image configured with JRE and I don't have any Java code.
This is what i have currently with the new version :
09:30:37.333 [main] INFO com.intuit.karate.netty.Main - Karate
version: 0.9.1 09:30:37.489 [main] INFO com.intuit.karate.Runner -
Karate version: 0.9.1 09:30:38.067 [ForkJoinPool-1-worker-1] WARN
com.intuit.karate - skipping bootstrap configuration: could not find
or read file: file:xxx/yyy/zzz/./karate-config.js
Here we can see it didn't find my karate-config.js file
This is what i have with the v0.9.0 :
09:48:35.829 [main] INFO com.intuit.karate.netty.Main - Karate
version: 0.9.0 09:48:35.971 [main] INFO com.intuit.karate.Runner -
Karate version: 0.9.0 09:48:36.559 [ForkJoinPool-1-worker-1] INFO
com.intuit.karate - karate.env selected environment was: preprod
Here we can see it found my karate-config.js file
Did something change on 0.9.1 ?
Thank you.
Yes something changed :( - we've been trying to fix this file resolution problem for a while. It would be great if you help us reproduce this. Since you don't use Java, can you create a zip file of the directory structure that can replicate this problem.
As a workaround, please try setting the location to the config file as per the docs:
-Dkarate.config.dir=xxx/yyy/zzz
EDIT - this is fixed and you need to re-download the binary (same version) from here: https://github.com/intuit/karate/releases/tag/v0.9.1
Okay, it works with
-Dkarate.config.dir=xxx/yyy/zzz
But only on this case :
-Dkarate.config.dir="./"
I have reproduced the error on a simplified environment, you can download this file :
Karate-Test Zip File
You just have then to execute the different .sh and see what is happening.
On the file karate-0.9.1/karate-0.9.1.sh , you have to read the comment, it works on a specific case, and it doesn't on another.
EDIT :
Another thing,
even on the 0.9.0 version case, it doesn't work when i'm not on the same directory
than the script during the execution of the script
for instance, if i'm not on the same directory, this command is not working :
./karate-0.9.0/karate-0.9.0.sh
13:01:25.764 [main] INFO com.intuit.karate.netty.Main - Karate
version: 0.9.0 13:01:25.830 [main] INFO com.intuit.karate.Runner -
Karate version: 0.9.0 13:01:26.402 [ForkJoinPool-1-worker-1] WARN
com.intuit.karate - skipping bootstrap configuration: could not find
or read file: classpath:karate-config.js
while this one is if i'm on the same directory :
./karate-0.9.0.sh 13:03:54.831 [main] INFO
com.intuit.karate.netty.Main - Karate version: 0.9.0 13:03:54.905
[main] INFO com.intuit.karate.Runner - Karate version: 0.9.0
13:03:55.421 [ForkJoinPool-1-worker-1] INFO com.intuit.karate -
baseUrl selected was: https://petstore.swagger.io

Objective-C Travis failed for 'Test runner exited before starting test execution'

Here is my code in .travis.yml file,after run build is passing, but I found the TEST are failed. I have no idea about this and block me a few days, appreciate your help. THX
--- Error as below ---
2018-12-20 05:57:42.698 xcodebuild[2394:8186] [MT]
IDETestOperationsObserverDebug: (CB8F382A-5B77-4BDA-BC4F-6EDF7B7DB822)
Beginning test session aaaaTests-CB8F382A-5B77-4BDA-BC4F-6EDF7B7DB822 at 2018-
12-20 05:57:42.698 with Xcode 10A255 on target <DVTiPhoneSimulator:
0x7f86387e49d0> {
SimDevice: iPhone 6 (B25EC6DB-0B2F-4920-B6C2-8560331BA779, iOS 9.1, Booted)
} (9.1 (13B143))
2018-12-20 05:57:53.744 xcodebuild[2394:8186] [MT]
IDETestOperationsObserverDebug: 11.068 elapsed -- Testing started completed.
2018-12-20 05:57:53.744 xcodebuild[2394:8186] [MT]
IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2018-12-20 05:57:53.744 xcodebuild[2394:8186] [MT]
IDETestOperationsObserverDebug: 11.068 sec, +11.068 sec -- end
2018-12-20 05:57:53.746 xcodebuild[2394:8186] Error
Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit,
operation never finished bootstrapping - no restart will be attempted"
UserInfo={NSLocalizedDescription=Early unexpected exit, operation never
finished bootstrapping - no restart will be attempted,
NSUnderlyingError=0x7f86389df930 {Error
Domain=IDETestOperationsObserverErrorDomain Code=5 "Test runner exited before
starting test execution." UserInfo={NSLocalizedDescription=Test runner exited
before starting test execution., NSLocalizedRecoverySuggestion=If you believe
this error represents a bug, please attach the result bundle at
/Users/travis/Library/Developer/Xcode/DerivedData/aaaa-
bdscsxnorhzvygafnsqdiqoriugx/Logs/Test/Run-aaaa-2018.12.20_05-57-22-
+0000.xcresult}}}
Testing failed:
aaaa.app (2488) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. Underlying error: Test runner exited before starting test execution.)
** TEST FAILED **
The command "set -o pipefail && xcodebuild -workspace aaaa.xcworkspace -scheme aaaa -destination platform\=iOS\ Simulator,OS\=9.1,name\=iPhone\ 6 build test | xcpretty" exited with 65.
Done. Your build exited with 1.
---My code as below---
language: objective-c
osx_image: xcode10
xcode_workspace: aaaa.xcworkspace
xcode_scheme: aaaa
xcode_destination: platform=iOS Simulator,OS=9.1,name=iPhone 6
before_install:
- pod repo update
- npm install ios-sim -g
- ios-sim start --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-6, 9.1"
The issue can fix by below step:
change the version of osx_image in .travis.yml file and retry
// if xcode10.1 build failed, you can change to other version, like xcode9.4
osx_image: xcode10.1
Travis support xcode version list:
https://docs.travis-ci.com/user/languages/objective-c/

Protractor with Visual Studio Team Services - "Could not find chrome binary"

I've been trying to setup Protractor on Visual Studio Team Services and currently I'm having a build run a .bat file to start my protractor test.
When the build runs, it gives me an error message saying Could not find Chrome binary, and gives me a file location that doesn't exist on my directory.
Error trace-back:
2017-05-25T20:43:49.3521640Z ##[section]Starting: Run script protractor.bat
2017-05-25T20:43:49.3521640Z
===========================================================================
2017-05-25T20:43:49.3521640Z Task : Batch Script
2017-05-25T20:43:49.3521640Z Description : Run a windows cmd or bat script and optionally allow it to change the environment
2017-05-25T20:43:49.3521640Z Version : 1.1.3
2017-05-25T20:43:49.3521640Z Author : Microsoft Corporation
2017-05-25T20:43:49.3521640Z Help : [More Information]
(https://go.microsoft.com/fwlink/?LinkID=613733)
2017-05-25T20:43:49.3521640Z
============================================================================
2017-05-25T20:43:49.3601629Z ##[command]d:\a\1\s\protractor.bat
2017-05-25T20:43:49.3761643Z
2017-05-25T20:43:49.3761643Z d:\a\1\s>cd .\e2e
2017-05-25T20:43:49.3761643Z
2017-05-25T20:43:49.3761643Z d:\a\1\s\E2E>protractor conf.js
2017-05-25T20:43:50.8302366Z [20:43:50] I/direct - Using ChromeDriver directly...
2017-05-25T20:43:50.8342360Z [20:43:50] I/launcher - Running 1 instances of WebDriver
2017-05-25T20:43:50.8342360Z [20:43:50] E/direct - Error code: 135
2017-05-25T20:43:50.8342360Z [20:43:50] E/direct - Error message: Could not find chromedriver at C:\NPM\Modules\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.25.exe
2017-05-25T20:43:50.8342360Z [20:43:50] E/direct - Error: Could not find chromedriver at C:\NPM\Modules\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.25.exe
2017-05-25T20:43:50.8342360Z at Direct.getNewDriver (C:\NPM\Modules\node_modules\protractor\built\driverProviders\direct.js:65:27)
2017-05-25T20:43:50.8342360Z at Runner.createBrowser (C:\NPM\Modules\node_modules\protractor\built\runner.js:197:43)
2017-05-25T20:43:50.8342360Z at C:\NPM\Modules\node_modules\protractor\built\runner.js:276:30
2017-05-25T20:43:50.8342360Z at _fulfilled (C:\NPM\Modules\node_modules\protractor\node_modules\q\q.js:834:54)
2017-05-25T20:43:50.8342360Z at self.promiseDispatch.done (C:\NPM\Modules\node_modules\protractor\node_modules\q\q.js:863:30)
2017-05-25T20:43:50.8342360Z at Promise.promise.promiseDispatch (C:\NPM\Modules\node_modules\protractor\node_modules\q\q.js:796:13)
2017-05-25T20:43:50.8342360Z at C:\NPM\Modules\node_modules\protractor\node_modules\q\q.js:556:49
2017-05-25T20:43:50.8342360Z at runSingle (C:\NPM\Modules\node_modules\protractor\node_modules\q\q.js:137:13)
2017-05-25T20:43:50.8342360Z at flush (C:\NPM\Modules\node_modules\protractor\node_modules\q\q.js:125:13)
2017-05-25T20:43:50.8342360Z at _combinedTickCallback (internal/process/next_tick.js:67:7)
2017-05-25T20:43:50.8342360Z [20:43:50] E/launcher - Process exited with error code 135
2017-05-25T20:43:50.8552361Z ##[error]Process completed with exit code 135.
2017-05-25T20:43:50.8582364Z ##[section]Finishing: Run script protractor.bat
When I install Chromedriver on the build it installs it to a different file location:
d:\a\1\s\node_modules\chromedriver\lib\chromedriver\chromedriver.exe
The test runs fine locally but doesn't work when I commit it to VSTS.
Is there anyway to make it so that chromedriver is installed in a different file location, or have Selenium look in a different place for chromedriver?
Thanks
Put the relative path to the ChromeDriver executable in conf.js. This is well-documented.
Use webdriver-manager package that comes with protractor - it can download any version of any binary that you want - https://www.npmjs.com/package/webdriver-manager
So it ends up with running webdriver-manager update before starting protractor tests (just make sure that if you are running locally installed protractor - you also update using locally installed webdriver-manager)
First, based on the log, you are using Hosted Build agent that running as service, but the test need to be interact with UI, so you can’t to do Protractor test with Chrome on Hosted Build agent.
You can refer to this way to set up a private build agent on your machine: Deploy an agent on Windows
Secondly, you can refer to these steps to install chromedriver:
Add Npm task (npm command: install; arguments: -g protractor)
Add Command Line task (Tool: webdriver-manager; Arguments: update --versions.chrome 2.25)

PHPUnit + Selenium 2.35 = BadMethodCallException

My English is not so good. Sorry.
I have:
PHPUnit 3.7.24
Selenium 2.35.0
I am starting selenium server:
java -jar /usr/local/bin/selenium-server-standalone-2.35.0.jar
Output:
04.09.2013 13:51:15 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
13:51:25.373 INFO - Java: Sun Microsystems Inc. 20.45-b01
13:51:25.374 INFO - OS: Linux 3.8.0-29-generic i386
13:51:25.388 INFO - v2.35.0, with Core v2.35.0. Built from revision c916b9d
13:51:25.542 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
13:51:25.543 INFO - Version Jetty/5.1.x
13:51:25.544 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:51:25.545 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:51:25.546 INFO - Started HttpContext[/,/]
13:51:25.567 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#dda25b
13:51:25.567 INFO - Started HttpContext[/wd,/wd]
13:51:25.571 INFO - Started SocketListener on 0.0.0.0:4444
13:51:25.577 INFO - Started org.openqa.jetty.jetty.Server#b61fd1
My simple test:
public function testTitle()
{
$this->url('/');
$this->assertEquals('My title.', $this->title());
}
Next, run phpunit test with command:
phpunit --debug functional/MainPageTest.php
Output:
PHPUnit 3.7.24 by Sebastian Bergmann.
Configuration read from /home/demyan112rv/www/boo/protected/tests/phpunit.xml
Starting test 'MainPageTest::testTitle'.
E
Time: 17.59 seconds, Memory: 2.75Mb
There was 1 error:
1) MainPageTest::testTitle
PHP Warning: include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such file or directory in /home/demyan112rv/www/yii/YiiBase.php on line 421
PHP Warning: include(): Failed opening 'PHPUnit_Extensions_Story_TestCase.php' for inclusion (include_path='.:/home/demyan112rv/www/boo/protected/helpers:/home/demyan112rv/www/boo/protected/widgets:/home/demyan112rv/www/boo/protected/extensions/mail:/home/demyan112rv/www/boo/protected/services:/home/demyan112rv/www/boo/protected/components:/home/demyan112rv/www/boo/protected/models:/usr/share/php:/usr/share/pear') in /home/demyan112rv/www/yii/YiiBase.php on line 421
BadMethodCallException: The command http://localhost:4444/wd/hub/session/url is not recognized by the server.
/home/demyan112rv/www/yii/test/CWeb2TestCase.php:60
/home/demyan112rv/www/boo/protected/tests/functional/MainPageTest.php:11
/home/demyan112rv/www/boo/protected/tests/functional/MainPageTest.php:11
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
And in this time in selenium server a have next output:
13:55:39.438 INFO - Executing: [new session: {browserName=firefox}] at URL: /session)
13:55:39.452 INFO - Creating a new session for Capabilities [{browserName=firefox}]
13:55:56.642 INFO - Done: /session
I have error "BadMethodCallException: The command http:/ /localhost:4444/wd/hub/session/url is not recognized by the server.". This bug fixed for 2.35 in this link , but i have 2.35 and i have this error.
How to fix this problem?
Solution (i don't may answer on my question, because my rating is less than 10.
$ whereis phpunit
phpunit: /usr/bin/phpunit /usr/bin/X11/phpunit /usr/local/bin/phpunit
I have 3 path to phphunit. I don't know, it's normal or no.
When i changed command from:
phpunit --debug functional/MainPageTest.php
to
/usr/bin/phpunit --debug functional/MainPageTest.php
it's working!!!
if you have setUp your browser launch method i.e
function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://www.google.com/");
}
your function should look like this
public function testTitle()
{
$this->open('/');
$this->assertEquals('My title.', $this->title());
}
I've changed $this -> url('/'); to $this -> open('/');
please try now.