JUnit Test Android with above 80 % Code Coverage - unit-testing

I have to write junit test for all the class used in the project in android with above 80 % code coverage

Related

TFS 2017 build of ordered CodedUI unit tests doesn't give detailed results - Consider all tests as one test

I'm using tfs 2017 to run CodedUI ordered unit tests. These are my build steps:
These are my "Run Functional Tests" configurations:
And these are the "Publish Test Results" (I'm not sure they are correct):
The TestAgent is deployed and the tests are running fine, The problem is that the test results appear as only one result and I can't see detailed result for each test. This is how my tests results looks like (The attachments are screen shots I take for each test):
I can reproduce your situation and TFS will treat the tests as one in the log:
DistributedTests: Total Tests : 1, Passed Tests : 0
It's a know issue, please refer below link:
How to display test results of individual test in the ordered test
suite in TFS Web
This is a limitation of the run functional test task. You can
publish the .trx file using the "publish test results" task and it
will show you all the tests but you wont know which ".orderedtest"
they were associated with etc.
You need either open *.trx file in Visual Studio or use Publish Test Results task(need to check continue on error).
Besides also change the outcome from failed to all in the test result page.

Build and Execute Xamarin.iOS Unit Test from Command Line

I have been trying to run the iOS unit test from command line. I am using Xamarin Studio on Mac for now, I Created a iOS Unit test project as follows
Add New Project --> iOS --> Tests --> Unit Test App
And added a simple Unit test class and its code snippets as shown below:
using System;
using NUnit.Framework;
namespace iOSUnitTest
{
[TestFixture]
public class iOSTestSample
{
public iOSTestSample()
{
}
[Test]
public void MySampleTest() {
Assert.True(true);
}
[Test]
public void MyFailerTest()
{
Assert.False(true);
}
}
}
From Xamarin Studio, I am able to run the application which deploys a app into simulator and execute the test cases. I am trying to automate it through a script.
Till now, I am able to get the Unit Test project build and install the app into the running simulator.
I am not sure how to automate the unit test execution once the app is installed.
This blog post (and the ones linked( might be a bit out-dated but it shows you how to automate unit testing (both simulator and device builds) with the tools that ships with Xamarin.iOS.

Angular 2 Karma - Running a test without simplifying the source code for debug purpose

As the title of this post suggests i want to be able to debug the source code of my angular project. After starting the test with the command ng test i'm trying to debug the code in Chrome. The code for the test case is completely fine, but the code of the service i'm testing has been obfuscated and simplified.
How can i disable the obfuscation and the simplification when trying to debug a test case in karma?

C# unit test results in SonarQube 5.6

Environment : SonarQube 5.6 - SonarQube Runner 2.4 - MSBuild.SonarQube.Runner-2.0 - TFS 2015 - C#6
I've a Visual Studio 2015 solution with C# 6 projects and unit tests. On my TFS 2015 server, I define a build (task-based, not xaml). On my build, I've added the following steps :
- SonarQube for MSBuild - Begin Analysis.
- Visual Studio Test
- SonarQube for MSBuild - End Analysis.
Everything run fine (build, unit tests execution, code coverage, analysis results based on SonarLint, ... except that I don't see the tests results in the Sonar report (code coverage is there !).
I've tried to add some parameters :
- begin analysis : I've added : /d:sonar.cs.vstest.reportsPaths=../TestResults/*.trx
- vstests console : /Logger:trx
In the end analysis logs, I see this :
Attempting to locate a test results (.trx) file...
Located a test results file: E:\agent_work\3\TestResults\tests_results_2016-06-23 14_07_22.trx
Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor
Sensor org.sonar.plugins.csharp.CSharpUnitTestResultsProvider$CSharpUnitTestResultsImportSensor (done) | time=0ms
Any idea why I see always Unit tests=0 in the Sonar report ?
You need to provide full path to the .trx file. With below changes in begin analysis and try it again.
Change
/d:sonar.cs.vstest.reportsPaths=../TestResults/*.trx
To
/d:sonar.cs.vstest.reportsPaths=../TestResults/Mytest.trx

Problem running tests under Netbeans

I am running some Junit tests and Netbeans behaves strangely giving the report in "Output" window:
Testcase: warning(junit.framework.TestSuite$1): FAILED
No tests found in uk.ac.cam.ch.wwmm.chemicaltagger.ChemistryPOSTaggerTest
junit.framework.AssertionFailedError: No tests found in uk.ac.cam.ch.wwmm.chemicaltagger.ChemistryPOSTaggerTest
Test uk.ac.cam.ch.wwmm.chemicaltagger.ChemistryPOSTaggerTest FAILED (crashed)
test:
BUILD SUCCESSFUL (total time: 12 seconds)
The (5) tests are there. I have run mvn test which runs them but fails on OutOfMemoryError. Is this likely to be the cause of the Netbeans problem?
How did you created your test file? Manually, or using NB wizard? (Tools - Create JUnit test from Java file's popup menu)
If you are using JUnit 3, all test methods in your test file must start with "test", e.g.
public void testFoo() { //some testing here :) }
With JUnit 4, a '#Test' annotation is required, e.g.
#Test
public void myOwnTestFoo() { //...}
Otherwise JUnit does not recognize the test and throws AssertionFailedError error.