nikseras / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

IDEA Plugin: Unable to attach test reporter to test framework #258

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open attached project in IDEA
2. Run jsTestDriver.conf run configuration
3.

What is the expected output? What do you see instead?

Jasmine spec should be executed. Instead I got "Unable to attach test reporter 
to test framework" and an IDE Exception (see below)

What version of the product are you using? On what operating system?
Mac OS X 10.7, java version "1.6.0_26", IDE 10.5.1, JsTestDriver Plugin 1.3.5, 
JsTestDriver 1.3.2, Jasmine 1.0.2, JasmineAdapter from 
https://github.com/ibolmo/jasmine-jstd-adapter.

Please provide any additional information below.

IDEA Stack Trace:

Error during dispatching of 
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=com.google.jstestdriv
er.idea.RemoteTestResultReceiver$1@12ff20f7,notifier=null,catchExceptions=false,
when=1311938837755] on apple.awt.CToolkit@7cb2e67
java.lang.NullPointerException
    at com.google.jstestdriver.idea.execution.tree.RemoteTestListener.onTestFinished(RemoteTestListener.java:109)
    at com.google.jstestdriver.idea.RemoteTestResultReceiver$1.run(RemoteTestResultReceiver.java:90)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:677)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:638)
    at java.awt.EventQueue$1.run(EventQueue.java:636)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:647)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:662)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:515)
    at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:411)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:369)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Original issue reported on code.google.com by stefan.s...@googlemail.com on 29 Jul 2011 at 11:32

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by Sergey.S...@gmail.com on 1 Aug 2011 at 9:09

GoogleCodeExporter commented 8 years ago
I'm running into this problem as well.

OS: Ubuntu
IJ version: 10.5.1
JSTD plugin version: 1.3.5

Same stack trace as the OP.

Original comment by noel....@gmail.com on 19 Aug 2011 at 5:17

GoogleCodeExporter commented 8 years ago
Fixed version of the plugin is 1.3.6.

Original comment by Sergey.S...@gmail.com on 28 Sep 2011 at 8:30

GoogleCodeExporter commented 8 years ago
Getting the same issue!  Whenever I change my configuration.

Original comment by bartw...@gmail.com on 10 Nov 2011 at 7:03

GoogleCodeExporter commented 8 years ago
I'm getting the error "Unable to attach test reporter to test framework...."  
but only when I'm try to use the "All configuration files in directory" option. 
 This option is  really important for my large project.  Any help would be 
greatly appreciated.

JSTestDriver Plugin Version 1.3.9
IntelliJ version 10.5.2
Windows 7 

Original comment by bartw...@gmail.com on 10 Nov 2011 at 8:31

GoogleCodeExporter commented 8 years ago

Original comment by corbinrs...@gmail.com on 10 Nov 2011 at 8:35

GoogleCodeExporter commented 8 years ago
I apologize but I found out the issue and it wasn't a bug.  I had named my test 
config files with a .conf extension and IntelliJ wasn't figuring out they were 
config files for the JSTestDriver.  I renamed them with a .jstd extension and 
now the "All configuration files in directory" option is working.  It wasted 
1/2 a day of my life - it would by nice if the docs specified to name the 
config files with a .jstd extension when using IntelliJ.

Original comment by bartw...@gmail.com on 10 Nov 2011 at 10:31

GoogleCodeExporter commented 8 years ago
Thanks for the feedback, bartwood.
* Actually "Unable to attach test reporter to test framework...." message means 
that JsTestDriver server is not running or have no captured browsers.
In such case there is a detailed error description on the right panel. If you 
don't see it or see something else, please let me know.

* Have you successfully run tests from attached project from the console?
It seems "factor.should factor 1" test expects 'factor' function definition.

* JsTestDriver IntelliJ plugin v1.3.9 bundles JsTestDriver 1.3.3c.
  JsTestDriver 1.3.3c requires you to use JasmineAdapter version 1.1.2 from https://github.com/ibolmo/jasmine-jstd-adapter/tags .
  JasmineAdapter version 1.1.2 depends on jasmine.js version 1.1.0.
  You have jasmine.js version 1.0.2 and unknown version of JasmineAdapter.js.
  I recommend you to download right dependencies manually or use plugin to correct them.
  To correct missing dependencies with help of the plugin, please do this:
  1) remove primefactor/lib folder, that contains jasmine.js and JasmineAdapter.js
  2) restart IDE
  3) open factor_spec.js, you will see error hightlighting on 'describe' and 'it' functions
  4) position the caret on the error-highlighted code, press Alt+Enter and choose "Add Jasmine adapter support for JsTestDriver" from the list of available intention actions.
  5) specify the location for jasmine.js and JasmineAdapter.js.

