We are using IBM Rational Test RealTime for unit testing of ANSI-C code. It's my job to tell a Jenkins server to run those tests automatically.
Documentation suggests what command line should be used:
studio -r <node>.{[.<node>]} <project_file> [-html <directory>]
Unfortunately running studio -r with any more parameter does not output anything to the console. If it does not do the intended unit testing job, it terminates immediately and gives no error message whatsoever. This is frustrating. The error class can be deduced from the exit code, but that is not really enough for troubleshooting.
Any idea where to find error output? I can not find any log file.
The detailed command line syntax is described here,
but this claims, what apparently is not true:
All messages are sent to the standard error output device.
If it runs successfully missing console output can be tollerated, but if it fails to run the test, I really, really would like to see the stuff that is normally output into the RTRT main window. Note: a unit test that fails
e.g. on an assertion is counted as "successful" test run in this context.
Related
We have AzureDevops build pipeline. Where we have the following steps.
Prepare Analysis for SonarQube
Run unit tests
Run integration tests
Run code analysis
For #4, when we try to Run Code Analysis, it is giving some weird error from SonarQube scanner.
java.lang.IllegalStateException: Line 92 is out of range in the file
But file has only 90 lines of code. I am not sure why it is complaining this?
SonarQube scanner failing with line out of range
In general, this issue occurred with one file that went down on number of lines, then sonar use the cache, that is why it looked for a line out of range.
Just like user1014639 said:
The problem was due to the old code coverage report that was generated
before updating the code. It was fixed after generating coverage
reports again. So, please also make sure that the any coverage reports
that are left behind from the previous run are cleared and new
coverage reports are in place.
So, please try to run the command line:
mvn clean test sonar:sonar
to clean the old report.
Besides, if above not help you, you should make sure analyzed source code is strictly identical to the one used to generate the coverage report:
Check this thread for some details.
Hope this helps.
When I execute go test for a whole package the tests fail with:
$ go test github.com/dm03514/go-edu-db/...
# github.com/dm03514/go-edu-db/backends
go1: internal compiler error: in read_type, at go/gofrontend/import.cc:669
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gccgo-4.9/README.Bugs> for instructions.
FAIL github.com/dm03514/go-edu-db/backends [build failed]
? github.com/dm03514/go-edu-db/cmd [no test files]
# github.com/dm03514/go-edu-db/httpd
go1: internal compiler error: in read_type, at go/gofrontend/import.cc:669
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gccgo-4.9/README.Bugs> for instructions.
FAIL github.com/dm03514/go-edu-db/httpd [build failed]
? github.com/dm03514/go-edu-db/logging [no test files]
While the above tests fail go install builds correctly and I can run each of my individual tests correctly:
$ go test github.com/dm03514/go-edu-db/backends/backends_test.go
ok command-line-arguments 0.025s
go test github.com/dm03514/go-edu-db/httpd/handlers_test.go
ok command-line-arguments 0.021s
Has anyone ran into this before? I am brand new to Go, and to get around this I have just been executing each one of my test files individually.
The output of go build is nothing
$ go build github.com/dm03514/go-edu-db/...
$
go version is
$ go version
go version xgcc (Ubuntu 4.9-20140406-0ubuntu1) 4.9.0 20140405 (experimental) [trunk revision 209157] linux/amd64
This happened to me as well. I ended up just commenting out different tests until I was able to see useful output and to see when it would start passing. The root cause was one of my concurrently running test goroutines was calling t.Errorf (specifically, I was using the testify/assert package, but this eventually calls t.Errorf) after the test was completed. The output using go test -v eventually had this error message:
Fail in goroutine after TestTradeReader_Subscribe has completed
For me, this happened because I was using an httptest.Server (which runs concurrently during my test) and was checking input on a test case that exited quickly and didn't require this check.
The thing that helped me.. If you use plenty of tests in a loop and you create some of the mocked services OUTSIDE the loop, it may cause some problem.
TO SOLVE THIS: just move your mocked objects creation for your complex tests inside the loop and it will be done!
There is probably a routine leak. You maybe be modifying/updating a global variable in the test and not reverting for the second test.
Second reason for this error could be your test in not running in a closed env. and effecting other test after.
you can re-structure your test so that the test giving error runs at first so that it succeeds
Simply put:
When I execute the tests using boost runner I get the following error and the c/c++ unit testing hangs.
XML parse error: The entity name must immediately follow the '' in the entity reference.
How do I avoid this from happening?
FYI:
The test runners run perfectly fine from the command line outside of eclipse, or in a debug window in eclipse, so it must be an eclipse issue isolated in the "c/c++ unit console".
Im running Kepler.
Gracias.
If you put a BOOST_CHECK inside a test stub, and the tested code is multithreaded, the asynchronous <Info> output will probably corrupt the XML output. Check the XML output carefully to spot what is the offending test.
At least up to 1.57, while validating stub usage is also important for unit-testing modules, Boost.Test is not considered thread-safe in this context.
You could probably work around the problem by redirecting the output stream and overloading boost::unit_test::unit_test_log.set_stream.
I am running tests through Jenkins on a windows box. In my "Execute Windows Batch command" portion of the project configuration I have the following command:
nosetests --nocapture --with-xunitmp --eval-attr "%APPLICATION% and priority<=%PRIORITY% and smoketest and not dev" --processes=4 --process-timeout=2000
The post build actions have "Publish JUnit test result report" with the Test report XMLs path being:
trunk\automation\selenium\src\nosetests.xml
When I do a test run, the nosetests.xml file is created, however it is empty, and I am not getting any Test Results for the build.
I am not really sure what is wrong here.
EDIT 1
I ran the tests with just --with-xunit and REM'd out the --processes and got test results. Does anyone of problems with xunitmp not working with a Windows environment?
EDIT 2
I unstalled an reinstalled nose and nose_xunitmp to no avail.
The nosetest plugin for parallelizing tests and plugin for producing xml output are incompatible. Enabling them at the same time will produce the exact result you got.
If you want to keep using nosetest, you need to execute tests sequentially or find other means of parallelizing them (e.g. by executing multiple parallel nosetest commands (which is what I do at work.))
Alternatively you can use another test runner like nose2 or py.test which do not have this limitation.
Apparently the problem is indeed Windows and how it handles threads. We attempted several tests outside of our Windows Jenkins server and they do not work either. Stupid Windows.
I am new to testing in Xcode. I am following the developer documentation "iOS Developement Guide" Unit Testing Applications.
I have successfully added unit test bundles to my application with one failing test.
When I build the test target the output shows 1 error as expected but the editor does not show the expected error message under the failed test.
Does anyone know any configurations that need to be set to enable this feature?
Apples docs say:
"If the unit-test bundle is configured correctly, the build fails and Xcode displays an error message in the text editor."
TIA
Vital Clue:
- One thing I have noticed in my output window is the message "Command /bin/sh failed with exit code 1"
Try to follow this guide
Be double careful about when to set application target, and when to set Unit test target. It works fine for me though.
If Unit Test fail, there should be some messages shown in the console.