Friday, March 27, 2009

Domino Unit Framework Q&A - Part 1

Here are some questions about using 'Domino Unit Framework' that have ended up in my inbox recently. So that everyone who uses it (all two of you) get the benefit I've posted them here and cross linked to the OpenNTF project. Excuse the poor English in the questions, they are coming from Karnataka in Banglore and English isn't the first language.

Question 1.

"So now my query is i need to get the document context of this..then only i
can test or compare or what ever it is..Can i run the tests of domino unit
frame work independently with out tieing to the Application data base."

Answer 1.

Yes, you can run the unit tests independent of the Domino Unit Framework database.

You will need to copy the Domino Unit Framework Script libraries into your application and build a place where you want to execute the tests (Agents, Action Buttons - Your choice). The results of the tests (pass/failures) are then sent to the domino unit framework database that you specify. You can send the documents to any database but you'll need to see the results.

Set OutputStream = New NotesDatabaseOutputStream(session, "", "DUFResults.nsf")

When you are migrating to production/uat, remove the script libraries and agents.

Question 2.

"Is there a way to test them independently with out tieing to application database is my Question or As per ur inputs is this only the best way to test.(copying)"

Answer 2.


It's a bit like trying to compile a java program and not having the jar file on the path....the database is the project, therefore - like jUnit you need to allow the objects that you are testing to be in scope.

Question 3.

"I don't find any assertion for comparing two arrays of type Variant..that is Variant array or list in Domino Unit Framework.Is there any solution for that or do we need to manually write some class for that in the script library."
I was trying to test two variant arrays,its saying failed(As no case is available as such) even though both the variant arrays contains same values"

Answer 3.

Equality of Arrays, especially arrays of variants is particularly tricky - mostly because the rules of equality can vary, and there is a large combination of possible rules that may or may not be relevant in your particular instance. Is order important for equality ? or perhaps number of elements ?

Therefore, asserting equality between arrays (and arrays of variants) is not (and perhaps never will be) included in Domino Unit Framework.

My suggestions is to either write your own custom assertions as you have access to the source code, or unit test at the array element like so;

Call Test101.AssertEqual(array_a(0),array)b(0))

No comments:

Post a Comment