Sharp Architecture Simple CRUD Application - asp.net-mvc-3

i am trying to get start with the Sharp Architecture by building the test application mentioned here, i have followed through the steps given in the tutorial but hit a road block where the database schema generation is described. According to the tutorial running the test
IceCreamYouScreamCorp.Tests.SharpArchTemplate.Data.NHibernateMaps.CanGenerateDatabaseSchema
will generate the schema in the Database folder, i couldn't find this test in the generate application by Templify. Please anybody who knows the solution guide me how to run this test so to generate the database schema...

may be i have not pharsed the question well enough, i have figured out the solution
download the NUnit framework
runt the test by using the NUnit
it will create the desired database schema for the sample application

If you tryed to use the version 2.0.0.3, you will have this problem.
Try to select the "2.0.0.0" option on Templify.
To run the test, open NUnit GUI, and go to the following folder and open the .dll file:
[Your_Templifyed_Folder]\Solutions\[Your_Solution_Name].Tests\bin\Debug\[Your_Solution_Name].Tests.dll
Now you can see the right tests list in the NUnit interface.

Related

How to get code coverage report when I run tests using java language which tests Go Project code?

I have a very special requirement in integration testing in go. In the past few days I have read through many blogs but I am unable to get the solution for this problem. Please share me if you have done anything below.
Infra details:
Having Go project up and running
Having my automation framework written in JAVA
My Exact requirement is:
I have to instrument the Go code and make the go code running
Execute my java automation code
Stop the Go code / get the code coverage report from Go
Thanks in advance!!
write your Go code as a test, in a file ending_test in the package directory
run the Go test as $ go test --coverprofile outfile . If it needs to run as a server then add some code to time it out
run your additional Java code
wait for the timeout
use a command like $ go tool cover -html=outfile -o cover.html to see the coverage analysis
The goc tool should meet your needs, it basically just need three steps:
launch a services registry center via goc server command
use goc build . to build your Go code and execute the generated binary which would register itself into the registry center above
Execute your automation codes, then you can use goc profile to get the code coverage profile at anytime

The problems occurs when I follow the Acceleo Getting Started guidance in the wiki to generate java code from uml

I spend several days to follow the Getting Started guidance in the wiki to generate java code from uml. I found some problems during the steps and failed to generate code.
This is the link of the guidance I followed: https://wiki.eclipse.org/Acceleo/Getting_Started.
The first question is: when I Right-click on the Acceleo module file (that is, the generate.mtl file) and select Run As > Launch Acceleo Application. I can’t find the uml model as show in the picture below, and also with the Target.
The second question is the problem shown in the acceleo.
In case you can recurrent the problems, I’ll show you the version of eclipse and acceleo I use.
Could you show me how to operate correctly to avoid these problems or is there any problems in my installation?
Thankyou!

MSTest: No test discoverer is registered to perform discovery of test cases

I created a console application that was designed to be completely self-reliant and contain all the necessary DLLs to run. I was able to do this and get it to run locally, but when copying to another computer I began to receive this message...
"No test discoverer is registered to perform discovery of test cases. Register a test discoverer and try again."
I found this Microsoft bug report, but it was closed as could not reproduce:
https://connect.microsoft.com/VisualStudio/feedback/details/770093/unit-test-project-not-discovering-test-cases
I didn't want to sit around waiting for Microsoft to say they couldn't reproduce so I dug into it and found that the reason I was getting this error message is because I was missing the DLL file "Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll".
This is the file that contains the test discoverer and it needs to be in directory of the executable that is running the tests as well as the directory of the test files themselves. It is easy to miss because the assemblies to run the tests appear to be completely contained within the "Microsoft.VisualStudio.TestPlatform" namespace and the tests appear to only require a reference to "Microsoft.VisualStudio.TestTools.UnitTesting".
I decided to post this "knowledge share" post because there was no other information about the issue on the internet and Microsoft's documentation of their MSTest framework is bad at best.
Just come across this issue with some unit tests originally written in .Net 3.5 and running (or not) in vs 2013.
The UnitTestFramework.dll mentioned by Love2Learn was present however updating to .Net 4.5 seems to resolve the problem.
I'm sure someone out there can explain why but my gut feeling is that this has something to do with this being a multi-platform solution and that .Net 4.5 is just better at running 32bit unit tests against 64bit projects.

VS Team: A concrete example of the use of the TestContext property using Microsoft Unit Testing Framework?

While writing my tests this week for a new project, I encountered the TestContext property using the Microsoft Unit Testing Framework available with Visual Studio Team System.
I was wondering:
1. How this property could be used concretely?
2. In other words, what is its purpose?
3. Anyone has a concrete example to provide to ease my understanding?
I have written many tests so far in my career, and have never ever found a use for this particular property.
Any clue anyone?
Thanks in advance! =)
This property can be used to run parametrized tests, like if you have constants you don't want to hardcode in your test project that you want to load and share among all the tests. By default it will be populated with useful information, like the path where your test is running.
Then it is one of the key to run the same test several times with different values. The MSTest framework can be used to link your test project to a database or a csv file and run the tests once for all the rows in the said DB. This is called data driven testing and you'll find many sample on the net. Here is one how to.

Is there an API for running Visual Studio Unit Tests programmatically?

Is there an API for running Visual Studio Unit Tests programmatically?
Running MSTests.exe with Process.Start() does not work in the current scenario. What I'm looking for is something like the NUnit SimpleTestRunner.
Any ideas?
/Erik
You're correct in that there's no public API for the mstest framework. I wrote a manual replacement for mstest one day to see how hard it was, and it's not as simple as it looks (particularly if you want to take advantage of more than one CPU core), so beware of going down this path.
Personally I've always just run mstest.exe programatically and then parsed the resulting .trx XML file. Are there any particular reasons why you can't use Process.Start to run it?
P.S. Some of the strange behaviour of mstest.exe are solved if you pass the /noisolation command line parameter - give that a go if you feel so inclined :-)
Update: Erik mentions he wants to run the test API in the current thread so he can set the thread culture for globalization issues.
If you run a unit test under the debugger, you'll notice that mstest creates a bunch of threads, and runs all your tests in different threads, so this isn't likely to work even if you could access the API.
What I'd suggest doing is this:
From your test "runner" application, set an environment variable
Run mstest pointing it at the specific tests
Add a [ClassInitialize] (or [TestInitialize]) method which reads this environment variable and sets the culture
Profit!
After taking a deep dive with reflector into MSTest.exe and further down into the Visual Studio Unit Test stack, I found that the API used by MSTest is sealed up and made private so that i cannot be used from the outside.
Why not using Reflector and seeing how NUnit SimpleTestRunner is running the tests... And then use this technique...
You can make use of the Microsoft REST API's for TFS to run ms tests. Please refer to the documentation here.
I've linked to "Call a Rest API" so that you can see how you'd go about calling one of the REST API's for TFS.
Note that if your tests are linked to the build, they should run automatically every time a build is queued.
Here is the link to Run Functional Tests.
I've also discovered an article on using the TFS SDK API to run tests. Here is that link as well: Link to API Article

Resources