android c++ unit testing in visual studio 2015 - visual-studio

I've been creating a native android c++ library for audio processing using Visual Studio 2015 and the Android NDK. It works well but what I would really love to be able to do is to write unit tests as well; and as far as I can work out there is no support for unit testing in this case. Does anyone know a way of doing this? (preferably with some reasonably detailed instructions, given my relative lack of experience with C++ and VS). I'd rather do this in Visual Studio rather than using the approach that I've seen mentioned of using JUnit and JNI from another IDE.

I doubt you'll find anything with fancy IDE integration, but for the NDK in general you can use gtest for unit testing.
This answer shows how to do this from within the NDK, but I don't know what extra steps you'll need to make this work within VS.

Related

Running cross platform C++ code using Visual Studio 2015 Cross-Platform

I am simply trying to get a basic app(s) running on my mobile device(s) using Visual Studio 2015's cross-platform capabilities.
I am following the tutorial here to a T.
It is a small OpenGL ES sample that is suppose to build for Android, iOS, and Windows. The solution has four projects: one per platform, and one shared library. Inside this shared library, there is code that references the OpenGL ES headers.
However, I can's seem to get Visual Studio to know where the OpenGL ES libraries/headers are. (I'm not sure where the headers are suppose to be located either).
Has anyone tried to setup this tutorial project with any success?
How can I tell Visual Studio where the OpenGL ES headers are? (also, where are they?!?!) Do I have to tell visual studio something different for each project type? (one per device).
Note the squiggly lines all over the place in the screenshot.
I'm at a loss here. The docs seem to be completely missing this section, and the example template simply doesn't work out of the box.
The example template works for me out of the box--at least, it builds. Did you give up when you saw the squiggles? Broken intellisense is a fact of life in visual studio since the inception of visual studio. My squiggles all went away when I changed the solution platform from x86 to ARM. I assume, because android wants to build on the ARM platform. Initially on my system, even <vector> was squiggled. But, in both cases--it built.
As for where the headers come from, if you assume the template isn't garbage, the openGL headers are clearly included from one of pch.h, SimpleRenderer.h, or MathHelper.h. Checking each of these is but a moment's work.
try to unload static libs for ios and android. it seems vs gets confused with all the projects loaded.

How to compile a DLL without using Visual Studio?

That sounds a stupid question, but I'm really curious about how to compile a DLL without using Visual Studio since I'm using Unity3D OS X for now. Is there some way like "tool chain" can do the trick?
Any solution is appreciated except Ask your friend/colleague to compile it for you or buy another computer/install windows/using remote control.
Build a cross tool chain of Mingw. However, be aware that you can not link C++ libraries between compilers, or often even compiler versions. Only DLLs with a C calling interface will work. (They can internally use C++ but must expose a C API.)
Or you could try running Visual Studio in Wine. VS2010 has bronze support in Wine, i.e. the compiler works.

Can Visual Studio 2010 do Code Coverage analysis on F# modules?

Though I ask it to, Visual Studio 2010 does not appear to generate code coverage statistics for my F# modules. The unit tests are Ms Tests written in C#, so are run natively by Visual Studio, and execute cleanly. But there does not appear to be any coverage information created for the F# library being tested. The C# libraries involved are analyzed just fine.
Am I missing something?
This link describes using the VS testing system with F#. You do it pretty much the same way as with C#.
The downside is that apparently the VS IDE won't automatically pick it up -- I believe you need to run from the command line using mstest.exe.
Edit: Oh, another cool thing with F#, is FsCheck, an automatic testing tool for F#, is basically a port of Haskell's QuickCheck. It allows you to provide a specification of the program, in the form of properties that the functions or methods should satisfy, and FsCheck tests that the properties hold in a large number of randomly generated cases.
also fsunit and fstest

Importing WinSCP source files into Microsoft Visual Studio 2008?

