Rubymine throws a **[BUG] Segmentation fault** when trying to run rspec test - ruby-on-rails-4

I am trying to run my rspec tests from rubymine, but getting this error:
...[BUG] Segmentation fault at 0x00000000000438
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
-- Control frame information -----------------------------------------------
c:0051 p:-17566078017732 s:0152 e:000151 TOP [FINISH]
c:0050 p:---- s:0150 e:000149 CFUNC :require
c:0049 p:0022 s:0146 e:000145 BLOCK /Users/Sunday/workspace/resilience/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri.rb:29
c:0048 p:0149 s:0143 e:000142 TOP /Users/Sunday/workspace/resilience/vendor/bundle/ruby/2.1.0/gems/nokogiri-1.6.6.2/lib/nokogiri.rb:25 [FINISH]
c:0047 p:---- s:0141 e:000140 CFUNC :require
c:0046 p:0064 s:0137 e:000136 TOP /Users/Sunday/workspace/resilience/vendor/bundle/ruby/2.1.0/gems/loofah-2.0.2/lib/loofah.rb:3 [FINISH]
c:0045 p:---- s:0135 e:000134 CFUNC :require...
I have checked on google and followed some stack-overflow answers on how to solve this, but non seems to be working for me.
I have also tried to upgrade the rubymine debugger with the following commands: gem install ruby-debug-base19x --pre and gem install ruby-debug-ide --pre.
the first threw an error:
ruby_debug.c:861:98: error: no member named 'bp' in 'struct rb_control_frame_struct'
if (debug_context->frames[debug_context->stack_size - 1].info.runtime.bp <= thread->cfp->bp),
but the second was successful. Even then I still get the initial error on rubymine when I try to run my tests.
BTW: the tests run well from the terminal, and tests from other projects run well on rubymine. Only this perticular project is not running.
what can I do to make my rubymine run these rspec test from my projects. Thanks for any help.

I finally got it right. I have to go into Rubymine's preferences => Languages and Frameworks => Ruby SDK and Gems to update the version of ruby for the project from 2.1.2 to what is specified in the .ruby-version file for the project, which is 2.1.6.
After doing this, everything worked fine as expected.

Related

Pabot - Unable to run parallel robotframework tests

