Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
19<br />
The <strong>Caché</strong> Data Population Utility<br />
<strong>Caché</strong> includes a utility for creating random test data for persistent classes. The creation of<br />
such data is known as data population; the utility for doing this, known as the <strong>Caché</strong> populate<br />
utility, is useful for testing persistent classes before deploying them within a real application.<br />
It is especially helpful when testing how various parts of an application will function when<br />
they are working against a large set of data.<br />
The populate utility takes its name from its principal element — the %Populate class, which<br />
is part of the <strong>Caché</strong> class library. Classes that inherit from %Populate contain a method called<br />
Populate, which allows you to generate and save class instances containing random data<br />
values. You can also customize the behavior of the %Populate class to provide data for your<br />
application's needs.<br />
Along with the %Populate class, the populate utility uses %PopulateUtils. %Populate provides<br />
the interface to the utility, while %PopulateUtils is a helper class.<br />
19.1 Data Population Basics<br />
It is quite simple to populate a class with test data:<br />
1. Include the populate utility functionality as part of the class definition by making<br />
%Populate one of its superclasses.<br />
2. Compile the class.<br />
3. Invoke the populate utility, which creates test data.<br />
<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 161