The NUnit-console 2.6.3 sometimes prints out the following error message instead of running tests. Here is excerpt from my Jenkins test build logs:
00:05:02.982 Process 'nunit-console-x86' [PID 3684] has begun profiling.
00:05:03.698 NUnit-Console version 2.6.3.13283
00:05:03.698 Copyright (C) 2002-2012 Charlie Poole.
00:05:03.698 Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
00:05:03.698 Copyright (C) 2000-2002 Philip Craig.
00:05:03.698 All Rights Reserved.
00:05:03.698
00:05:03.698 Runtime Environment -
00:05:03.701 OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
00:05:03.701 CLR Version: 2.0.50727.5485 ( Net 3.5 )
00:05:03.701
00:05:03.795 ProcessModel: Default DomainUsage: Single
00:05:03.795 Execution Runtime: net-3.5
00:05:33.886 Unable to locate fixture
00:05:33.895 Process 'nunit-console-x86' [PID 3684] has finished profiling.
It happens randomly. I do not change the test assembly or the NUnit configuration. I run NUnit via NCover, but the same problem repeats when I use NUnit alone from the command line.
After enabling the verbose logging in NUnit I noticed that the nunit-agent process prints out its first messages to the log more than half a minute after it was run by the nunit-console. I found out from the source code that nunit-console waits 30 seconds for the spawned nunit-agent process to register itself. Apparently something delays loading nunit-agent so the timeout is hit in nunit-console causing the "Unable to locate fixture ". The nunit-agent process is still running after that and I have to kill it manually.
NUnit-console log:
InternalTrace: Initializing at level Verbose
09:14:08.992 Info [ 1] Runner: NUnit-console.exe starting
09:14:09.006 Debug [ 1] ServiceManager: Added SettingsService
09:14:09.006 Debug [ 1] ServiceManager: Added DomainManager
09:14:09.007 Debug [ 1] ServiceManager: Added ProjectService
09:14:09.007 Debug [ 1] ServiceManager: Added AddinRegistry
09:14:09.007 Debug [ 1] ServiceManager: Added AddinManager
09:14:09.007 Debug [ 1] ServiceManager: Added TestAgency
09:14:09.008 Info [ 1] ServiceManager: Initializing SettingsService
09:14:09.008 Info [ 1] ServiceManager: Initializing DomainManager
09:14:09.008 Info [ 1] ServiceManager: Initializing ProjectService
09:14:09.008 Info [ 1] ServiceManager: Initializing AddinRegistry
09:14:09.008 Info [ 1] ServiceManager: Initializing AddinManager
09:14:09.009 Debug [ 1] ServiceManager: Request for service IAddinRegistry satisfied by AddinRegistry
09:14:09.017 Info [ 1] ServiceManager: Initializing TestAgency
09:14:09.041 Debug [ 1] ServiceManager: Request for service ProjectService satisfied by ProjectService
09:14:09.054 Debug [ 1] RuntimeFrameworkSelector: Current framework is net-3.5
09:14:09.054 Debug [ 1] RuntimeFrameworkSelector: No specific framework requested
09:14:09.054 Debug [ 1] ServiceManager: Request for service ISettings satisfied by SettingsService
09:14:09.058 Debug [ 1] RuntimeFrameworkSelector: Assembly D:\Jenkins\jobs\Job1\GreyBoxTests\bin\Debug\GreyBoxTests.dll uses version 4.0.30319
09:14:09.064 Debug [ 1] ServiceManager: Request for service TestAgency satisfied by TestAgency
09:14:09.065 Debug [ 1] RuntimeFrameworkSelector: Test will use net-4.0 framework
09:14:09.066 Info [ 1] ProcessRunner: Loading GreyBoxTests.dll
09:14:09.067 Info [ 1] TestAgency: Getting agent for use under net-4.0
09:14:09.070 Debug [ 1] TestAgency: Using nunit-agent at c:\Program Files (x86)\NUnit 2.6.3\bin\nunit-agent-x86.exe
09:14:09.091 Info [ 1] TestAgency: Launched Agent process 7240 - see nunit-agent_7240.log
09:14:09.091 Info [ 1] TestAgency: Command line: "c:\Program Files (x86)\NUnit 2.6.3\bin\nunit-agent-x86.exe" 65bc321d-e7dc-4a98-81e6-919b87d5c783 tcp://127.0.0.1:56614/TestAgency
09:14:09.091 Debug [ 1] TestAgency: Waiting for agent {65bc321d-e7dc-4a98-81e6-919b87d5c783} to register
09:14:39.091 Info [ 1] Runner: NUnit-console.exe terminating
NUnit-agent log:
InternalTrace: Initializing at level Verbose
09:14:41.859 Info [ 1] NUnitTestAgent: Agent process 7240 starting
09:14:41.876 Info [ 1] NUnitTestAgent: Running under version 4.0.30319.18444, Net 4.5
09:14:41.876 Info [ 1] NUnitTestAgent: Adding Services
09:14:41.876 Debug [ 1] ServiceManager: Added SettingsService
09:14:41.877 Debug [ 1] ServiceManager: Added ProjectService
09:14:41.877 Debug [ 1] ServiceManager: Added DomainManager
09:14:41.877 Debug [ 1] ServiceManager: Added AddinRegistry
09:14:41.877 Debug [ 1] ServiceManager: Added AddinManager
09:14:41.877 Info [ 1] NUnitTestAgent: Initializing Services
09:14:41.878 Info [ 1] ServiceManager: Initializing SettingsService
09:14:41.878 Info [ 1] ServiceManager: Initializing ProjectService
09:14:41.878 Info [ 1] ServiceManager: Initializing DomainManager
09:14:41.878 Info [ 1] ServiceManager: Initializing AddinRegistry
09:14:41.878 Info [ 1] ServiceManager: Initializing AddinManager
09:14:41.879 Debug [ 1] ServiceManager: Request for service IAddinRegistry satisfied by AddinRegistry
09:14:41.906 Info [ 1] NUnitTestAgent: Connecting to TestAgency at tcp://127.0.0.1:56614/TestAgency
09:14:41.907 Info [ 1] NUnitTestAgent: Starting RemoteTestAgent
09:14:41.908 Info [ 1] RemoteTestAgent: Agent starting
Any NUnit experts could help me with this?
Potential workaround, suggested by Charlie in that Google Groups thread:
One way to avoid this is to stop using the agent. Change the config file
(nunit-console-x86.exe.config) to use the 4.0 CLR before the 2.0 CLR. Then
the test will run in the same process and no agent will be created.
I have confirmed that adding <supportedRuntime version="v4.0.30319" /> inside <startup> in the nunit-console.exe.config file (or nunit-console-x86.exe.config), and removing <supportedRuntime version="v2.0.50727" (if present) does cause my tests to run without spawning an nunit-agent.exe process. I have not confirmed whether that fixes the error "unable to locate fixture" in my case, but the OP (krzysiek_w) did confirm it in the same thread:
I was not aware of the possibility to run tests in nunit-console without the nunit-agent. After setting the supported framework in the nunit-console config file, the tests execute without creating the separate process which completely fixes the problem.
As an additional note, the option /trace=Verbose can be passed to NUnit to get more info, as krzysiek_w did in that thread. For me, those logs are output to C:\Users\(myuser)\AppData\Local\NUnit\logs.
Related
I am using junit5 standalone platform launcher and I want to execute the same test class several times using the command line of junit-platform-console-standalone-1.9.2.jar.
I tried repeating (as per junit5 documentation) --select-class argument, i.e:
java -jar junit-platform-console-standalone-1.5.2.jar --select-class=com.pcbsys.nirvana.nJMS.JMSQueueTxSessionConsumerTest --select-class=com.pcbsys.nirvana.nJMS.JMSQueueTxSessionConsumerTest --include-engine=junit-vintage --include-engine=junit-jupiter -cp ...
This yields:
Test run finished after 67368 ms
[ 3 containers found ]
[ 0 containers skipped ]
[ 3 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 1 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 1 tests failed ]
I can see that the test is executed only once (it is a failing test).
I also tried
--select-iteration=class:com.pcbsys.nirvana.nJMS.JMSQueueTxSessionConsumerTest[2]
but this syntax aims at parametrized tests, so was not the right for me.
Any ideas what needs fixing?
I'm using the complied library of jars of a java project and trying to run a junit 5 test via console launcher. Same test works when i right click and run as junit test but via console launcher it throws the below error.
This is what i'm using to compile the program and it complies without errors
javac -encoding UTF8 -cp /abc/Junit/lib/*:/var/Unit/lib/* /abc/Unit/ /Junit/test/BuildTest.java
and this is how I run the tests
java -jar /abc/Junit/lib/junit-platform-console-standalone-1.6.0.jar --classpath /abc/Junit/lib/*:/abc/Unit/lib/*:/abc/Junit/test --include-classname ".*" --scan-classpath
This is error I'm getting
Thanks for using JUnit! Support its development at https://junit.org/sponsoring
.
+-- JUnit Jupiter [OK]
| '-- buildTests [X] com.build.Info
'-- JUnit Vintage [OK]
Failures (1):
JUnit Jupiter:buildTests
ClassSource [className = 'com.buildTests', filePosition = null]
=> java.lang.NoClassDefFoundError: com.build.VersionInfo
java.lang.Class.getDeclaredFields(Class.java:868)
org.junit.platform.commons.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:1334)
org.junit.platform.commons.util.ReflectionUtils.findAllFieldsInHierarchy(ReflectionUtils.java:1092)
org.junit.platform.commons.util.ReflectionUtils.findFields(ReflectionUtils.java:1080)
org.junit.platform.commons.util.AnnotationUtils.findAnnotatedFields(AnnotationUtils.java:371)
[...]
Caused by: java.lang.ClassNotFoundException: com.build.VersionInfo
java.net.URLClassLoader.findClass(URLClassLoader.java:610)
java.lang.ClassLoader.loadClassHelper(ClassLoader.java:935)
java.lang.ClassLoader.loadClass(ClassLoader.java:880)
java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:1225)
java.lang.ClassLoader.loadClass(ClassLoader.java:863)
[...]
Test run finished after 73 ms
[ 3 containers found ]
[ 0 containers skipped ]
[ 3 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 1 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 0 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 0 tests failed ]
Finally, was able to figure out why the error is thrown. Issue was not giving the actual jar and using wild card while running the test. It has to be blah/lib/core.jar not blah/lib/*. Hope this helps someone in the future.
When starting up graphdb, the log reports a few warnings related to an illegal reflective access operation by org.springframework.cglib.core.ReflectUtils in lib/spring-core-5.0.4.RELEASE.jar and then pauses for a wile at:
[INFO ] 2018-11-19 17:02:34,109 [main | c.o.g.Config] Using 'file:/home/ubuntu/graphdb-free-8.7.2/conf/logback.xml' as logback's configuration file for graphdb
[INFO ] 2018-11-19 17:02:34,427 [main | c.o.g.s.GraphDB] Starting GraphDB in workbench mode.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/home/ubuntu/graphdb-free-8.7.2/lib/spring-core-5.0.4.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO ] 2018-11-19 17:02:39,572 [main | c.o.g.Config] GraphDB Home directory: /home/ubuntu/graphdb-free-8.7.2
[INFO ] 2018-11-19 17:02:39,572 [main | c.o.g.Config] GraphDB Config directory: /home/ubuntu/graphdb-free-8.7.2/conf
[INFO ] 2018-11-19 17:02:39,573 [main | c.o.g.Config] GraphDB Data directory: /home/ubuntu/graphdb-free-8.7.2/data
[INFO ] 2018-11-19 17:02:39,573 [main | c.o.g.Config] GraphDB Work directory: /home/ubuntu/graphdb-free-8.7.2/work
[INFO ] 2018-11-19 17:02:39,573 [main | c.o.g.Config] GraphDB Logs directory: /home/ubuntu/graphdb-free-8.7.2/logs
After approximately 8-13 minutes, the log reports a session ID generation process is finished and the server is deployed:
[WARN ] 2018-11-19 16:38:41,843 [main | o.a.c.u.SessionIdGeneratorBase] Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [784,201] milliseconds.
Running:
graphdb-free-8.7.2
Ubuntu 18.04.1 LTS
openjdk version "10.0.2" 2018-07-17, OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3), OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3, mixed mode)
Is it necessary for it to take so much time? Or, can this be turned off?
Thanks!
You can safely ignore the first warning message caused by running the database with Java 9. The new module encapsulation system causes this warning. See what is an illegal reflective access.
For some unknown reasons, the Apache Tomcat 9.0.4 code base is not capable to generate a random ID. Like it's suggested in Slow startup on Tomcat 7.0.57 because of SecureRandom you should start the database with ./graphdb -Djava.security.egd=file:/dev/./urandom or simply add to $GDB_HOME/bin/graphdb.in.sh the line: JAVA_OPTS_ARRAY+=("-Djava.security.egd=file:/dev/./urandom").
I`m trying to create a cluster with two nodes using glassfish 4.1.1 build 1.
One node is local, an the other one is ssh.The node is working as if I ping it it responds ok. ( Successfully made SSH connection to node node2 (gfNode2))
I have setup ssh, create the node, create one instance (i2) on that node but when i want to start the instance i get:
i2: Could not start instance i2 on node node2 (gfNode2). Command failed on node node2 (gfNode2): Previous synchronization failed at Sep 10, 2016 12:25:27 PM Will perform full synchronization. Removing all cached state for instance i2. CLI802 Synchronization failed for directory config, caused by: remote failure: SynchronizeFiles: Exception reading request Command start-local-instance failed. To complete this operation run the following command locally on host gfNode2 from the GlassFish install location /opt/glassfish4: lib/nadmin start-local-instance --node node2 --sync normal i2
if i run this command on node 2 machine i get:
./nadmin start-local-instance --node node2 --sync normal i2
Previous synchronization failed at Sep 10, 2016 12:25:27 PM
Will perform full synchronization.
Removing all cached state for instance i2.
Enter admin user name> admin
Enter admin password for user "admin">
CLI802 Synchronization failed for directory config, caused by:
remote failure: SynchronizeFiles: Exception reading request
Command start-local-instance failed.
any idea what to try next ?
Update:
The DAS is reachabe, the ssh is working properly (ping-node-ssh works from das).
What I have noticed is that even after i have installed (install-node-ssh) and create with(create-node-ssh), node 2 has no files inside.
At /glassfish4/glassfish/nodes/node2/i2 there is only one file: .syncstate which is empty. The node2/i2 directories are there but nothing in i2. Maybe due to : Removing all cached state for instance i2.
That is what i got in DAS logs:
[2016-09-10T19:31:14.806+0000] [glassfish 4.1] [WARNING] [] [javax.enterprise.system.core] [tid: _ThreadID=106 _ThreadName=admin- listener(5)] [timeMillis: 1473535874806] [levelValue: 900] [[
Could not start instance i2 on node node2 (gfNode2).: Command ' /opt/glassfish4/glassfish/lib/nadmin --_auxinput - --interactive=false start-local-instance --node node2 --sync normal i2' failed on node node2 (gfNode2): Previous synchronization failed at Sep 10, 2016 12:25:27 PM
Will perform full synchronization.
Removing all cached state for instance i2.
Command start-local-instance failed.
CLI802 Synchronization failed for directory config, caused by:
remote failure: SynchronizeFiles: Exception reading request: To complete this operation run the following command locally on host gfNode2 from the GlassFish install location /opt/glassfish4:
lib/nadmin start-local-instance --node node2 --sync normal i2]]
[2016-09-10T19:31:14.818+0000] [glassfish 4.1] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=102 _ThreadName=admin-listener(1)] [timeMillis: 1473535874818] [levelValue: 1000] [[
RestResponse.getResponse() gives FAILURE. endpoint = 'https://localhost:4848/management/domain/servers/server/i2/start-instance'; attrs = '{}']]
[2016-09-10T19:31:14.820+0000] [glassfish 4.1] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=102 _ThreadName=admin-listener(1)] [timeMillis: 1473535874820] [levelValue: 1000] [[
Error in instanceAction ;
endpoint=https://localhost:4848/management/domain/servers/server/i2/start-instance;attrsMap=null]]
If I try to run the command from node2 I got what is showed on first code block of the post...
The problem here is that the remote instance i2 can't communicate with the DAS to download its configuration.
You will need to verify:
Is the DAS online?
Is the server where the DAS is reachable by the remote node?
Is SSH communication working properly? (use the asadmin command ping-node-ssh
If you open the server.log file for the instance and on the DAS, that should give you a more detailed error message and indicate whether or not the request is reaching the DAS.
The instance logs are located in:
$GLASSFISH_HOME/glassfish/nodes/node2/i2/logs/server.log
The domain logs are located in:
$GLASSFISH_HOME/glassfish/domains/domain1/logs/server.log
I tryed a very simple plugin (with just an AnAction), and when I run or deploy it the result is:
On PyCharm SDK: The plugin is disabled.
On Intellij Community Edition: it works as expected
PyCharm is my primary target, so I need it to works, but have no clue to debug it. I just see this in the logs of PyCharm, which show my plugin was indeed disabled:
2015-03-11 11:34:19,911 [ 0] INFO - #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2015-03-11 11:34:19,923 [ 12] INFO - #com.intellij.idea.Main - IDE: PyCharm Community Edition (build #PC-139.1001, 07 Jan 2015 00:00)
2015-03-11 11:34:19,923 [ 12] INFO - #com.intellij.idea.Main - OS: Linux (3.11.10-25-desktop, amd64)
2015-03-11 11:34:19,923 [ 12] INFO - #com.intellij.idea.Main - JRE: 1.7.0_71-b14 (Oracle Corporation)
2015-03-11 11:34:19,923 [ 12] INFO - #com.intellij.idea.Main - JVM: 24.71-b01 (Java HotSpot(TM) 64-Bit Server VM)
2015-03-11 11:34:19,925 [ 14] INFO - #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -Dawt.useSystemAAFontSettings=lcd -Djb.vmOptionsFile=/home/b/tools/pycharm-community-4.0.4/bin/pycharm64.vmoptions -XX:ErrorFile=/home/b/java_error_in_PYCHARM_%p.log -Xbootclasspath/a:/home/b/tools/pycharm-community-4.0.4/bin/../lib/boot.jar -Didea.paths.selector=PyCharm40 -Didea.platform.prefix=PyCharmCore -Didea.no.jre.check=true -Djb.restart.code=88
2015-03-11 11:34:19,951 [ 40] INFO - #com.intellij.idea.Main - JNA library loaded (64-bit) in 26 ms
2015-03-11 11:34:20,148 [ 237] INFO - .intellij.idea.IdeaApplication - WM detected: KWin
2015-03-11 11:34:21,047 [ 1136] INFO - llij.ide.plugins.PluginManager - 13 plugins initialized in 751 ms
2015-03-11 11:34:21,047 [ 1136] INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: CVS Integration (11), Git Integration (8.1), GitHub, IDEA CORE, IPython Notebook (0.1), Python ReStructureText Integration (VERSION), ReStructuredText Support (136.SNAPSHOT), Subversion Integration (1.1), Task Management (1.0), Terminal (0.1), hg4idea (10.0)
2015-03-11 11:34:21,047 [ 1136] INFO - llij.ide.plugins.PluginManager - Loaded custom plugins: Markdown (0.9.7)
2015-03-11 11:34:21,047 [ 1136] INFO - llij.ide.plugins.PluginManager - Disabled plugins: Android View Client code helper (1.0)
You need to mark your plugin descriptor as compatible with IDEs other than IntelliJ IDEA, by adding the correct <depends> tag. See the documentation for more information.