So, I'm working on a robotframework test project, and the goal is to run several test suites in parallel. For this purpose, pabot was chosen as the solution. I am trying to implement it, but with little success.
My issue is: after installing Pabot (which, I might say, I did by cloning the project and running "setup.py install", instead of using pip, since the corporate proxy I'm behind has proven an obstacle I can't overcome), I created a new directory in the project tree, moved some suites there, and ran:
pabot --processes 2 --outputdir pabot_results Login*.robot
Doing so results in the following error message:
2018-10-10 10:27:30.449000 [PID:9676] [0] EXECUTING Suites.LoginAdmin
2018-10-10 10:27:30.449000 PID:400 EXECUTING Suites.LoginUser
2018-10-10 10:27:30.777000 PID:400 FAILED Suites.LoginUser
2018-10-10 10:27:30.777000 [PID:9676] [0] FAILED Suites.LoginAdmin
WARN: No output files in "pabot_results\pabot_results"
Output:
[ ERROR ] Reading XML source '' failed: invalid mode ('rb') or filename
Try --help for usage information.
Elapsed time: 0 minutes 0.578 seconds
Upon inspecting the stderr file that was generated, I have this message:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\robotframework-3.1a2.dev1-py2.7.egg\robot\running\runner.py", line 22, in
from .context import EXECUTION_CONTEXTS
ValueError: Attempted relative import in non-package
Apparently, this has to do with something from the runner.py script, which, if I'm not mistaken, came with the installation of robotframework. Since manually modifying that script does not seem to me the optimal solution, my question is, what am I missing here? Did I forget to do anything while setting this up? Or is this an issue of compatibility between versions?
This project is using Maven as the tool to manage dependencies. The version I am running is 3.5.4. I am using a Windows 10, 64bit system; I have Python 2.7.14, and Robot Framework 3.1a2.dev1. The Pabot version is 0.44. Obviously, I added C:\Python27 and C:\Python27\Scripts to the PATH environment variable.
Edit: I am also using robotframework-maven-plugin version 1.4.0.8, if that happens to be relevant.
Edit 2: added the error messages in text format.
I believe I've come across an issue similar when setting up parallel execution on my machine. Firstly I would confirm that pabot is installed using pip show robotframework-pabot.
Then you should define the directory your results are going to using -d.
I then modified the name of the -o to Output.xml to make it easy to identify.
This is a copy of the code I use. Runs optimally with 8 processes
pabot --processes 8 -d results -o Output.xml Tests
Seems that you stumbled on a bug in the prerelease version of robot framework (3.1a2.dev1).
Please install a release version of robot framework. For example 3.0.4.
Just in case anyone happens to stumble upon this issue in the future:
Since I can't use pip, and I tried a good deal of workarounds that eventually made things more unstable, I ended up saving my project and removing everything Python-related from my system, so as to allow me to install everything from scratch. In a Windows 10, 64bit system, I used:
Python 2.7.14
wxPython 2.8.12.1, win64, unicode, for py27
setuptools 40.2.0 (to allow me to use the easy_install command)
Robot Framework 3.0.4
robotremoteserver 1.1
Selenium2Library 3.0.0
and Pabot version 0.45.
I might add that, when installing the Selenium2Library the way I described above, it eventually tries to download some things from the pip repositories - which, if you have a proxy, will cause you trouble. I solved this problem by browsing https://pypi.org/simple/selenium/, manually downloading the 2.53.6 .tar.gz file, then extracting it and running setup.py install on the command line.
PS: Ideally, though, anyone should be able to use proxy settings from the command line (--proxy http://user:password#server:port) to get pip and then use it; however, for some reason, probably related to network security configurations that I didn't want to lose time with, this didn't work in my case.

Alamofire- getting 'No such module' error after successful Pod install

Xcode 8, Swift3, cocoapods 1.1+, ios10
I'm getting error - No such module. Below is my pod file and steps I followed. I even looked at same issues from previous versions and solutions mentioned in other threads didn't work.
Setup
Fresh, brand new Xcode 8 project.
Added Alamofire to my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target ‘weatherkaka’ do
pod 'Alamofire', '~> 4.0'
end
Ran the command $ pod install
Install worked fine, and project compiles via workspace file
Opened xcworkspace file
Import: import AlamoFire
I get the error: "No such module: Alamofire".
What am I missing?
Note: I've done clean, re-open Xcode, clean more, re-compile etc. I've added the Alamofire framework to Linked Frameworks and Build phases.
You might get this error for the first time but try to run that project once and it might go away. Also you can command+click the import Alamofire and check that it points to the Alamofire.
You must be using projectName.xcworkspace not the xcodeproj.

Can't start test server on physical device

I installed calabash on a new machine, but tests that I ran on my old machine will not run.
As far as I can tell, both machines are set up the same way. They pull the project from the same repository, which includes a Gemfile with calabash-cucumber version 0.18.0. I set the same BUNDLE_ID, DEVICE_ENDPOINT, and DEVICE_TARGET values and use the same physical device.
When I try to run the tests in the console on the new machine, I get this:
$ bundle exec calabash-ios console
Running irb...
irb(main):001:0> start_test_server_in_background
ArgumentError: Could not find a device with a UDID or name matching 'com.my.apps.bundle.id'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop/device.rb:126:in `device_with_identifier'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop/device.rb:160:in `detect_device'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop/core.rb:71:in `run_with_options'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop.rb:134:in `run'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:718:in `block in new_run_loop'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:716:in `times'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:716:in `new_run_loop'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:584:in `relaunch'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/core.rb:943:in `start_test_server_in_background'
from (irb):1
from /Users/rjones/.rbenv/versions/2.1.5/bin/irb:11:in `<main>'
Any ideas why this isn't working?
Please update to 0.19.0.
Can you also paste the exact command you are using to start the
irb(main):001:0> start_test_server_in_background
ArgumentError: Could not find a device with a UDID or name matching
'com.my.apps.bundle.id'
It looks like you set your DEVICE_TARGET to the bundle id? If not, then you have found a bug. It is possible that 0.18.0 is not compatible with run-loop 2.1.1. Downgrade to run_loop 2.0.9 if you want to verify that this is the problem.
I experienced the same issue, when updating cucumber gem from version 1.3.19 to version 2.3.3. I also run tests on physical devices
edit: Sorry, forgot to mention, that I updated run_loop too from version 2.0.6 to 2.1.3
So the versions:
run_loop (2.1.3)
calabash-cucumber (0.18.1)
I guess these are the two that could affect this part, and cucumber was not involved
I found a solution, by setting the variable DEVICE instead of DEVICE_TARGET
For example:
BUNDLE_ID=<bundle_id> DEVICE=<dev_udid> DEVICE_ENDPOINT=<dev_ip> cucumber
Instead of
BUNDLE_ID=<bundle_id> DEVICE_TARGET=<dev_udid> DEVICE_ENDPOINT=<dev_ip> cucumber

TeamCity does not catch failing tests in minitest

I have TeamCity up and running in a mac environment. A trigger is also setup to to run a rake task containing a number of test cases on every git commit. The rake command successfully pulls the code and runs the test cases. The passing test cases are shown correctly in the TeamCity interface, however, the failing test cases do not show up and the build is marked as successful. When I look at the error Build Log, failing tests are shown as errors. The question is why TeamCity is interpreting failing tests as errors and not as actual failing tests?
The assertions are as simple as the following (obvious failure):
test 'simple_test' do
a = 14
ssert_equal 341, a
ends
PS: the check box to fail the build upon at least one test fail is turned on in Failure Conditions(i.e. at least one test failed)
Ruby version = 2.2.2,
Rails version = 4.2.1,
TeamCity version = 9.1.1,
Testing framework = minitest,
Here is the build log output
Teamcity is not picking up failed tests because mini-test reporter is not up and running. To fix this, following gems must be present in the Gemfile:
gem "minitest", :group => :test
gem 'minitest-reporters', :group => :test
Also minitest reporter must be called. The best place to call it is test_helper.rb
require 'minitest/reporters'
MiniTest::Reporters.use!

jasmine with jscoverage automated testing

Had been looking at the jsunit and jcoverage demos here (click on coverage report link. Open this in a new tab).
I was wondering if any one had done anything similar with Jasmine and JSCoverage ? I'm a little unsure on how to proceed.
[EDIT]
I am wondering if there is something I can do with a jasmine reporter. My Jasmine "hello world" example makes reference to a TrivialReporter. Maybe this can be extended ??
[EDIT]
I've wired up js-test-runner with jasmine right now. Now If I could think of a way to get coverage ??
If you're working on a ruby project and using jasmine via jasmine-gem, I have a patch that adds jscoverage support[1].
If you're using bundler, you can use this version of jasmine with the following command in your Gemfile:
gem 'jasmine',
:git => 'git://github.com/hjdivad/jasmine-gem',
:submodules => true,
:branch => 'jscoverage'
Make sure you've downloaded jscoverage and it's in your $PATH.
You can then add the following to jasmine.yml
coverage:
enabled: true
encoding: utf-8
tmp_dir: tmp
report_dir: public/coverage
skip_paths:
- public/javascripts/vendor
If this works for you, you may want to speak up on the pull request[2] to get it, or some variation, into jasmine-gem proper.
[1] https://github.com/hjdivad/jasmine-gem/tree/jscoverage
[2] https://github.com/pivotal/jasmine-gem/pull/37
If you're not using the jasmine-gem, or don't want to have to run a server to check coverage, I've written a gem that pulls together jscoverage and jasmine. It can run as a rake task in your CI builds.
It can be found here: https://github.com/firstbanco/jasmine-coverage
Install it, then just run
bundle exec rake jasmine:coverage
You're done.
EDIT: As the author of jasmine-coverage, I feel duty bound to to tell you about a better alternative: teaspoon. It requires more setup, but also allows running in the browser so you can use the Chrome debugger.