How can we run C++ Unit Test in Github Workflow? - c++

I am using Microsoft Unit Testing Framework. I have successfully created and used the tests to check the program. I want to create an assignment for students where the same test cases can run as a workflow so that the assignments can be checked on every push on Github repository. How to configure the workflow so that the workflow use the test file in the folder to run the tests?

Related

Is it possible to publish test results to a repo in Azure DevOps?

I have a suite of unit tests that I would like to use as a source of documentation (to supplement our other documentation).
The unit tests are written in MSTest and we use the "Visual Studio Test Task" within our Azure DevOps builds to ensure they all pass.
We are currently in the process of putting together documentation for each of our repos (stored in GIT in Azure DevOps) but I am reluctant to manually write documentation that explains scenarios that we already have covered in unit tests.
I have found the area of Azure DevOps that lists all the test runs across all the builds/repos but this isn't what I am after.
What I would like to do, is to be able to reference the latest test results for a given repo from within the repo (maybe a link in the readme.md file).
Is there some way that I can maybe publish the latest test results to a static location?

Azure DevOps 'Run Only Impact Tests' doesn't work with XUnit Tests?

I have an ASP.net Web API project (.NET Framework v4.6.2) where I have written unit test cases using XUnit.
I have created a build pipeline in Azure DevOps with 'Run only impacted tests' set to checked. Also, my Visual Studio test version is set to *2.** in my test assemblies.
I have tried to run my mock tests (No data driven test cases) to check that only impacted test run but all the tests run.
I had hard luck finding the solution for It. Can anyone know how to do it right?
I have read this article and and done setting accordingly, but failed.

What is difference of test builds in teamcity and test builds in octopus?

I've been searching for this but no answers.
I've created a unit test project in my solution.
Since we're planning to automate the testing. We don't know where to put it.
Will the teamcity test it or just build the test project? If it will going to be tested does it mean that it is ok not put it in octopus?
You should run your tests in Team City, and fail the build if the tests fail.
Only if the tests pass should you allow the build artefacts to be sent to Octopus, which will then take care of deploying the software.
General test should be run on the build server but you may want to run integration tests from Octopus after the deployment has happened. An example of post-deploy testing would be something like Selenium smoke tests to ensure the deployment was successful and the application is running as expected (e.g. a website on IIS).
Generally you want tests to fail as early as possible (e.g. in UAT instead of production, in CI instead of Test/UAT etc..)

How to Deploy Data in an SSDT Unit Test but Only for the Unit Test

I have successfully begun to write SSDT unit tests for my recent stored procedure changes. One thing I've noticed is that I wind up creating similar test data for many of the tests. This suggests to me that I should create a set of test data during deployment, as a post-deploy step. This data would then be available to all subsequent tests, and there would be less need for lengthy creation of pre-test scripts. Data which is unique to a given unit test would remain in pre-test scripts.
The problem is that the post-deploy script would run not only during deployment for unit tests, but also during deployment to a real environment. Is there a way to make the post-deploy step (or parts of it) run only during the deployment for an SSDT unit test?
I have seen that the test settings in the app.config include the database project configuration to deploy. But I don't see how to cause different configurations to use different SQLCMD variables.
I also see that we can set different SQLCMD variables in the publish profiles, but I don't see how the unit test settings in app.config can reference different publish profiles.
You could use an IF-statement, checking ##SERVERNAME and only running your Unit Testing code on the Unit Test server(s), with the same type of test for the other environments.
Alternatively you could make use of the Build number in your TFS Build Definition. If the Build contains, for example the substring 'test', you could execute the the test-code, otherwise not. Then you make sure to set an appropriate build number in all your builds.

Multiple test sets in Maven

I have written a REST server (in Java using RestEasy) with a unit test suite written in Scala. The test suite uses the mock server provided by RestEasy and runs with every Maven build.
I would like to create a second functional test suite that calls an actual tomcat server and exercises each REST service. I do not want this new suite to run with every build, but only on demand, perhaps controlled with a command line argument to Maven.
Is it possible to create multiple independent test suites in a Maven project and disable some from automatic running, or do I need to create a separate Maven project for this functional suite? How can I segregate the different functional suite code if these tests are in the same project with the unit tests (different directories)? How do I run a selected suite with command line arguments?
I never used it myself but I am aware of maven integration tests run by the Maven Failsafe plugin.
As the surefire plugin by default includes the tests named **/Test*.java, **/*Test.java, **/*TestCase.java the failsafe plugin runs the **/IT*.java, **/*IT.java, **/*ITCase.java tests.
Both test approaches have different intentions which seems to match part of your needs. It might be worth to have a look.....
Another approach would be to use maven profiles and specifiy different surefire includes for each profile.