You will find a general example for the use of test here.

Functions to deal with CometTests

static String get_definition_file()

Get the path to the currently connected definition file.

Name Type Default Description
Return String   Path to the currently connected definition file.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o values.

Version 4.1 19161

priint:comet InDesign® Plug-Ins

get_default_definition_file
comet.test.getDefinitionFile

static String get_default_definition_file()

Get the default path to the definition file.

Name Type Default Description
Return String   Default path to the definition file.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o values.

Version 4.1 19161

priint:comet InDesign® Plug-Ins

disconnect
comet.test.getDefaultDefinitionFile

static int connect()

Connect to a definition file.

Name Type Default Description
Return int   0 or ErrorCode
path String oder char* - Path to definition file

Version 4.1 19161

priint:comet InDesign® Plug-Ins

disconnect
comet.test.connect

static int disconnect()

Disconnect from a definition file.

Name Type Default Description
Return int   0

Version 4.1 19161

priint:comet InDesign® Plug-Ins

connect
comet.test.disconnect

static int execute(char* path)

Execute comet tests. Proof data has to be created for the selected tests before using this function. The path parameter is the path inside the test hierarchy. If the path points to a test domain, all child tests will be executed. Creates test results which can be deleted with test::delete_test_results.

The function has no meaning in InDesign® CS5.5.

Name Type Default Description
Return int   Errorcode or 0
path String or char* - Path to test/test domain in the test hierarchy

v4.1 R10556, 9. Apr 2016

priint:comet InDesign® Plug-Ins

test::create_proofs
test::delete_test_results
comet.test.execute

static int create_proofs(char* path)

Proof creation for comet tests. Any existing proof data will be overwritten. The path parameter is the path inside the test hierarchy. If the path points to a test domain, proof data for all child tests will be created.

The function has no meaning in InDesign® CS5.5.

Name Type Default Description
Return int   Errorcode or 0
path String or char* - Path to test/test domain in the test hierarchy

v4.1 R10556, 9. Apr 2016

priint:comet InDesign® Plug-Ins

test::execute
test::delete_proofs
comet.test.createProofs

static int delete_proofs(char* path)

Proof deletion for comet tests. The path parameter is the path inside the test hierarchy. If the path points to a test domain, proof data for all child tests will be deleted.

The function has no meaning in InDesign® CS5.5.

Name Type Default Description
Return int   Errorcode or 0
path String or char* - Path to test/test domain in the test hierarchy

Version 4.1 R10563

priint:comet InDesign® Plug-Ins

test::create_proofs
comet.test.deleteProofs

static int delete_test_results(char* path)

Deletion of test results for comet tests. The path parameter is the path inside the test hierarchy. If the path points to a test domain, test results for all child tests will be deleted.

The function has no meaning in InDesign® CS5.5.

Name Type Default Description
Return int   Errorcode or 0
path String or char* - Path to test/test domain in the test hierarchy

Version 4.1 R10563

priint:comet InDesign® Plug-Ins

test::execute
comet.test.deleteResults

static int count()

Count all defined CometTests. Also doamins are counted here.

Name Type Default Description
Return int   Number of all defined CometTest and CometTest domains

0 : No tests defined or error

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

static int count_runnings(
  int* current = 0,
  int* count = 0,
  int* ok = 0,
  int* failed = 0)

Count all currently executing CometTests

Name Type Default Description
Return int   0 or ErrorCode
current int* 0 Index of currently running test in current test queue
count int* 0 Number of tests in queue
ok int* 0 Number of tests succeeded
failed int* 0 Number of tests failed

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

static int get_nth_ID(int nth)

ID of nth CometTest.

Name Type Default Description
Return int   ID of nth CometTest

0 : Error
nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static int get_nth_depth(int nth)

Depth in hierarchy of nth test.

Name Type Default Description
Return int   Depth in hierarchy of nth test
nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_name(int nth)

Name of nth test.

Name Type Default Description
Return char*   Name of nth test.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static int get_nth_type(int nth)

Type of nth CometTest.

Name Type Default Description
Return int   Type of nth CometTest

0 : Domain
1 : Test
nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_connectionInfo(int nth)

Error description of nth CometTest.

Name Type Default Description
Return char*   Error description of nth CometTest.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_file(int nth)

Test document (INDD) of nth CometTest.

Name Type Default Description
Return char*   Test document (INDD) of nth CometTest.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_preScriptPath(int nth)

Prescript of nth CometTest.

Name Type Default Description
Return char*   Prescript of nth CometTest.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_actionPath(int nth)

Script of nth CometTest.

Name Type Default Description
Return char*   Script of nth CometTest.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_postScriptPath(int nth)

Post-Script of nth CometTest.

Name Type Default Description
Return char*   Post-Script of nth CometTest.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static int get_nth_simulateOverprint(int nth)

Overprint property of nth CometTest.

Name Type Default Description
Return int   Overprint property of nth CometTest
nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_errorDescription(int nth)

Error description of nth CometTest.

Name Type Default Description
Return char*   Error description of nth CometTest.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_numberInQueue(int nth)

Index in queue as char*-string in the format "a/ALL", for instance "3/10".

Name Type Default Description
Return char*   Name of nth test

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static char* get_nth_wasInQueue(int nth)

Is a CometTest currently in the queue?

Name Type Default Description
Return int   Is the CometTest currently in the queue?

0 : No or error
1 : Yes
nth int - 0-based index of text

Version 4.1 R15678, 9. Feb 2017

