dabs
Full Member
Posts: 78
|
Post by dabs on Aug 13, 2019 13:01:16 GMT
Hi,
I'm running into an error which prevents me from running any unit tests whatsoever. I'm using RhoStudio 6.1.16.
Basically, when I run my tests, I get this error:
Error: undefined method `new' for #
Trace:
C:/RhoMobileSuite6.1.16/ruby/lib/ruby/gems/2.3.0/gems/rhodes-6.1.16/lib/framework/rho/rhoapplication.rb:213:in `require'
C:/RhoMobileSuite6.1.16/ruby/lib/ruby/gems/2.3.0/gems/rhodes-6.1.16/lib/framework/rho/rhoapplication.rb:213:in `serve'
C:/RhoMobileSuite6.1.16/ruby/lib/ruby/gems/2.3.0/gems/rhodes-6.1.16/lib/framework/rho/rho.rb:836:in `serve'
This happens both for an existing project I have (containing a number of unit test), and in a new project I created from scratch. The same happens if I comment out all tests in the existing project.
Any idea what might cause this?
Regards, Daníel
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Aug 19, 2019 11:17:53 GMT
I've been trying to add log messages, both to my code (in spec_runner.rb, as well as in SpecRunner/controller.rb), and also inside rhoapplication.rb, but nothing is added to the rholog.txt file, even though the log file seems to be regenerated each time I execute the test runner.
Am I missing something regarding logging? I've tried Rho::Log.info, Rho::Log.warning, and puts, but none seem to work.
|
|
|
Post by Alex Epifanov on Aug 19, 2019 12:41:40 GMT
dabs please share your project and provide steps how you are running tests.
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Aug 19, 2019 13:58:45 GMT
|
|
|
Post by Alex Epifanov on Aug 19, 2019 18:36:25 GMT
|
|
|
Post by Alex Epifanov on Aug 19, 2019 18:39:50 GMT
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Aug 20, 2019 9:00:06 GMT
Thank you so much, this did the trick for my project.
Log messages also appear in the log, but they never did when I got the error, and it actually never got to the point where the option to view the log appeared in the menu of the simulator.
I will test the branch later and let you know if the generator works for me. I assume I have to build the project, or is there an installer provided?
Regards, Daníel
|
|
|
Post by Alex Epifanov on Aug 20, 2019 10:28:51 GMT
Spec runner is generated with 'rhogen spec'. If you use Rhodes source code instead of gem installer you need to specify full path to <rhodes>/bin/rhogen.
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Aug 22, 2019 17:08:26 GMT
Just out of curiosity: I've noticed that when an assertion fails, even simple one like:
true.should == false
then I get the following error message in the log:
undefined method `pretty_inspect' for true:TrueClass
A similar message appears if the variable in question is a string etc. The test itself fails (as it should), but I don't recall if this message did show up in the log previously (i.e. in the 5.x version).
Does this mean that the tests aren't properly set up, or can I just ignore this message?
Regards, Daníel
|
|
|
Post by Alex Epifanov on Aug 22, 2019 17:11:49 GMT
try including require 'pp' to the test runner
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Aug 23, 2019 16:20:10 GMT
Thanks, that did the trick.
One final question (I hope!): I'm structuring my tests as follows:
describe "SomeClass" it "should do something" do # Test code end end
and possibly one would break the tests for a given module down further:
describe "SomeBiggerClass" do describe "someClassMethod do it "should do something" do # Test code end end describe "someOtherMethod" do # etc. end end
but the log file only displays the innermost "describe", and the text belonging to the "it" block is not displayed.
Is this by design, or is there anything I could to to change this?
This is not a showstopper, since I can work around this by adding a "describe" block around each "it", effectively containing the text from the "it" block, so this is more of a curiosity.
Regards, Daníel
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jul 1, 2020 11:44:54 GMT
Curiously, after I updated to version 7.2 of RhoStudio, the original error reappears.
Is it possible that it would be advisable to create a new project, and copy the code from my old project over to this new project?
|
|
|
Post by Alex Epifanov on Jul 6, 2020 12:55:32 GMT
Curiously, after I updated to version 7.2 of RhoStudio, the original error reappears. Is it possible that it would be advisable to create a new project, and copy the code from my old project over to this new project? It should've gone easier that that. Can you share project, I'll try to build it on my end. As last solution, you can try to copy code to new project.
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 29, 2023 14:36:49 GMT
Coming back to this problem... it seems to be a problems that comes and goes for some reason.
Anyway, I don't know what I did last time to get it to work, but it did work... for awhile. But now I've updated to 7.5, and one again I'm getting the original error.
Also, I get these log messages:
E 06/29/2023 10:37:29:186 00008168 RhoRuby| require_compiled: error: can not find mspec/matchers E 06/29/2023 10:37:29:186 00008168 RhoRuby| Error loading C:/Code/rhomobile/edicohandheld-nav/edicohandheldnav/app/spec_runner.rb: 6 E 06/29/2023 10:37:29:186 00008168 RhoRuby| Error loading C:/Code/rhomobile/edicohandheld-nav/edicohandheldnav/app/SpecRunner/controller.rb: 6 I 06/29/2023 10:37:29:186 00008168 APP| App error: undefined method `new' for #<NoMethodError:0xe541560> C:/RhoMobileSuite7.5.0/ruby/lib/ruby/gems/2.5.0/gems/rhodes-7.5.0/lib/framework/rho/rhoapplication.rb:217:in `require' C:/RhoMobileSuite7.5.0/ruby/lib/ruby/gems/2.5.0/gems/rhodes-7.5.0/lib/framework/rho/rhoapplication.rb:217:in `serve' C:/RhoMobileSuite7.5.0/ruby/lib/ruby/gems/2.5.0/gems/rhodes-7.5.0/lib/framework/rho/rho.rb:845:in `serve'
If I look at the log lines immediately above those, it seems to be trying to find mspec/matchers in a variety of folders, both in my code folders as well as in the RhoMobileSuite folder:
I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: fname: mspec/matchers I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: check dir C:/Code/rhomobile/edicohandheld-nav/edicohandheldnav/app I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: check file: C:/Code/rhomobile/edicohandheld-nav/edicohandheldnav/app/mspec/matchers.android.rb I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: check dir C:/Code/rhomobile/edicohandheld-nav/edicohandheldnav/app I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: check file: C:/Code/rhomobile/edicohandheld-nav/edicohandheldnav/app/mspec/matchers.rb I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: check dir C:/RhoMobileSuite7.5.0/ruby/lib/ruby/gems/2.5.0/gems/rhodes-7.5.0/lib/framework I 06/29/2023 10:37:29:186 00008168 RhoRuby| find_file: check file: C:/RhoMobileSuite7.5.0/ruby/lib/ruby/gems/2.5.0/gems/rhodes-7.5.0/lib/framework/mspec/matchers.android.rb
but apparently it is unable to find anything called matchers.
I notice that the mspec.rb file which is in my app folder contains nothing more than the following require statements:
require 'mspec/matchers' require 'mspec/expectations' require 'mspec/mocks' require 'mspec/runner' require 'mspec/guards' require 'mspec/helpers' require 'mspec/utils/script' require 'mspec/version'
And I do find these files in the following folder:
C:\RhoMobileSuite7.5.0\ruby\lib\ruby\gems\2.5.0\gems\rhodes-7.5.0\lib\extensions\mspec\mspec
Is there something missing in my setup? Can I instruct RhoStudio to examine this particular folder when searching for these mspec/* files?
Regards, Daníel
|
|
|
Post by Dmitry Soldatenkov on Jun 29, 2023 14:45:28 GMT
Do you include "mspec" extension to extensions list in your app build.yml ?
|
|