Calabash iOS error when I try to run the test suite: uninitialized constant Calabash::Cucumber::VERSION - calabash

When I try to run my test suite I get this error:
uninitialized constant Calabash::Cucumber::VERSION (NameError)
/Users/Dexter/.rvm/gems/ruby-2.1.2/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:1041:in `check_server_gem_compatibility'
/Users/Dexter/.rvm/gems/ruby-2.1.2/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:645:in `relaunch'
/Users/Dexter/Work/mobile-calabash-test/features/ios/support/01_launch.rb:55:in `Before'
These are my paths before I run the test suite:
export APP=prebuilt/ios/Build/Products/Debug-iphonesimulator/leeo-cal.app
export APP_BUNDLE=$APP
cucumber -p ios
This is my config.yml
ios: PLATFORM=ios -r features/support -r features/ios/support
This is the Before in my 01_launcher.rb
Before do |scenario|
scenario_tags = scenario.source_tag_names
reset_between_scenario = !scenario_tags.include?('#tandem_scenario')
if reset_between_scenario
if LaunchControl.target_is_simulator?
target = LaunchControl.target
simulator = RunLoop::Device.device_with_identifier(target)
bridge = RunLoop::Simctl::Bridge.new(simulator, ENV['APP'])
bridge.reset_app_sandbox
else
LaunchControl.install_app_on_physical_device
end
end
launcher = Calabash::Cucumber::Launcher.launcher
unless launcher.calabash_no_launch?
launcher.relaunch
launcher.calabash_notify(self)
end
end
I'm not really sure what's going on. Is a file not being loaded correctly?
This is the gist to the 01_launch.rb file: https://gist.github.com/DexterV/94b0853e8f784171adce

Related

Azure Pipeline: How to save Visual Studio "Test Results" to use with other tasks in the pipeline?

I have a pipeline (classic view) with the task "Visual Studio Test", with task version "2.*".
After the task completes I can see that it prints in the log the test results.
How can I save 'Total Tests' and 'Passed Tests' in variables to use with further tasks of the pipeline?
I tried extracting the .trx file but it gets deleted after the task completes.
Performing VsTest gives me this (Some tests fail, but it's OK):
Adding trx file C:\vsts-agent-win-x64-2.165.2\_work\6\s\TestResults\TestResults\----.trx to run attachments
**************** Completed test execution *********************
Result Attachments will be stored in LogStore
Publishing test results to test run '3748'.
TestResults To Publish 189, Test run id:3748
Test results publishing 189, remaining: 0. Test run id: ---
Published test case results: 189
Result Attachments will be stored in LogStore
Run Attachments will be stored in LogStore
Received the command : Stop
TestExecutionHost.ProcessCommand. Stop Command handled
SliceFetch Aborted. Moving to the TestHostEnd phase
Please use this link to analyze the test run : https://---
Test run '---' is in 'Completed' state with 'Total Tests' : 202 and 'Passed Tests' : 19.
##[error]System.Exception: Some tests in the test run did not pass, failing the task.
##########################################################################
Finishing: VsTest - testPlan
When I try to cd into the TestResults:
+ cd C:\vsts-agent-win-x64-2.165.2\_work\6\s\TestResults\TestResults
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\vsts-agent-w...lts\TestResults:String) [Set-Location], ItemNotFoundE
xception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
##[error]PowerShell exited with code '1'.
You can change the default test result output folder by setting the Test results folder field. See below:
Folder to store test results. When this input is not specified, results are stored in $(Agent.TempDirectory)/TestResults by default, which is cleaned at the end of a pipeline run
In above example. The test result .trx file will be stored at $(System.DefaultWorkingDirectory)\TestResults folder which will not be cleaned up.
Then you can extracting the .trx file in the following tasks and save 'Total Tests' and 'Passed Tests' in variables.
See below screenshot from my test pipeline:
Vstest task log:
Powershell task to ls the contents:
So it seems VsTest deletes all its results after the task is complete.
I solved this with a REST API command.
Make sure you convert your Personal Access Token to Base64...
Here's how I did it:
$personalToken = [your token]
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personalToken)"))
$header = #{authorization = "Basic $token"}
$params = #{
Uri = 'https://dev.azure.com/[organization]/[project]/_apis/test/runs?buildIds=[BuildId]&api-version=6.0'
Headers = $header
Method = 'GET'
}
$output = Invoke-RestMethod #params
$run = $output.value | Where-Object{$_.name -match [BuildId]}
Write-Host "Total Tests: $($run.totalTests)"
Write-Host "Passed Tests: $($run.passedTests)"
Write-Host "Failed Tests: $($run.unanalyzedTests)"
Write-Host "Skipped Tests: $($run.incompleteTests)"

App Center test cases getting failed throwing error "shel': Error while starting {"message"=>"Waited for Calabash server on 37282. Did not launch.","

I am using Xamarin UITest 2.2.6 (Tried downgrading the version to 2.2.4 & 2.2.5).
I can sucessfully run my tests on my local machine.
We are not using calabash package dependency anywhere in our project.
While running my tests on App Center we are getting below error on App Center:
SetUp : System.Exception : Failed to execute:
/Volumes/Data/xamarin/pipeline/versions/47ce72b23d7ff4d03244dfc4945dbf7b9c9d701a/adt/sdk/platform-tools/adb
shell am instrument -e "target_package" "com.hargray.MobileGuide" -e
"main_activity" "null" -e "debug" "false" -e "test_server_port"
"37777" -e "class"
"sh.calaba.instrumentationbackend.InstrumentationBackend"
com.hargray.MobileGuide.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
- exit code: 1/Volumes/Data/xamarin/pipeline/versions/47ce72b23d7ff4d03244dfc4945dbf7b9c9d701a/adt/sdk/platform-tools/adb:407:
warning: already initialized constant ARGVParse am instrument -e
target_package com.hargray.MobileGuide -e main_activity null -e debug
false -e test_server_port 37777 -e class
sh.calaba.instrumentationbackend.InstrumentationBackend
com.hargray.MobileGuide.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner{:instrumentation=>"com.hargray.MobileGuide.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner",
:instrumentation_name=>"sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner", :main_activity=>"null",
:class=>"sh.calaba.instrumentationbackend.InstrumentationBackend",
:target_package=>"com.hargray.MobileGuide",
:package_name=>"com.hargray.MobileGuide.test"}Parse am instrument -e
target_package com.hargray.MobileGuide -e main_activity null -e debug
false -e test_server_port 37777 -e class
sh.calaba.instrumentationbackend.InstrumentationBackend
com.hargray.MobileGuide.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner{:instrumentation=>"com.hargray.MobileGuide.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner",
:instrumentation_name=>"sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner", :main_activity=>"null",
:class=>"sh.calaba.instrumentationbackend.InstrumentationBackend",
:target_package=>"com.hargray.MobileGuide",
:package_name=>"com.hargray.MobileGuide.test"}/Volumes/Data/xamarin/pipeline/versions/47ce72b23d7ff4d03244dfc4945dbf7b9c9d701a/adt/sdk/platform-tools/adb:117:in
`shel': Error while starting {"message"=>"Waited for Calabash server
on 37282. Did not launch.",
"device_id"=>"e1569682-22a4-475c-b747-d45568eb827a",
"error_code"=>104}, 503, {"message":"Waited for Calabash server on
37282. Did not launch.","device_id":"e1569682-22a4-475c-b747-d45568eb827a","error_code":104}.
(RuntimeError)

gulp-less doesn't make CSS files anymore

I'm using gulp for generating CSS from LESS. It has worked perfectly, but now the script seems to ignore the LESS files.
Here is my gulpfile.js (it is definitely correct, since I have not change it in the last time):
// Include Gulp plugins
var gulp = require('gulp'),
less = require('gulp-less'),
watch = require('gulp-watch'),
prefix = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
filter = require('gulp-filter'),
rename = require('gulp-rename'),
path = require('path')
;
// Compile LESS to CSS
gulp.task('build-less', function() {
const fileFilter = filter(['*', '!mixins.less', '!variables.less']);
gulp.src('./public/less/*.less') // path to less file
.pipe(fileFilter)
.pipe(plumber())
.pipe(less())
.pipe(gulp.dest('./public/css/')) // path to css directory
;
});
// Get vendors' code
gulp.task('build-vendors', function() {
gulp.src(['./public/components/bootstrap/less/theme.less', './public/components/bootstrap/less/bootstrap.less']) // path to less file
.pipe(plumber())
.pipe(less())
.pipe(rename(function (path) {
//rename all files except 'bootstrap.css'
if (path.basename + path.extname !== 'bootstrap.css') {
path.basename = 'bootstrap-' + path.basename;
}
}))
.pipe(gulp.dest('./public/css')) // path to css directory
;
});
// Run the build process
gulp.task('run', ['build-less', 'build-vendors']);
// Watch all LESS files, then run build-less
gulp.task('watch', function() {
gulp.watch('public/less/*.less', ['run'])
});
// Default will run the 'entry' task
gulp.task('default', ['watch', 'run']);
And here is the call and the output:
$ gulp
[11:21:03] Using gulpfile /var/www/path/to/project/gulpfile.js
[11:21:03] Starting 'watch'...
[11:21:03] Finished 'watch' after 21 ms
[11:21:03] Starting 'build-less'...
[11:21:03] Finished 'build-less' after 13 ms
[11:21:03] Starting 'build-vendors'...
[11:21:03] Finished 'build-vendors' after 4.65 ms
[11:21:03] Starting 'run'...
[11:21:03] Finished 'run' after 5.37 μs
[11:21:03] Starting 'default'...
[11:21:03] Finished 'default' after 6.05 μs
The whatch also works correctly -- when I edit my LESS files I get an output like this:
[11:22:22] Starting 'build-less'...
[11:22:22] Finished 'build-less' after 1.96 ms
[11:22:22] Starting 'build-vendors'...
[11:22:22] Finished 'build-vendors' after 1.78 ms
[11:22:22] Starting 'run'...
[11:22:22] Finished 'run' after 5.08 μs
I also tried to run the build-less directly:
$ gulp build-less
[11:24:06] Using gulpfile /var/www/path/to/project/gulpfile.js
[11:24:06] Starting 'build-less'...
[11:24:06] Finished 'build-less' after 13 ms
No errors, but also no changes at the CSS files.
What might go wrong here and how to fix it?
gulp-filter uses multimatch to match file paths against globbing patterns. The documentation for multimatch has this to say about *:
* matches any number of characters, but not /
Since you're trying to match files with paths like public/less/foo.less (which contain a /) using a single asterisk * doesn't work. You have to use two asterisks **:
gulp.task('build-less', function() {
const fileFilter = filter(['**/*', '!**/mixins.less', '!**/variables.less']);
gulp.src('./public/less/*.less') // path to less file
.pipe(fileFilter)
.pipe(plumber())
.pipe(less())
.pipe(gulp.dest('./public/css/')); // path to css directory
});

Mage_Selenium_Driver::doCommand() should be compatible with that of PHPUnit_Extensions_SeleniumTestCase_Driver

I am trying to configure Magento test automation framework on my system.
When I run phpunit in command line, I am getting following error. Same error I am getting while running test in the netbeans.
Strict Standards: Declaration of Mage_Selenium_Driver::doCommand() should
be compatible with that of PHPUnit_Extensions_SeleniumTestCase_Driver::doCommand()
in C:\MTAF\taf\lib\Mage\Selenium\Driver.php on line 38
..
Fatal error: Call to undefined method PHPUnit_Framework_TestSuite::isPublicTestMethod() in C:\MTAF\taf\lib\Mage\Selenium\TestCase.php on line 2502
Can some one please suggest some solution for the same.
I changed the code, this is the change I performed:
--- a/framework/Mage/Selenium/TestCase.php
+++ b/framework/Mage/Selenium/TestCase.php
## -409,7 +409,7 ## class Mage_Selenium_TestCase extends PHPUnit_Extensions_SeleniumTestCase
$testMethods = array();
$class = new ReflectionClass(self::$_testClass);
foreach ($class->getMethods() as $method) {
- if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
+ if ($method->isPublic()) {
$testMethods[] = $method->getName();
}
}
I was getting this error when running phpunit >= 4.0. Downgrading to 3.7.x solved it for me.

How to run TAP::Harness tests written in Guile?

The usual approach of
test:
$(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INCDIRS)')" $(TEST_FILES)
fails to run Guile scripts, because it passes to Guile the extra parameter "-w".
One possible approach is to set up your project as follows.
Your directory structure is as follows:
./project Your project files
./project/t/*.t Your unit test scripts
./project/t/scripts/* Auxiliary scripts used by your unit tests
Your ./project/Makefile contains the following:
PERL = /usr/bin/perl
TEST_LIBDIRS = ./lib
RUN_GUILE_TESTS = ./t/scripts/RunGuileTests.pl
TEST_FILES = ./t/*.t
test:
$(PERL) -I$(TEST_LIBDIRS) $(RUN_GUILE_TESTS) $(TEST_FILES)
Your ./project/t/scripts/RunGuileTests.pl contents are:
#!/usr/bin/perl -w
# Run Guile tests - filenames are given as arguments to the script.
use TAP::Harness;
my #tests = #ARGV;
my %args = (
verbosity => 0,
timer => 1,
show_count => 1,
exec => ['/usr/bin/guile', '-s'],
);
my $harness = TAP::Harness->new( \%args );
$harness->runtests(#tests);
# End of RunGuileTests.pl
Your Guile test scripts should start with:
#!/usr/bin/guile -s
!#
; Description of your tests