Test Coverage - Exclude The Android SDK - unit-testing

When I run test with coverage, it includes the entire Android SDK.
How do I exclude it so that I get an accurate number?

You can add your app package in default JUnit configuration like-
And it should include only your package.

Related

SonarQube doesn't display unit test coverage

I'm trying to get SonarQube to display unit test coverage generated by cobertura, however when I add unit test coverage widget to the home dashbord I get following error:
I did add coberture plugin to SonarQube and configured reports file location specific to the project I'm using in sonar. Also added configuration to sonar.properties :
sonar.projectBaseDir=<..>\src
sonar.dynamicAnalysis=reuseReports
sonar.cobertura.reportPath=<..>\target\site\cobertura\coverage.xml
sonar.java.coveragePlugin=cobertura
Absolute paths here.
SonarQube version I'm using is 5.6
Cobertura - 2.1.1
I don't have jenkins set up and don't use maven build, the coverage report was generated with ant task.
Did read all the documentations and simply can't understand what I need to get reports visualized in sonar, which is simply all I need.

Adding test cases to TeamCity

I have written some automated test cases in java (selenium IDE)for a project.The project is using ruby on rails. The project was configured in TeamCity. Now I am planning to add these test cases as a build step. How can I achieve this. Which build step should I use.
How do you run them on your local machine?
If you run them from command line you can create build configuation with Command Line runner.If you run them by running JUnit test you can create a build configuration that runs JUnit tests (using some build tools like Ant, Maven, Gradle).

cordova plugin unit testing

Most of the Cordova plugins have a folder called 'tests', which hosts plugin.xml and tests.js. Can anyone shed some light on how to run them, and what is required to run? There seems no relevant documentation. Thanks!
There's an official Cordova library for running the unit tests.
From the Cordova Plugin Test Framework on github:
The org.apache.cordova.test-framework plugin does two things:
Defines the interface for cordova plugins to write tests
Provides a test harness for actually running those tests
Tests run directly
inside existing cordova projects, so you can rapidly switch between
testing and development. You can also be sure that your test suite is
testing the exact versions of plugins and platforms that your app is
using.
Visit that page; there's plenty of information there on running existing tests and using the framework for your own plugins.
There is also a plugin called cordova-paramedic, based on cordova-test-framework which automates manual steps like modifying config.xml:
cd cordova-plugin-name && npm install cordova-paramedic && node node_modules/cordova-paramedic/main.js --platform android --plugin ./ --verbose

No test report files were found in Hudson with NUnit

I could successfully run NUnit in Hudson using batch command and it generates the TestResult.xml in the NUnit installation directory. But Hudson generates the error that
No NUnit test report files were found. Configuration error?
after the correct path is given to the xml file under Publish NUnit test result report. Should the xml file be in the project's workspace or is there any other configuration to make this work???
I referred to the Problem Publishing NUnit Testing Result Reports with Hudson
too but no answer was found.
After trying in different ways to solve the above problem, I could solve it by placing the TestResult.xml file in the workspace folder for the project in Hudson s jobs folder and giving only TestResult.xml under Publish NUnit test result report instead of giving the absolute path to the xml file.
Hope this may help someone...
I found that using double quotes is not working.
Example:
Test report XMLs = nunit-result.xml (works!)
Test report XMLs = "nunit-result.xml" (do NOT work)
There is a SMALL chance that this is your problem...

Jenkins/Hudson and Gallio Unit-Testing Integration

I am struggling to get it to run my tests. In the Execute Windows batch command on Jenkins, I have put the following command:
C:\Program Files (x86)\Gallio\bin\Gallio.Echo.exe" /report-type:Html /verbosity:quiet “Project.Tests\bin\Release\*.Tests.dll
It doesn't like the *.Tests.dll bit, in that it says:
Cannot find directory containing file pattern Project.Tests\bin\Release\*.Tests.dll.
My next question would be if I change the report-type to xml, is it straight forward to get my unit test reports published in hudson?
many thanks.
The following extract runs Gallio tests in a Windows Batch command build step (Download Gallio from)
"c:\Program Files\Gallio\bin\Gallio.Echo.exe" %WORKSPACE%\YourTestPro\bin\Debug\YourTestPro.dll /report-directory:%WORKSPACE%\TestResults /report-type:Xml /working-directory:%WORKSPACE%
To setup Jenkins report generation
Add the Gallio Jenkins plugin to your Jenkins installation to publish the report
In your project under the Add post project action build steps add the xUnit test result report
Select the Add button that appears in the xUnit action step
Select Gallio - N/A
Add TestResults/*.xml to the Gallio N/A Pattern
You can use Maven plugin for .Net: http://docs.codehaus.org/display/SONAR/.Net+plugin
It takes care of Gallio command line generation: you can provide a filter :
<visual.test.project.pattern>*.Tests</visual.test.project.pattern>
<gallio.filter>Category:UnitTests</gallio.filter>
Then, the Maven plugin generates the command line.
You also have a lot of advantages using maven: integration with Partcover/NCover, stylecop/fxcop/gendarme, etc.
OR you can make a MSBuild script for that:
<itemGroup>
<TestsDll Include="**\bin\$(Configuration)\*.Tests.dll" />
</itemGroup>
<Exec Command="Gallio.Echo.exe #(TestsDll, ' ')"/>
I am pretty sure you want to look into using the Gallio Plugin instead of using the execute windows batch command.