I am pretty new to programming. I would like to download an open source project and build it in my Microsoft Visual Studio 2008. In fact, I tried to import and build the application WinSCP:
https://sourceforge.net/projects/winscp/
But I didn’t work. Please can somebody help me and tell me which files do I have to download (from sourceforge) and how to import these into Microsoft Visual Studio in order to build the application. Thank you a lot. David
WinSCP seems to be written in Borland C++ Builder or whatever it's called today. It's not a standard C++ program and wouldn't compile in any other compiler because it uses special features only present in BCB. (It uses Delphi-style components, VCL and thus the __property keyword.)
Unfortunately, a lot of Open Source projects have very poor support for Microsoft's development tools. One project that comes to mind as being not too big and having workable MSVC project files is FreeType2, but that's a library and not an application, which probably makes it not very interesting for toying around with.
In support forum of winscp, they say, that you can't compile this project in Visual Studio.
Winscp appears to be a CPP project using a makefile instead of a sln file. VS uses SLN and *proj files to control builds and such. A good way to start would be to open VS, create a new console project (and solution) and go through some tutorials online.
If you really want to just see how a large project works in VS, grab something like IronRuby or IronPython or even something like the Witty twitter client.
In the general case, it is not possible to pour the C++ sources of a program into Visual Studio and expect it to work. C++ programming environments are far too different between operating systems for that. If you have a open-source program which builds and runs fine on Linux (for example), it may need several weeks (or months) or programming effort to make it run on Windows.

Using MSTest in an open source project

A colleague and I are writing an application that we intend to go Open Source with and are trying to decide on a testing framework. Without integration of NUnit (one of us has resharper while the other does not) we are leaning toward MSTest. However, if the majority of people that work on opensource .net applications only have the express edition of Visual Studio, we may have to change our mind on that.
What version of VS do you use and would MSTest turn you off to an Open Source Project?
Personally, I'm using VS:TS, so no, test units in MSTest wouldn't turn anything off for me ;), on the other hand, most probably, you will receive different answers from the majority of people, that are not professional programmers as well (working for money doesn't mean you can not work with / on OS projects) (the question is, how many you will find here).
However, if I understand you correctly, you don't want to use nUnit, because you it's not integrated with VS08, you might then check out these projects:
1. http://sourceforge.net/projects/visualnunit/
2. http://sourceforge.net/projects/nunitaddin/
Integrating NUnit with VS08 doesn't seem to the biggest problem, on the other hand, getting VS with built in testing framework might be a bit harder, at least for some people.
If I truly felt strongly enough to participate in the Open Source project, MSTest alone wouldn't be enough to turn me away. I'd be willing to adapt to whatever the development tools/environment was.
...and for what it's worth, I use the full version of Visual Studio with Resharper.
Frankly I never heared of anyone using the Express editions. everybody I know or I talked with either use the fully fledged Visual Studio environment, or they use the compiler/libraries from the free SDK and some editor on top of it (CodeWarrior, CodeInsight etc) and rely on some variant of make to build.
As for the test framework, is a double edged sword. I'd recommend NUnit, but then... remember what happened with NDoc?
I use MonoDevelop and NUnit.
I use VS 2k8 pro & MSTest as much as possible.
Even Microsoft's open source code (Prism/Composite Wpf) doesn't use MSTest. They use NUnit for that project, I believe.
You may be able to use visual nunit to add an nunit test runner in VS. link I've never used it but it may be worth a shot.
If your problem is integration with Visual Studio, try Gallio. It includes MbUnit, but its runner can run tests from other frameworks, like NUnit, xUnit, etc.
It would turn me off. See MSBuild, NAnt, NUnit, MSTest, and frustration (not written by me!) - I suspect a number of people feel that way. MSBuild seems like a poorly-done copy of NAnt (we use both), and MSTest likewise looks like Microsoft's usual "not invented here" answer to open source. While I realize that there are good business reasons for Microsoft to develop their own tools, those reasons don't apply to their customers.
There are plug-ins to use NUnit inside Visual Studio without ReSharper, or you can always configure it to run from the Tools menu.
If you don't like NUnit, please consider one of the other open source testing alternatives. See NUnit vs. MbUnit vs. MSTest vs. xUnit.net
I think that people who don't use windows will be knocked out of the project by the choice to use MSTest. Most other c# testing libraries are available in mono, which is what mac and linux users would be using.
I don't know how many cross-platform developers you are trying to attract, but if it's an issue then you need to consider Linux/Mac devs.

Resources