From 8ebff6b45378174bba5e0f554335f18a2231a9be Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 9 Mar 2016 16:03:16 +0100 Subject: Document the new HTML improvements --- lib/common_test/doc/src/ct.xml | 96 ++++++++++++++++---------- lib/common_test/doc/src/write_test_chapter.xml | 28 +++++--- 2 files changed, 81 insertions(+), 43 deletions(-) (limited to 'lib') diff --git a/lib/common_test/doc/src/ct.xml b/lib/common_test/doc/src/ct.xml index ed3d76061a..c96ae06c7d 100644 --- a/lib/common_test/doc/src/ct.xml +++ b/lib/common_test/doc/src/ct.xml @@ -661,52 +661,70 @@ log(Format) -> ok - Equivalent to log(default, 50, Format, []). + Equivalent to log(default, 50, Format, [], []).

Equivalent to - ct:log(default, 50, Format, []).

+ ct:log(default, 50, Format, [], []).

log(X1, X2) -> ok Equivalent to log(Category, Importance, Format, - Args). + FormatArgs, []). X1 = Category | Importance | Format - X2 = Format | Args + X2 = Format | FormatArgs -

Equivalent to ct:log(Category, - Importance, Format, Args).

+

Equivalent to ct:log(Category, + Importance, Format, FormatArgs, []).

log(X1, X2, X3) -> ok Equivalent to log(Category, Importance, Format, - Args). + FormatArgs, Opts). X1 = Category | Importance X2 = Importance | Format - X3 = Format | Args + X3 = Format | FormatArgs | Opts -

Equivalent to ct:log(Category, - Importance, Format, Args).

+

Equivalent to ct:log(Category, + Importance, Format, FormatArgs, Opts).

- log(Category, Importance, Format, Args) -> ok + log(X1, X2, X3, X4) -> ok + Equivalent to log(Category, Importance, Format, + FormatArgs, Opts). + + X1 = Category | Importance + X2 = Importance | Format + X3 = Format | FormatArgs + X4 = FormatArgs | Opts + + +

Equivalent to ct:log(Category, + Importance, Format, FormatArgs, Opts).

+
+
+ + + log(Category, Importance, Format, FormatArgs, Opts) -> ok Prints from a test case to the log file. Category = atom() Importance = integer() Format = string() - Args = list() + FormatArgs = list() + Opts = [Opt] + Opt = no_css | esc_chars - +

Prints from a test case to the log file.

This function is meant for printing a string directly from a @@ -714,11 +732,15 @@

Default Category is default, default Importance is ?STD_IMPORTANCE, - and default value for Args is [].

+ and default value for FormatArgs is [].

-

For details on Category and Importance, see section - Logging - Categories - and Verbosity Levels in the User's Guide.

+

For details on Category, Importance and the no_css + option, see section + Logging - Categories and Verbosity Levels in the User's Guide.

+ +

Common Test will not escape special HTML characters (<, > and &) + in the text printed with this function, unless the esc_chars + option is used.

@@ -769,40 +791,40 @@ pal(X1, X2) -> ok Equivalent to pal(Category, Importance, Format, - Args). + FormatArgs). X1 = Category | Importance | Format - X2 = Format | Args + X2 = Format | FormatArgs

Equivalent to ct:pal(Category, - Importance, Format, Args).

+ Importance, Format, FormatArgs).

pal(X1, X2, X3) -> ok Equivalent to pal(Category, Importance, Format, - Args). + FormatArgs). X1 = Category | Importance X2 = Importance | Format - X3 = Format | Args + X3 = Format | FormatArgs

Equivalent to ct:pal(Category, - Importance, Format, Args).

+ Importance, Format, FormatArgs).

- pal(Category, Importance, Format, Args) -> ok + pal(Category, Importance, Format, FormatArgs) -> ok Prints and logs from a test case. Category = atom() Importance = integer() Format = string() - Args = list() + FormatArgs = list()

Prints and logs from a test case.

@@ -812,11 +834,15 @@

Default Category is default, default Importance is ?STD_IMPORTANCE, - and default value for Args is [].

+ and default value for FormatArgs is [].

For details on Category and Importance, see section Logging - Categories and Verbosity Levels in the User's Guide.

+ +

Note that special characters in the text (<, > and &) will + be escaped by Common Test before the text is printed to the log + file.

@@ -854,40 +880,40 @@ print(X1, X2) -> ok Equivalent to print(Category, Importance, Format, - Args). + FormatArgs). X1 = Category | Importance | Format - X2 = Format | Args + X2 = Format | FormatArgs

Equivalent to ct:print(Category, - Importance, Format, Args).

+ Importance, Format, FormatArgs).

print(X1, X2, X3) -> ok Equivalent to print(Category, Importance, Format, - Args). + FormatArgs). X1 = Category | Importance X2 = Importance | Format - X3 = Format | Args + X3 = Format | FormatArgs

Equivalent to ct:print(Category, - Importance, Format, Args).

+ Importance, Format, FormatArgs).

- print(Category, Importance, Format, Args) -> ok + print(Category, Importance, Format, FormatArgs) -> ok Prints from a test case to the console. Category = atom() Importance = integer() Format = string() - Args = list() + FormatArgs = list()

Prints from a test case to the console.

@@ -897,7 +923,7 @@

Default Category is default, default Importance is ?STD_IMPORTANCE, - and default value for Args is [].

+ and default value for FormatArgs is [].

For details on Category and Importance, see section Logging - Categories diff --git a/lib/common_test/doc/src/write_test_chapter.xml b/lib/common_test/doc/src/write_test_chapter.xml index 3e30974c9f..96137a632d 100644 --- a/lib/common_test/doc/src/write_test_chapter.xml +++ b/lib/common_test/doc/src/write_test_chapter.xml @@ -953,11 +953,11 @@

Common Test provides the following three main functions for printing strings:

- ct:log(Category, Importance, Format, Args) - ct:print(Category, Importance, Format, Args) - ct:pal(Category, Importance, Format, Args) + ct:log(Category, Importance, Format, FormatArgs, Opts) + ct:print(Category, Importance, Format, FormatArgs) + ct:pal(Category, Importance, Format, FormatArgs) -

The log/1,2,3,4 function +

The log/1,2,3,4,5 function prints a string to the test case log file. The print/1,2,3,4 function prints the string to screen. @@ -1031,14 +1031,26 @@ 4. Categorized info, importance = 25 6. Categorized error, importance = 99 +

The arguments Format and FormatArgs in ct:log/print/pal are + always passed on to the stdlib function io:format/3 (For details, + see the stdlib:io manual page).

+ +

ct:pal/4 and ct:log/5 add headers to strings being printed to the + log file. The strings are also wrapped in div tags with a CSS class + attribute, so that stylesheet formatting can be applied. To disable this feature for + a printout (i.e. to get a result similar to using io:format/2), + call ct:log/5 with the no_css option.

+

How categories can be mapped to CSS tags is documented in section HTML Style Sheets in section Running Tests and Analyzing Results.

- -

The arguments Format and Args in ct:log/print/pal are - always passed on to function stdlib:io:format/3 (For details, see the - stdlib:io manual page).

+

Common Test will escape special HTML characters (<, > and &) in printouts + to the log file made with ct:pal/4 and io:format/2. In order to print + strings with HTML tags to the log, use the ct:log/5 function. The character escaping + feature is per default disabled for ct:log/5, but can be enabled with the + esc_chars option.

+

For more information about log files, see section Log Files in section Running Tests and Analyzing Results.

-- cgit v1.2.3