Skip to content

Testing

Matt Fryer edited this page Feb 18, 2015 · 3 revisions

Testing

In general, no subroutine or function should be created that cannot be tested with an automated test. This principle is critical to the quality and success of the project.

Test qvws must be created in the Tests directory. A test must be named as Test_membername.qvw. The membername does not include the “Qvc.” prefix.

  • Example:
    Test_GetFieldValues.qvw

The “Test_” prefix is required by TestDriver.qvw. Matching the member name ties the test qvw to the member name for organization and the test coverage report. The test qvw may use a non-matching name for the member name, but it must declare what the full name of the member it is testing via a call to Qvc.Test.RegisterTest.

Call Qvc.Test.RegisterTest(membername);

For example, Test_Calendar also tests 'Qvc.CalendarFromField' and so contains:

Call Qvc.Test.RegisterTest('Qvc.CalendarFromField');

New test QVWs should be created by copying $Test_Template.qvw. This QVW contains the sheet objects that report on the test results.

All tests should include both qvc.qvs and test runtime qvc_test.qvs. The template contains includes for both of these files.

At the end of the test script, all tests must call both:

CALL Qvc.Test.Cleanup;
CALL Qvc.Cleanup;

The following routines are available for asserting expected test results.

CALL Qvc.Test.AssertEqual('msg',expected, actual);
CALL Qvc.Test.AssertTrue('msg',expr);
CALL Qvc.Test.AssertFalse('msg',expr);