Open steel119 opened 8 years ago
Hi,
in your karma config you've configured the remote reporter to point to localhost:8888 which is not the default port (9889). If you want to use a different port then you have to annotate the test class with
@KarmaTestSuiteRunner.KarmaRemoteServerPort(8888)
(I've described that almost at the end of the documentation)...
Have you done that?
With kind regards
Thanks for the response. I initially tried it with the default port but got the same error, Please find the error for your reference:
c:\NIWorkSpace\network-insights-web-portal>karma start karma.conf.js 24 05 2016 13:06:44.803:INFO [karma]: Karma v0.13.22 server started at http://lo calhost:9876/ 24 05 2016 13:06:44.803:INFO [launcher]: Starting browser PhantomJS 24 05 2016 13:06:45.809:INFO [reporter.remote]: Error while communicate to remot e server ("localhost:9889") to report test results. Error: connect ECONNREFUSED 127.0.0.1:9889 24 05 2016 13:06:45.809:INFO [reporter.remote]: Connection closed 24 05 2016 13:06:46.356:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on s ocket /#fN2SRkxmFOciQtzsAAAA with id 78011606 24 05 2016 13:06:46.377:ERROR [reporter.remote]: Not connected to server. 24 05 2016 13:06:46.387:ERROR [reporter.remote]: Not connected to server. 24 05 2016 13:06:46.389:INFO [reporter.remote]: Error while communicate to remot e server ("localhost:9889") to report test results. Error: This socket is closed 24 05 2016 13:06:47.392:INFO [reporter.remote]: Karma finished...
Can you post one of the test cases?
i have not event started with writing test case. I was just trying the setup.When i tried to run 'karma start karma.conf.js' there was an error.
Below is the link that i am referencing for setting-up : https://objectpartners.com/2014/08/19/add-javascript-unit-tests-and-run-them-with-grails-test-app/
haha - interesting - I didn't know that somebody actually wrote about that plugin :)
So back to the problem:
You need at least one test case e.g. ` import de.is24.util.karmatestrunner.junit.KarmaTestSuiteRunner import org.junit.runner.RunWith
@RunWith(KarmaTestSuiteRunner.class) @KarmaTestSuiteRunner.KarmaConfigPath("./path/to/karma.conf.js")
public class JavaScriptUnitTestKarmaSuite {
} `
The test runner I've implemented (@RunWith(KarmaTestSuiteRunner.class)
) will start a server and will receive the tests results from karma which are send by the configured remote reporter karma plugin...
When the server receives the test results from karma it will publish them as JUnit test reports...
But without one test case - nobody starts the server, that's why the remote reporter karma plugin outputs the connection refused exception ...
Does that make sense to you?
with kind regards
Totally makes sense. Let me try it. Thanks again
I got it working. Thanks for the help A quick question though I have my own grails plugins where we have given angular.min.js Now in my module where i have configured karma.conf.js i need to use the angular.min.js from the plugin as i don't want to duplicate it in all the modules. When i run the unit test with ''test-app unit:javascript" it is not able to reference the "angular.min.js" from the plugin. Though if i give "angular.min.js" locally its running fine.
Hmm - I'm not sure I understand your problem correctly - let me summarise what I think you've meant:
You've have a grails application which consists of several modules (plugins) -> one of you're plugins contains the static js resources like angular.min.js let's call it my-resources-plugin Another plugin or the main app let's call it foo-module depends on that my-resources-plugin and foo-module contains the js tests. Now you have the problem that foo-module can not run the tests since you can't reference the my-resources-plugin::angular.min.js in the foo-module::karma.conf.js?
If that's the case - I'm not sure whether I can help you that much since my grails-time is over for almost 2 years and I don't know grails in that detail anymore... (But as a motivation - in my previous job we had exactly the situation I described above and we solved it somehow, but I can't remember how :)
But let me ask a question: if your foo-module depends on my-resources-plugin (I guess the dependency is a compile dependency) the my-resources-plugin should be stored somewhere in the directory of the foo-module (e.g. /
Does that help you?
When i run karma start karma.conf.js
I am getting the below error:
c:\NIWorkSpace\network-insights-web-portal>karma start karma.conf.js 24 05 2016 12:24:51.473:INFO [karma]: Karma v0.13.22 server started at http://lo calhost:9876/ 24 05 2016 12:24:51.488:INFO [launcher]: Starting browser PhantomJS 24 05 2016 12:24:52.488:INFO [reporter.remote]: Error while communicate to remot e server ("localhost:8888") to report test results. Error: connect ECONNREFUSED 127.0.0.1:8888 24 05 2016 12:24:52.489:INFO [reporter.remote]: Connection closed 24 05 2016 12:24:53.057:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on s ocket /#dGuxYeoDdWFNol1QAAAA with id 55430891 24 05 2016 12:24:53.079:ERROR [reporter.remote]: Not connected to server. 24 05 2016 12:24:53.089:ERROR [reporter.remote]: Not connected to server. 24 05 2016 12:24:53.091:INFO [reporter.remote]: Error while communicate to remot e server ("localhost:8888") to report test results. Error: This socket is closed 24 05 2016 12:24:54.095:INFO [reporter.remote]: Karma finished...
c:\NIWorkSpace\network-insights-web-portal>
My karma.conf.js file is:
// Karma configuration // Generated on Tue May 24 2016 10:48:30 GMT-0400 (Eastern Daylight Time)
module.exports = function(config) { config.set({
}) }
Any help would be appreciated.
Thanks