Unit tests

C# has a template for creating unit tests in .Net. Has anyone got any experience of how they need to be created in oxygene for .net?
In fact, are there any suggestions for doing unit test with cross platform classes?

Currently, we can use only platform-specific test frameworks.

IMHO, testing features can be extremely useful addition to Oxygene, especially if they will be integrated with IDE, so we can run tests from IDE and see test results! XCode and VS already have test frameworks integrated, and Oxygene can follow! :wink:

P.s. Delphi have test framework (DUnit-based), but it is not integrated inside IDE.

Maybe RemObjects can do tests on Mac/Java/Win via implementing test runner via RO SDK server? And IDE can be a client for runner with some GUI for test tree and some marks for test results? And Oxygene can have special project type with server integrated? And all we should do, is to write TestCases in modules for this project? :wink:

In Oxgyene for .NET you can use NUnit as your testing framework (http://www.nunit.org/).

As for cross platform tests, as @deksden said you can use only platform specific frameworks like NUnit or JUnit.

Hi Nick,

I created a template for creating a NUnit test class:


I have an installer for those templates that you can download here:
https://dl.dropboxusercontent.com/u/9556454/OxygeneTemplates.exe

I will see if I can create a template for the testing framework Microsoft uses in Visual Studio this weekend…

Best Regards,

Jeroen

Thanks for the replies, I’ll try installing your template.

Totally agree with the idea for better cross-platform support within the IDE, it would be very useful.

I did manage to get a working example with the built in system before I saw your template by starting with a class library, adding a reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework
and the adding a uses clause for Microsoft.VisualStudio.TestTools.UnitTesting .
Then each test class had the attribute [TestClass] and each method [TestMethod].
Using the various methods of Assert can be used for the tests. Works ok.

Only problem is all of the tests seem to be in a single list not in a tree like in DUnit. Does that mean there is no way of doing that or is NUnit really the best way to go? If that is the case, I’m surprise how basic the built in test framwork is.

Thanks again,

Nick

Will it work in Oxygene for JAVA? I know JUNIT but how to use it in VS.

I will have a look for a JUnit template… the current NUnit template is only for .Net

Thanks. Some time ago I wrote my own XUnit based on .NET version to use the same tests code in VCL and Oxygene. But it’s not VS integrated.

NUnit is also not VS integrated, I just created a template to make it easier to start writing unit tests.
xUnit ( http://xunit.codeplex.com ) does have a VS integration plugin, I will make a template for xUnit soon, it seems to be better than NUnit…

The JUnit template will offer mo VS integration, you will need to run the JUnut test runner on your jar file AFAIK.
Maybe a post-build action can help here?

Hello,
Have you done template for xUnit ?
I’m seraching good framework for writing test and I don’t know what is the best choice for Oxygene .NET and Android.
Can you help me ?

Best regards
Mateusz

We’ll also have a cross-pltform unit testing framework, called EUnit, coming up soon probably with the next, Bradbury, release. Stay tuned for more on this soon.

2 Likes

Thank you Marc for your answer it’s a great info for us !!!

Marc can we start using EUnit (I saw it in alpha oxygene) ?
Can you give me some directions how to start it ?
I can test it if you give some example :slight_smile:

You can start using it on your own account. We’ll have project templates, samples and docs eventually, but cannot gove you an ETA for that, Sometime in the next few weeks.