* Actually "All configuration files in directory" works fine for the attached 
project. A file is considered to be JsTestDriver configuration file if its name 
matches 'jsTestDriver.conf' or '*.jstd'.
  Maybe you are talking about another project.
  I'll add '*.jstd' info to the wiki page.

Thanks!

Original comment by Sergey.S...@gmail.com on 11 Nov 2011 at 6:30

GoogleCodeExporter commented 8 years ago
Hi Sergey,

In IntelliJ, if I named the conf files with a .conf extension IntelliJ does not 
put the 'JSTD' icon on the file.  It doesn't recognize the file as a 'JSTD' 
file.  When I try to run using the 'All configuration files in directory' it 
bombs because the plugin doesn't recognize there are any files in the 
directory.  If I rename the files to .jstd then IntelliJ puts the 'JSTD' icon 
on the files and I can run with the 'All configuration files in directory' 
option with no errors at all.  I just think that the error 'Unable to attach 
test reporter to framework' is an erroneous error message in that situation.

BTW, A BIG THANKS for helping with this plugin - it's a life saver with unit 
testing javascript :)

Original comment by bartw...@gmail.com on 11 Nov 2011 at 4:26

GoogleCodeExporter commented 8 years ago
As I said before the plugin identifies a file as a JsTestDriver configuration 
file (i.e. puts 'JsTD' icon on a file) if its name matches 'jsTestDriver.conf' 
or '*.jstd'.

If no files are identified as configs under a given directory, there will be no 
action 'Run all jstd configs in a directory' available on a right-click on this 
directory.
If you were able to run tests, I think you created RunConfiguration manually. 
And as you ran this RunConfiguration you most likely saw something like this 
(in the right-bottom panel):

Exception in thread "main" java.lang.RuntimeException: No valid config files 
found
    at com.google.jstestdriver.idea.TestRunner$Settings.build(TestRunner.java:347)
    at com.google.jstestdriver.idea.TestRunner$Settings.access$100(TestRunner.java:291)
    at com.google.jstestdriver.idea.TestRunner.main(TestRunner.java:185)

Well, that is not good.
I'll try to enhance error handling for this particular case.

Maybe a little description on the JsTestDriver RunConfiguration dialog (when 
'All configuration files in directory' is selected) will help.
And maybe there will be shown a list of all files that are identified as JsTD 
configs and located inside the currently selected directory.

Original comment by Sergey.S...@gmail.com on 11 Nov 2011 at 7:34

GoogleCodeExporter commented 8 years ago
Sergey,

When I run my unit tests I have a single .jstd file per QUnit test file.  I do 
this because if I run multiple test files in the same .jstd file the memory 
bleeds over from one test to another - if I mock a class/function in one QUnit 
test file the test files that run afterwards also see the same mocked 
class/function etc. rather than the original file. Also I only want to include 
the relevant javascript classes in my test rather than all of the javascript 
classes across my entire application.

In IntelliJ the "All configuration files in directory" is a life saver because 
it allows me to use many config files easily.

But I don't know how to do the same thing from the command line.  Now I'm 
trying to integrate my QUnit tests inside of Team City.  Unfortunately it looks 
like I will need to generate a script that runs each of my tests manually with 
this type of command line...  And I'll need a command line in a batch file 
defined for every single one of my tests.  I was hoping that the --config 
option could take wild cards but didn't have any luck with that.  Any help 
would be greatly appreciated.

..suites\provider>java -jar ..\..\..\..\lib\JsTestDriver-1.3.3d.jar --port 9876 
--browser "C:\Users\user\AppDat
a\Local\Google\Chrome\Application\chrome.exe" --captureConsole --config 
TestOne.jstd --tests all --verbose --testOutput ../results

Original comment by bartw...@gmail.com on 15 Nov 2011 at 6:40

GoogleCodeExporter commented 8 years ago
Run Configuration UI for 'All configuration files in directory' has been 
improved in 1.3.10 version of the plugin.

Original comment by Sergey.S...@gmail.com on 23 Nov 2011 at 3:10

GoogleCodeExporter commented 8 years ago
Great. Unfortunately, the new Plugin Version is incompatible with IDEA 10.5.2. 
See http://youtrack.jetbrains.net/issue/WI-8577.

Stefan

Original comment by stefan.s...@googlemail.com on 23 Nov 2011 at 4:14

GoogleCodeExporter commented 8 years ago
I forgot to clarify that 1.3.10 version of the plugin is compatible with IDEA 
11.
http://confluence.jetbrains.net/display/IDEADEV/IDEA+11+EAP

Original comment by Sergey.S...@gmail.com on 23 Nov 2011 at 6:12