priint:comet InDesign® Plug-Ins

count

static int assert(int successful, char* message)

Set the assertion error state of the currently running assert test.

Name Type Default Description
Return int   ErrorCode or 0
successful int 1 Was the test successful?

0: 0
1: Yes
message String or char* "" When successful is 0, this message is displayed as the error message.

Version 4.1 R20655, 10. Nov 2017

priint:comet InDesign® Plug-Ins

comet.test.assertion

Preconditions
#include "internal/types.h"

Send an email report of all tests currently in use.

#include string'>"internal/types.h"
int main () { int err; char subject [8192]; char * body = alloc (1000000); char * tmp = alloc (1000000); char id [1000]; char errdescr [10000]; int current, count, ok, failed; int c = test::count (); int i, j, idv;
test::count_runnings (&current, &count, &ok, &failed); if (count == 0) return; if (failed == 0) sprintf.html>sprintf (subject, string'>"CometTests Report : %d tests successfully done", count); else sprintf.html>sprintf (subject, string'>"CometTests Report : %d of %d tests FAILED", failed, count);
// InDesign® version strcpy (id, string'>"InDesign "); if (system.html#is_server>system::is_server ()) strcat.html>strcat (id, string'>"Server "); idv = system.html#is_version>system::version (); if (idv <= 8) sprintf.html>sprintf (tmp, string'>"CS %d", idv-2); else if (idv <= 11) sprintf.html>sprintf (tmp, string'>"CC %d", idv+2004); else sprintf.html>sprintf (tmp, string'>"CC %d", idv+2005); strcat.html>strcat (id, tmp);
// Init body text strcpy (body, string'>"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" /><meta name=\"generator\" content=\"Adobe GoLive\" /><title>index</title><link href=\"css/basic.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" /></head><body style=\"font-size: 120%;\"><h2><font face=\"Arial\">COMETTEST REPORT</font></h2><table width=\"435\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">User</font></td><td style=\"font-size: 120%;\"><em><font face=\"Arial\">$USER</font></em></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">Date</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\">$DATE</font></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">InDesign</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\">$INDESIGN</font></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">Comet</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\"><strong>v$COMET R$REVISION</strong></font></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">No. of Tests</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\">$COUNT</font></td></tr></table><p style=\"font-size: 120%;\"><font color=\"#0077bb\" face=\"Arial\">$OKAY</font><font color=\"#ff4488\" face=\"Arial\"><b>$FAILED</b></font></p><p><font face=\"Arial\">$DESCR</font></p><p style=\"font-size: 80%;\">This mail was automatically created by the priint:comet test suite using system::send_mail.</p></body></html>");
// Finish header table strreplace.html>strreplace (body, string'>"$USER", system.html#login>system::login (tmp)); strreplace.html>strreplace (body, string'>"$DATE", system.html#now>system::now (tmp)); strreplace.html>strreplace (body, string'>"$INDESIGN",id); strreplace.html>strreplace (body, string'>"$COMET", system.html#comet_version>system::comet_version (tmp)); strreplace.html>strreplace (body, string'>"$REVISION",system.html#revision>system::revision ()); strreplace.html>strreplace (body, string'>"$COUNT", itoa.html>itoa (count));
strcpy (tmp, string'>""); for (i = 0; i < c-1; i++) { if (test::get_nth_wasInQueue (i)) { if (strlen (test::get_nth_errorDescription (i)) == 0) strcat.html>strcat (tmp, string'>"<font color=\"#0077bb\" face=\"Arial\">&nbsp;&nbsp;&nbsp;&nbsp;"); else strcat.html>strcat (tmp, string'>"<font color=\"#ff4488\" face=\"Arial\">&nbsp;&nbsp;&nbsp;&nbsp;"); strcat.html>strcat (tmp, test::get_nth_name (i)); strcat.html>strcat (tmp, string'>"</font><br/>"); } } strcat.html>strcat (tmp, string'>"<br/></p><p>");
// Write result if (failed == 0) { strreplace.html>strreplace (body, string'>"$OKAY", "EVERYTHING IS OKAY!"); strreplace.html>strreplace (body, string'>"$DESCR", tmp); } else { if (failed == 1) sprintf.html>sprintf (id, string'>"\n%d TEST FAILED!<br/>", failed); else sprintf.html>sprintf (id, string'>"\n%d TESTS FAILED!<br/>", failed); strreplace.html>strreplace (body,string'>"$FAILED", id); for (i = 0; i < c; i++) { strcpy (errdescr, test::get_nth_errorDescription (i)); if (strlen (errdescr)) { strreplace.html>strreplace (errdescr, string'>"ERRORS\n", string'>"", 0); strreplace.html>strreplace (errdescr, string'>"- ", string'>"<li/>", 1); strcat.html>strcat (tmp, string'>"<b>"); strcat.html>strcat (tmp, test::get_nth_name (i)); strcat.html>strcat (tmp, string'>"</b> : <i><ul>"); strcat.html>strcat (tmp, errdescr); strcat.html>strcat (tmp, string'>"</ul></i><br/><br/>"); } } strreplace.html>strreplace (body, string'>"$DESCR", tmp); }
system.html#send_mail>system::send_mail (   string'>"you@your.email.com",   subject,   kMailAccount, string'>"your name" // applied on Windows only   kBody, body);
return 0; }

Since
Version 4.1, R10556

Available:
priint:comet InDesign® Plug-Ins

Alphabetic index HTML hierarchy of classes or Java