Running Go tests in Eclipse - unit-testing

I have eclipse and goclipse installed, all is well, I can run a console app in the IDE. It is possible to execute the unit tests in the IDE too?

The latest release of goclipse (0.7.6) does provide a means of doing testing using the "testing" package assuming you have followed the project structure recommended in C:/Go/doc/code.html in the installed file structure created when installing Go.
Using the Eclipse "run external tools" button create a new external tool configuration as follows:
on the Main tab the location is C:/Go/bin/go.exe
the argument is test
the working directory should point to the eclipse workspace folder containing the package that is to be tested (eg ${workspace_loc:/goProject/src/pnp}, where pnp is the name of the package NOT the name of the go file that contains the test).
You can now run the test by pressing the Run button in the usual manner, having given the configuration a sensible name eg: go test pnp. You can now add further tests to the package in different go files (or the same one) and all the tests will be carried out in a manner that is expected.

Yes it is if you make a makefile to do so... If you are asking if goclipse has a built in testing facility like JUnit for java the answer is no though.

The issue 5 was asking to "Integrate 'go test' into the IDE and developer workflow."
It now has just been closed (August 2015), with commit 9c3c858 (next release after 0.11.2), with the following documentation:
Each Go project has 3 built-in Build Targets, which are ways in how the project can be built.
These can be viewed and configured in the Project Explorer:
The modes are:
./... #build: The default build. Builds all Go packages present in the project (excluding test packages).
./... #build-tests: Builds all Go test packages present in the project.
./... #[run-tests]: Builds all and runs Go tests.
Each target can be enabled or disabled when for Eclipse project builds. (There is not much point to have both #build-tests and #[run-tests] enabled though.)

Related

Eclipse CDT missing C/C++ Unit

I'm tasked with hooking up Google Test in Eclipse. I got Google Test working from the command-line, but we want it working like JUnit for Java in Eclipse. This is theoretically possible. However, running through all the online instructions I can find, they all say to use Run -> Run Configurations... -> C/C++ Unit option. For the life of me, I can't find it. Everything else is in the Run Configurations dialog, just not that item.
So I figured, even though we have Eclipse for C++ Developers installed (which should contain everything that the CDT Plug-in contains), maybe it's missing the unit testing stuff. Trying to update CDT, however, just shows that the only thing missing is the Autotools stuff (which we have no need for).
Vital statistics:
Eclipse version: Oxygen.1a Release (4.7.1a)
Operating System: Linux, CentOS
Compiler: gcc
I know that's the not the latest version of Oxygen. It's the latest we can use, because the current versions have a bug that doesn't recognize our code as valid C++.
How do I get the C/C++ Unit option in Run Configurations?
You need to install "C/C++ unit testing support" feature. Go to Help -> Install new software, select All available sites and search for it. Installing it will require Eclipse restart. After restart C++ unit test group will appear in the list of Debug configurations.

Via Windows command line, how can we compile a Netbeans C/C++ application?

Let's take this simple C/C++ application Netbeans project folder.
In Netbeans IDE, we just hit build button on the toolbar to build the application.
I want to do that automatically via Windows command line, how can I do that?
I did google, and found some related posts though not very helpful for me except telling me to call ant dist - though I don't have the build.xml in my Netbeans 8 project.
p.s. I have hundreds of student submissions and need to verify which one is compilable.
I also post on Netbeans forum here.
I want to do that automatically via Windows command line, how can I do that?
NetBeans uses Makefile-based projects as default for C/C++ projects, so you can use make to build your project:
cd <Project dir>
make
It's also possible to build other make-targets (eg. make all or make test (builds / runs tests)).
Note: The Cygwin bin dir (CYGWIN_HOME\bin) must be in system PATH - same applies to other environments (MinGW, Gcc etc).

Unit Testing Windows 8 WIndows Runtime Component With TeamCity

I'm not a Windows 8 developer so excuse any stupid questions.
I have a Windows 8.1 application built in Visual Studio 2013 via a .sln file. This contains a number of projects: there is an application that relies on a library, this library (call it datalib) is built as a Windows Runtime Component (not a DLL);
there is also a test project which runs tests on 'datalib'
All of this works fine in VS2013, i.e. the tests execute.
I've been tasked with creating a TeamCity build for this so I've create a TeamCity build that builds against the sln file but I can't get the tests to execute (they're MSTest tests).
In my configuration I've added the test.dll (in the 'include assembly files list') but when I add this on it's own then I get a bunch of errors around references to types in the 'datalib'
The 'datalib' is built into datalib.winmd (I'm assuming this is the binary) so I thought that including this in the assembly list would fix my problem, but it doesn't.
I assume I'm missing something simple, what is it?
I'm now able to do this and it was a multi step process.
Firstly you don't load/test the winmd file directly you have to load the appx that's created by the test project 1; you can't use the MSTest runner that comes with TeamCity, instead you have to install the Visual Studio Test Runner plugin [2]; you have to run the build agent in an interactive process; and finally you have to install the root certificate that the application was signed with.
You reference the appx like you would a DLL
To install the build agent and have it run interactively it wasn't good enough to use the service and mark 'Interact with Desktop' you need to have full interaction so the agent has to be run from the desktop, as admin, at startup. To do this I had to create a scheduled task that run at startup and was given full privileges.
I installed the cert by running the ps1 file in the same directory as the appx file (Add-AppDevPackage.ps1) I'm sure this is overkill but it seemed like the easiest option at the time
[1] http://msdn.microsoft.com/en-us/library/hh691189.aspx
[2] https://confluence.jetbrains.com/display/TW/VSTest.Console+Runner

How to run C++ test on visual studio online

I have test cases that are executable (*.exe files). There is no user interface involved.
How do I use Team center /visual studio online to run these test cases on server.
For now, either on demand running or scheduled running will work for me.
(Currently I have no test case that runs on server. So you may mention the basic setup. )
I have written some test cases (they are exe files). I can run them locally line any other exe file.
My code is in C++.
My test cases are in C++.
You could run them as part of your build. Just configure a build in VSO for your solution, and then modify the msbuild project file to call your tests and send the output to the build folder so it gets uploaded as part of the drop. If you are using VS, you would get a better experience using the VS unit testing support (i.e., get results in VS): http://www.visualstudio.com/get-started/run-tests-with-builds-vs.

VS2013 All tests are not appearing in test exlorer

I have two projects in my solution which contains tests. I have tried clean build of solution but tests from only one project are appearing in the Test Explorer. I have also checked that Test->Test Settings->Default Processor Architecture is matching with that of project build settings (i.e. x86).
By default the Tests window will only show MsTest tests. If you have written your tests in Nunit you will need to install the 'Nunit Test Adapter' Visual studio extension for it to recognize those.
Have you tried "Kristian Kristensen's" answer to a similar question here:
How to get VS2010 to recognize my mstests generated by SpecFlow?
It worked for me.
When I set Project build settings to Any CPU it works but for any other settings (even when it matching with Test->Test Settings->Default) it fails to detect the unit tests.