Maven - testing stucks before the end on Windows 7 - java

Building project on Win7 takes huge ammout of time, especially leaving the test suite. On my windows machine for 172 tests it takes 230 seconds, and on Jenkins (Ubuntu) about 19 seconds.
I run maven with -X argument to see what it is hanging on, but none of error appeard, after that time it just goes to run next plugin.
I tried to speed up it with setting surefire plugin to run on 4 threads, but it is not the case - Jenkins has exactly the same project as me.
I found that sometimes it hangs on calling externall processes, but the projects is not calling any externall processes (what would be even so easy according to run it on two different OS).
When I run the tests one by one in Win7 the working time is definitly lower that runing them with whole rebuild. This behaviour is the same on other Win7 machines.
How can I figure out what is keeping the maven from leaving the tests and going to next step?
Windows 7 output
Last test output
<--- stucks here
Tests run: 172, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 230.682 sec - in TestSuite
Results :
Tests run: 172, Failures: 0, Errors: 0, Skipped: 0
Next plugin run
Ubuntu output
Last test output
Tests run: 172, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.954 sec - in TestSuite
Results :
Tests run: 172, Failures: 0, Errors: 0, Skipped: 0
Next plugin run

Setting up the surefire plugin version to the latest one 2.19, from 2.16 helped. Now on Windows 7 it takes about 12 seconds, but still I have no idea what was the original cause of stucking.

In order to understand what is going on in your OS, you have to somehow debug your OS. I recommend taking a look at Microsoft Sysinternals and try to use Procmon (Process Monitor) and see what is going on. Sadly, it won't get you all the syscalls as strace on Linux does, but it might help you understand more what is going on.
You can also debug your JVM that executes the tests, it might also give you some answers.

Related

How to print 'Configuration Failure' log on the console which occurs at #BeforeTest of TestNG test class?

I am running some 20 test classes during the regression test. There are some classes where I am getting the 'Configuration Failure' error. I am running my tests from the command line using maven commands. The thing is while going through the logs, I am not able to identify at which classes the mentioned error is coming. After the execution, I just get the info as :
===============================================
TestSuite
Total tests run: 124, Passes: 97, Failures: 8, Skips: 19
Configuration Failures: 2, Skips: 35
===============================================
But I want to print this error log on the console so that it will be easy for me to debug.
Any idea how can I achieve this?
You can see the detailed stacktrace at test-output. This folder generated by TestNG automatically.
Just open index.html by a browser.

why selenium test cases are got skipped randomly while running testng.xml in windows cmd

I have tried to run the selenium automation test cases using testng.xml file with multiple cases, but some cases got skipped. TestNG not showing skipped testcases count also, but showing total count and failures count. Can't find the reason and resolve this issue.
So i need solution for run the tescases using testng.xml without skipping in windows cmd using following command in cmd line;
java org.testng.TestNG %project_location%\sample_testng.xml
Could you please anyone help me on this issue ?
Your tests weren't skipped. They were successful.
Tests run: 19 = Total test count.
Failures: 15 = Failed tests.
Skips: 0 = Skipped tests.
Total test count - Failed tests - Skipped tests = Successful tests.
19 - 15 - 0 = 4 Successful tests

Picked up _JAVA_OPTIONS: -Djavax.net.ssl.trustStore=c:\windows\sun\java\deployment\trusted.cacerts

I'm new to the stack exchange forum.
I'm trying to execute a test in Java using testNG. To give you a brief background, I'm executing the java package through an xml file and running the package as a TestNG Suite. I am also going through a VPN and have passed the arguments in to the run configurations. When I try to run any test I receive the following error:
Total tests run: 0, Failures: 0, Skips: 0
Picked up
_JAVA_OPTIONS: -Djavax.net.ssl.trustStore=c:\windows\sun\java\deployment\trusted.cacerts
I have executed this test successfully before, and I'm not sure what changed. Let me know if you have seen this seen this issue before. Also, let me know if you need any more details, or if you have any questions. I'll take all the help I can get at this point.

Jenkins always show success - TestNG, Selenium

I'm new with Jenkins and I have a problem with builds. I'm writing UI tests with Selenium, Java and TestNG.
My problem is that Jenkins always shows Finished: SUCCESS even if some tests fail.
===============================================
TestAll
Total tests run: 10, Failures: 1, Skips: 0
===============================================
[SSH] exit-status: 0
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Did not find any matching files.
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Notifying upstream projects of job completion
No emails were triggered.
Finished: SUCCESS
How can I resolve my problem?
I assume you are building a Maven Project.
To stop a build on test failure, go to the configure part of your project then go to the build section and in "goals & options line" add :
-Dmaven.test.failure.ignore=false
this should stop the build if errors are found.

Why does ant hang after multithreaded junit test unless I call join?

When I run one of my unit tests through my ant build file's junit target
<junit showoutput="true" printsummary="yes" haltonfailure="yes" fork="yes" timeout="60000">
junit shows me:
[junit] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.958 sec
indicating successful completion of the test, however, it hangs after that line and will sit there for indefinitely (until I kill it).
Within the test, a new thread is created, but based on System.out.println output, I can see that it never completes even though it shouldn't take more than a couple of seconds. If I explicitly call join() then everything completes as expected.
If I run the same junit test in Eclipse (without the explicit join()) nothing seems amiss.
My question is [why] do I need to call join() before my unit test's method returns?

Categories

Resources