Xamarin Android unit test automation - unit-testing

I am using NUnitLite for unit tests in Xamarin android project. I can run the unit tests in debug mode on device or emulator by starting the project in VS, which will install the application and I can run tests on device/emulator.
I need to automate this in build process. How to automate this NUnitLite Testcases?
I am following the approach below:
Create a class extending from Xamarin.Android.NUnitLite.TestSuiteInstrumentation, and add the test assembly in OnCreate method.
Install the app in device.
Run the test cases using below command from ABD:
adb shell am instrument -w com.package,mypackage/app.tests.TestInstrumentation
Is this approach correct? Or can this be done any simpler way from NUnitLite itself?

Related

How can I run Django unit test in Microsoft TFS automatically?

How can I run django unit test in Microsoft TFS automatically?
By default the Python-Django test feature is not integrated in TFS.
However vNext build (TFS 2015 and later) have more flexible steps, so you can use the Command line task or Utility: Batch script task to run pytest or django test. That means if you can run the Django unit test in command line, then you can run the tests in TFS.
Please reference this article to do that: Running Python Unit Test in a VSTS/TFS build
Other articles for your reference to run the Django unit test:
Writing and running tests
DJANGO UNIT TEST CASES WITH FORMS AND VIEWS
Setting a Full Testing Framework for Django (and more!)
Besides, you can also have a try for this extension : Python Test

UWP Continuous Integration: How to automatically execute my test part inside of my Unit Test APP by MSTest commandline

My Universal Windows Application now is able to deploy and I try to associate my gitlab CI service to it,But failed to execute the test part automatically with MSTest commandline, which is separated from UWP and work as an Unit Test Application.
I had found so many solutions,telling me such as: Package my app Firstly before using the vstest.console command line to test(Cannot continuous integrate I guess), Making my Test APP and use the project's .dllfiles ,as the testcontainer, to test(Actually I cannot found out the .dll file)
What should I do next If I want to integrate APP with automatically testing part?
Here is the environment:
Windows 10 OS
Visual Stdio 2017(Includes Windows_10_14393 SDK)
GitLab + Windows Runner(same environment as PC)
Test Execution Command Line Tool Version 15.0.27309.0
And my DOM in Solution:
--+-- APP Solution
------+---APP1(University Windows Application)
------+---TestAPP1(Unit Test Application)
You have to just build the test pan p in Release mode and use the .appxreciepe as argument to run vstest.console. no need to build an appx package

UWP unit testing with Jenkins

It is not really an issue I would like to ask today but I search best practices to unit testing a UWP application with Jenkins.
First, I created a Unit Test App for my main application and, on my development machine, I generated appx package using MSBuild command line tool. It works well and I can also execute unit tests with the VS Test console.
Then I tried to automate it with Jenkins on my build server. But the MSBuild command does not work. I have no issue but it produces no output. After lot of research (without any success), my question is the following:
What is the best way to make UWP unit testing with a result dashboard using Jenkins?
Thanks
In order to make MSBuild work correctly, I had to create two subsequent build steps, one with command line argument:
-t:restore
in order to make it restore all the nuget dependencies, and a second one with command line arguments:
/t:Rebuild /p:Configuration=Release
/p:UapAppxPackageBuildMode=StoreUpload
for the real release compilation and the creation of both sideload and storeUpload msix files

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).

Running NUnit tests in TeamCity 6.5.X with NUnit addins

We are using TeamCity 6.5.1 to manage the compilation, testing and deployment of our builds. Up until now we have been using the NUnit Build Runner from TeamCity to run our tests with NUnit 2.5.8 and had great success.
http://confluence.jetbrains.com/display/TCD65/NUnit
All of our tests are written in C# and .Net 4.0 using Visual Studio 2010. The test projects are compiled into an assembly that we reference through the TeamCity interface.
Now we are adding in a new test project for UI tests that require a custom NUnit addin that we developed to extend the native NUnit functionality. When running the tests in a local development environment with NUnit 2.5.8 installed we are able to place the custom addin in the NUnit addins directory. When NUnit is loaded our addin is picked up automatically.
C:\Program Files (x86)\NUnit 2.5.8\bin\net-2.0\addins
Using the NUnit Build Runner in TeamCity 6.5.1 we cannot see of a way to install our addin. Unlike the native installation of NUnit, TeamCity does not appear to pick up an addin just by placing it inside a sub directory of the NUnit installation.
Does anyone know of a way to install/use an addin using the NUnit Build Runner? Existing documentation discusses the NUnit command line console runner which we are not using. We are using the NUnit Build Runner as the method to run all of our tests so it would be most ideal if we could maintain a standard testing mechanism.
Thank you!
I was trying to solve the same problem.
As I found out TeamCity uses its assembly Nunit.
Therefore there is no possibility of expansion. You can use the command line to run tests via Nunit. And TeamCity use step "Build Failure Conditions" for reading logs and view the results.