I am using clover to calculate the code coverage of my unit tests. I am getting a certain percentage with around 64 tests failing. Just wanted to know whether the failed tests are also contributing to the amount of code covered percentage or not?
First, please note that Clover records two kinds of code coverage:
global coverage - from entire test run, this will always contain code coverage from all tests (and not only tests, also from setUp methods etc)
per-test coverage - code coverage is tracked for every test individually
In case of the per-test coverage you can select whether coverage from failed tests should be included or not. You can configure this option for report generation. See:
for Ant - the 'clover-report' task, 'current' element, the includeFailedTestCoverage="true|false" attribute
for Maven - clover:clover goal, you have to use tag to change the setting
You can also toggle this in IDE (a coloured bar on editor margin will change):
in IDEA - View -> Toolbar - enable it, find "Include coverage from passed tests only" button on the tool bar (the one with a green circle and the "OK" label)
in Eclipse - Coverage Explorer view, "Include coverage from passed tests only" button
References:
https://confluence.atlassian.com/display/CLOVER/clover-setup
Cheers
Marek
Related
I have just added my cucumber test to an Azure pipeline. After running the pipeline I noticed that my cucumber tests are showing up as runScenario instead of the test name.
If I click on the runScenario and I go to Attachments I do see that it shows my test scenario there.
If I run it in IntelliJ my tests shows up as runScenario []
I've googled a bit but cant seem to find how to fix that. Any idea how to show my test scenario or Feature?
On your Agent job tasks I used Maven.
In the configuration under JUnit Test Results add the path to your Junit result (Should be an .xml file). For me specifically it was under:
$(System.DefaultWorkingDirectory)/<project>/target/cucumber-junitReports/Cucumber.xml
Environment
I'm currently trying to run JavaFX GUI tests via xvfb on multiple environments on Travis CI. I'm using Gradle to run these tests while using the TestFX and NestedRunner testing frameworks to write them. Before running the tests, export DISPLAY=:99.0 is called.
Context
There are times when the build succeeds and other times when it fails. However, I've noticed that Gradle outputs a single line that I can use to predict when the build will succeed or fail.
Before that line appears, one will see the following in the Travis CI log:
:richtextfx:compileJava
:richtextfx:processResources
:richtextfx:classes
:richtextfx:compileTestJava
:richtextfx:processTestResources
:richtextfx:testClasses
After that, one of two lines appears that predicts whether the build will succeed/fail:
on success: :richtextfx:testXlib: extension "RANDR" missing on display ":99.0".
on failure: :richtextfx:test
My Question
Why does Gradle change the test task to testXlib task? What are the inner mechanisms that handle this? And what does it all mean?
Gradle for sure does not do this. I've never heard of a task called testXlib and also the complete Gradle source does not contain this character sequence.
Either your build script does this, or some plugin you apply, or an init script that is applied by Travis CI.
Try to increase the logging level to debug and also add a call to tasks --all, maybe that will shed some light.
Once the code coverage is enabled in the project properties window . Once the tets case is run or the package it contains of.Junit test case result can be viewed. To generate a code coverage report run -> code coverage -> generate report and will select the test case what we have executed. we can view the report either in HTML view and code coverage report in RAD.
The applciation is of project level and when i try to get code coverage report , whatever package or the test case executed only some packages are been covered and those packages are not no where related to executed test case.
Is it like by default, few packages are considered for coverage ???????
It would be great if someone explains in a better way....
Can someone give me an ide about method coverage in android apks without having the source code?
I heard that there is an android specific version of emma project that can give method coverage information through instrumentation. But if I do not have the source code how can I instrument th code?
My goal is to some how get a report on which methods were called in the runtime while running the application.
You don't need emma to get a report of which methods are called.
Just:
start DDMS
selected the device
select the process
press "Start method profiling" button (arrows with red button)
"Stop method profiling"
and you'll get a report like this one:
See the details at http://developer.android.com/tools/debugging/debugging-tracing.html
How do I set the main Java type in Eclipse (latest)?
I have a main client, and then a bunch of unit tests that exercise various code paths and conditions. Normally I'd like to debug or execute the unit tests depending on the feature I'm developing. However, when the boss shows up, I'd like to quickly run my main driver class without hunting and pecking for the .java file, then hitting debug.
Is there an easy way to set/change the main type? How do folks normally handle running unit tests in Eclipse?
Click on the arrow in the run/debug icon and select Organize Favorites at the bottom and set favorites for anything you don't want to fumble around for later.
For unit tests, I just run them like anything else in Eclipse. I also include a test target in my Ant scripts.
For unit tests :
You can make test suite so to bundle them by feature. This way you just need to run the test suite related to your feature.
Having several launch configuration :
Just go Run Configuration... or Debug Configuration ... from Run menu and create the configuration you want. Next time you'll want to Run them go again to that menu select it and click Run/Debug;
To gain time you can go to Keys configuration and set at shortcut to "Run..." or "Debug..." submenu.
Right click on your test folder and "Run as ... -> JUnit test"?
From Run > Run Configuration... Create a new Run Configuration for the type of java application you have and the options let you specify the main class.
And these configurations will be available in the Run As button dropdown.