Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unit Testing with Fortran

wfroese
Beginner
677 Views
I was looking for good tools to aid in the creation and use of Unit Tests in Fortran but I could only find one package. (It was $6k and did way more than I needed). Does anyone here do unit tests and are there any strategies you would wish to share about what works and what doesn't?
Thanks!
0 Kudos
4 Replies
Steven_L_Intel1
Employee
677 Views
Check out the Intel Code Coverage and Test Prioritization tools. These will be included in the Intel 8.0 compilers.
0 Kudos
wfroese
Beginner
677 Views

Steve,

Thanks for the reply. I read the page you linked to and I didn't really get what Iwas looking forso let me ask the question in a different way.

This is how I am approaching the issue: I've been using NUnit (http://nunit.org) and I am considering VBUnit (http://vbunit.org) and I would like to find a similar thing to use with Fortran. These are all based off the xUnit & JUnit testing frameworks.

What I would like to do is have a framework where I could make a routine that runs a function and then makes an assertion about the result. A console runner or a GUI would run through these tests sequentially in the compiled code and report upon which tests passed and which tests failed.

The tests that I want are fine-grained - I already have application functional tests that measure whole process results. The tools that you pointed to talk about issues like coverage and test quality and optomization. I am not ready for that. I just need *some* tests. Where are the tests that it refers to?

At one point there are the words

"An example of the usage model above is described in steps below using a hypothetical 32-bit Windows-based application called myApp.c:"

and thenone step is:

"Invocation of this command runs the instrumented application and generates one or more new dynamic profile information files that have an extension .dyn in the directory specified by PROF_DIR."

That looks like a test is applied to the whole application. I really have no clue what is supposed to be happening but I get the feeling that the tool then reports how much of the code is being run (and istherefore tested). I have no idea ofhow that test is constructed and maybe this is what I need to know. I want to test the smallest piece of functionality that I can manage to isolate into a routine. To me, that is the essence of Unit Testing and I want something to help me easily make the assertions in code and then run through them all and report.

0 Kudos
Steven_L_Intel1
Employee
677 Views
The tools I pointed you to do not create tests - they tell you the quality of the tests you have. The Test Prioritization tool is nice in that it lets you ask questions such as "I want to run tests for no more than 60 minutes - what is the best combination of my tests that will exercise the most code paths in my application?" It's often the case that you can have lots of tests which all test the same part of the application.
Both of these tools work off the instrumented profiling done by the Intel compilers.
0 Kudos
wfroese
Beginner
677 Views
OK - I can relate to that problem. I have some functional tests that when I run through all of my samples take 60 minutes and it would be nice to know if some are useless and could be eliminated. Imagine if I could get this down to 45 minutes - that would be very good.
But I want more.:smileysurprised:
This is how I want to work (with a nod to Emeril):
  • New task: Need new function
  • Write only the interface to a new function
  • Writeroutine(s) testing expected results from function
  • Run unit test(s) BAM and see fail as expected :smileyhappy:
  • Write code in new function
  • Run unit test(s) BAM see most pass but maybe some fail :smileymad:
  • Write better code in new function
  • Run unit testsBAM see all green lights for success :smileyhappy:
  • Move on to next task or refactor current work
What I could do is make a module that has routines thatperform the tests and make DLLEXPORT statements in them and then add the test functions names to a file that my VB or whatever interface will read and then call the new named (test) function and display the result of the test. I guess I could script much of the grunt workand build my owngeneric test runner but I thought I'd ask first.
0 Kudos
Reply