I'm running Fitnesse testing tool via Jenkins. Jenkins runs fitnesse after fixed interval. Following is the test page:-Fitnesse Test Page
1.creating script file
2. running it
In this, I'm simply printing message but this test page sometimes thrown an exception:-
java.util.NoSuchElementException
at java.util.LinkedList.removeFirst(LinkedList.java:270)
at com.objectmentor.fixtures.LineGatherer.readLine(LineGatherer.java:42)
at com.objectmentor.fixtures.CommandLineFixture.flush(CommandLineFixture.java:291)
at com.objectmentor.fixtures.CommandLineFixture.flushProcess(CommandLineFixture.java:65)
at com.objectmentor.fixtures.CommandLineFixture.endTable(CommandLineFixture.java:59)
at com.objectmentor.fixtures.CommandLineFixture.doTable(CommandLineFixture.java:48)
at fit.Fixture.interpretFollowingTables(Fixture.java:121)
at fit.Fixture.interpretTables(Fixture.java:107)
at fit.Fixture.doTables(Fixture.java:81)
at fit.FitServer.process(FitServer.java:81)
at fit.FitServer.run(FitServer.java:56)
at fit.FitServer.main(FitServer.java:41)
Exception
This exception thrown sometimes and sometimes it work perfectly. It fail 2 out of 10 times . and I didn't change anything , i am simply running same test after every 30 min.
Related
I have 5 real devices in which I want to execute 20 tests, for example: 4 tests in each device in parallel, that is, in device 1 test 1 is executed, when the test ends, test 2 follows, in device 2 test 5 , at the end of test 5, follows 6... I can only run 1 test on each device in parallel, when I run more than 1, the test fails. Is there a way to specify that the current test is expected to finish before the next one starts? I am using Cucumber, Appium, testNG
You've got to set dataproviderthreadcount somehow.
And that depends on how you run TestNG.
Via the CLI: https://testng.org/doc/documentation-main.html#running-testng
Via Maven: https://maven.apache.org/surefire-archives/surefire-2.21.0/maven-surefire-plugin/examples/testng.html
I am running cucumber test cases in bulk.
Suppose I have 5 feature files to run in bulk and one failed out of it.
So in next execution I'm trying to run failed test cases, for that I'm trying to use Intellij provided feature, i.e. Rerun failed Test. So when I click on it, it gives me below error.
Error:
0 test classes found in package 'test.java'
Picked up JAVA_TOOL_OPTIONS: -'path of JAVA_TOOL_OPTION'
Process finished with exit code -2
Empty test suite.
Every time I try to debug one of my tests (junit 5), I get an exception:
2019-12-20 10:40:53,776 [4972237] WARN - .ExternalSystemTaskDebugRunner - Interrupted function call: accept failed
java.net.SocketException: Interrupted function call: accept failed
at java.base/java.net.PlainSocketImpl.accept0(Native Method)
at java.base/java.net.PlainSocketImpl.socketAccept(PlainSocketImpl.java:159)
at java.base/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:458)
at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:551)
at java.base/java.net.ServerSocket.accept(ServerSocket.java:519)
at com.intellij.openapi.externalSystem.service.execution.ForkedDebuggerThread.run(ForkedDebuggerThread.java:103)
I've done quite a bit of searching through SO here, and have found several people that had similar problems. Most of them were resolve simply by upgrading (to 2013 or whatever, these questions aren't exactly spring chickens). The rest required some special sauce relevant to their system (android stuff mostly). Or they're getting a different exception (being disconnected, where I'm never getting the connection in the first place).
These tests (unit tests for the most part) are attached to a module with no "main".
I've tried launching gradlew -DtestDebug.test=true cleanTest test, and then connect with a remote debug session. I get an error: Unable to open debugger port (localhost:5005); java.net.ConnectException "Connection refused: connect", which I believe is just what IntelliJ's gui shows when it receives the aforementioned exception.
Ideally, I'd like to set my breakpoints, debug-launch my test task (perhaps specifying a class or individual #Test), and it'd Just Work.
Does anyone have any other ideas I could try? Logs I could look at?
The workaround is to switch the build/run actions to IntelliJ IDEA instead of using Gradle.
But if you still have this issue in the current IDE version, please consider reporting it with the sample project and the logs (Help | Compress Logs and Show in ...) attached.
Am running Junit test cases for my project module. After the execution of the test case am getting the below error report.
ClaimControllerTest.shouldReturnClaimWithValidationResult:417 Status expected:<200> but was:<500>
Am using the below maven comment to execute the test case for a specific module.
mvn clean compile verify -Ptest
But, my project have many module dependency. How can i execute my test case for my complete project ( will all modules )
The above error is pointing to the below piece of test case code
mockMvc.perform(get(String.format("/claims/%d/validation-result", claim.getId())))
.andExpect(status().isOk())
.andExpect(jsonPath("$.catClaimNumber").value(claim.getCatClaimNumber().intValue()))
.andExpect(jsonPath("$.validationResult.programErrorCode").value("UNTHRZD_EXTRNL_USR"))
.andExpect(jsonPath("$.validationResult.hasErrors").value(true));
Update 1 :
Am seeing the below null pointer exception after doing Sys out
2019-01-03 15:46:27,401 [main] ERROR api.controller.BaseController: 83 - Unhandled exception while processing request for URL : http://localhost/claims/1901/validation-result with exception : null
java.lang.NullPointerException
For the below code :
mockMvc.perform(get(String.format("/claims/%d/validation-result", claim.getId()))).andDo(print());
It is telling you that instead of a success code 200 from calling your rest endpoint, it received an error code of 500. It means that your rest end point threw an exception.
you may want to print the full response with exception to further debug
mockMvc.perform(get(String.format("/claims/%d/validation-result", claim.getId()))).andDo(print());
You have two questions:
Getting 500 instead of 200 - This is already answered by #mkjh
How to execute test case for complete project ( will all modules ) - For this you should try mockito (mocking other modules) because you cannot and should not take into account of all modules until and unless it's an integration test where in you make sure all the modules are up and running or else you will again end up getting 500 error which basically tells that there is some internal server error happened and in most of the cases it happens because of some services are not up
I have an aws instance running with webservices that I want to test with a java application running JUnit. If I have a script that runs the jar during the validate services step of the code deploy process how does the code deployment handle the return value of the jar if a test fails?
Is it required that I catch exceptions thrown by the jar for the failing tests and call system.exit(-1) to have the script terminate the code deployment or does the exception thrown automatically give the return value of non-zero?
If you are running JUnit using JunitCore, it should return a non-zero exit code if any of the tests fail.
main
public static void main(String... args)
Run the tests contained in the classes named in the args. If all tests run successfully, exit with a status of 0. Otherwise exit with a status of 1. Write feedback while tests are running and write stack traces for all failed tests after the tests all complete.
Parameters:
args - names of classes in which to find tests to run
From: http://junit.org/apidocs/org/junit/runner/JUnitCore.html#main%28java.lang.String...%29