I am setting up a unit test bench and as an example exercise created a simple calculator. I'd like to develop test cases for it. When I try to add the project reference to the unit test project an error "Enable to add a reference to project 'Calculator'" appears. No reason or corrective action is provided
Initially I thought the reason was because developer mode was not enabled on my computer. But the problem persists with developer mode on also.
This issue has been resolved. I created a unit test project in .net instead of universal windows application and it worked
Related
I'm using Visual Studio 2017 to develop Xamarin Android application. I want to add simple unit tests of logic only. For that purpose, I tried adding "Unit Test App (Android)" or "Class Library (Android)" projects with unit tests and none of them work.
Unit Test App (Android)
I add new project to my solution of type "Unit Test App (Android)". Generated project contains TestsSample class with sample tests, but I have no idea how to launch them. I have ReSharper installed, but when right clicking on the project/class I don't have option to run the tests.
When I go to "Test" -> "Run" -> "All tests", the solution is built, but nothing more happens.
Class Library (Android) with nUnit
The other trial was to add new project of type "Class Library (Android)" to the solution. After, I installed nUnit nuget package (install-package nunit which installed package 'nunit.3.6.1' with respect to project 'MoneyBack.Tests', targeting 'MonoAndroid,Version=v6.0'), installation was successful.
I added the following class:
using NUnit.Framework;
namespace MoneyBack.Tests
{
[TestFixture]
public class Class1
{
[Test]
public void SampleTest()
{
Assert.IsTrue(true);
}
}
}
Now when right-clicking on the tests project I see ReSharper's option "Run Unit Tests", so I clicked it and got the following exception:
Am I doing something wrong ? Or it's the issue with VS2017 ? I don't know if I should install VS2015 back or there is some solution. Thanks for your help!
There are three basic levels of testing:
The classic unit testing of pure .Net/Mono code via xUnit|NUnit
Nothing new here, this is the same testing that .Net programmers have been doing all long and has nothing to do with the Xamarin platform frameworks
Note: These tests are totally independent of Xamarin.Android|iOS|Mac
On platform testing (including platform features)
Note: There are multiple on device testing wrappers for NUnit, XUnit, etc... Xamarin includes a NUnitLite version that runs on Android and iOS and that provide a device specific UI to run those tests. Xamarin has templates that create a Unit Test App project for Android or iOS.
Note: These tests can include platform dependent features (Networking, Bluetooth, GPS, SMS, etc... but no GUI related tests) and can also reference Nunit [Test]s written in PCL-based assemblies or platform-specific libraries.
Xamarin.iOS Unit Testing
Xamarin.Mac Unit Testing via GUIUnit
Xamarin.Android Setup and Automating
Alternatives to NUnitLite:
xUnit.net Runners for Devices
NUnit test runners for Xamarin and mobile devices
UI Testing
A Casabash/Appium/... driven tests of the UI elements in your application and their reaction to input (touch) events.
Test Cloud/Mobile Center and/or other local, public or private mobile test clouds
Xamarin Test Cloud
Test are run from the device itself not directly from the code as we are used to. Do this:
1. set you android project as VS startup project
2. Select the harware or simulator that you want to execute the unit test project
3. Run it
4. The unit test project will be deployed and executed in the device.
5. Tap on the line with the project name. The available tests will appear. Tap each one for execution and debug ! :)
You need to install nUnit 2.6.X for using xamarin.UItest.
nUnit 3 is not supported.
I'm trying to figure out how to make it work. The documentation is slim to say the least on this important topic.
The small amount of tutorials I found make reference to options not even present when I open the tool. I don't see the Unit Test Runner, just the Integration Test runner. (version 5.3.1f1)
How to add a test? How to run it?
Integration Test runner allows you to add a test, but I was unable to find how to write the actual test.
It's sad that there's almost no documentation on this anywhere, or at least I haven't found it.
The Unity Test Tools are already included in Unity starting with Version 5.3. Even without downloading the Unity Test Tools from the Asset Store you should be able to find the "Editor Test Runner" in the Window menu. This is basically the Unit Test runner. For other features such as Assertions, Integration tests etc. you still need the Unity Test Tools bundle from the Asset Store.
The test tools use NUnit internally, so you can write tests using the standard NUnit API as described here http://www.nunit.org/index.php?p=quickStart&r=2.6.3.
There is also a Unity tutorial video here: https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/test-tools.
Make sure to put your Tests into an Editor folder.
Also note that some features like Assertions are not supported for Windows Store Apps and you won't even be able to build for this platform as long as you have those libraries in your project.
I am trying to automate a Silverlight web application using CodedUI. The application under test is already developed and deployed in our testing environment.
I tried automating using record feature of CodedUI but was unsuccessful in getting the recorded actions. On googling, I found that I have to install this plugin: https://visualstudiogallery.msdn.microsoft.com/28312a61-9451-451a-990c-c9929b751eb4
I did the installation and still was unable to record. Then I found that I have to reference Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll file in the Silverlight project.
This is where I am stuck. I am not sure whether to reference this file in :
The project which was used to develop the Silverlight application
The CodedUI test project.
If it is option 1, I don't have access to the development project. Is there any workaround for this ?
I am pretty sure you only have to reference it in the Coded UI test project. This is how I do it with the DevExpress.CodedUIExtension helper DLL.
Personally I would put the test code next to the application code though, when you version the tests with the application this will make it possible to run tests against a previous and or branched version.
Yes,You need to Refer the AutomationHelper.dll in The project which was used to develop the Silverlight application. I was having same issue way back refering to dll will solve the purpose.
In addition you can refer it with flag to make sure this will not go to production which is a best practice.
In my current project we are using a TFS Build server for continuous integration (build + run unit tests). We also have a set of automated acceptance tests written as SpecFlow features.
However, these are not integrated into the continuous integration workflow. Today, the application is deployed manually and the acceptance tests are invoked manually.
We would like to automate this in the form of a script/console application or some kind of existing CI tool.
This is what we would like to do periodically, e.g. once every hour:
Ask TFS if there are any new builds
If yes: get the latest successful build from TFS
Deploy the application to our test machine
Execute the SpecFlow tests against the deployed build
Collect the result and present it on some form of web page
Are there any existing tools or frameworks for this? I have read about existing CI servers but they doesn't seem to fit my description. If not, any advice on how to achieve step 1, 2 and 5 programatically or by using command line tools?
In my humble opinion TFS is capable of doing everything that you listed without involving any additional tools. What you might need to do is to setup a Lab Environment and use specific Workflow build definition to achieve it. You need also Test controller and test agents.
The easiest way might be to setup Standard Lab environment which might act in this way -
Build - Deploy - Test workflow
Build got triggered, then got deployed into the lab environment (might be a bunch of either physical or VM machines with installed test agents on them and connected to the Test controller), after that all test are executed and the result is consolidated as a part of the build results.
Hope this helps a bit!
-Rado
In Visual Studio Team Edition there is a load test tool where you can select unit tests, integration tests etc... to form scenarios which are then used in a load test session with different configurations for example varying usage levels.
Looking at for example the NUnit framework, it would be possible to develop a form of such a tool, along with a base load testing code base, but I was interested if anyone knows of any open source project which has has already done a similar thing which could then be of use for this situation and possibly extended?
Cheers for now,
Andrew
Does this help?
http://www.webload.org/
It's only a load tester, not also built with Unit Tests, Integration Tests, etc - However how about a Continuous Integration setup with CruiseControl.NET as your CI Server which would run automated builds and carry out the tests and then use Webload for your load testing? You can certainly get CruiseControl.NET to run external tools - but IDK whether or not Webload has a console which could automatically run the load tests for you - but it probably could ;)