5
5
import java .net .URI ;
6
6
import java .util .Collection ;
7
7
8
- /**
9
- * Before or After Hooks that declare a parameter of this type will receive an instance of this class.
10
- * It allows writing text and embedding media into reports, as well as inspecting results (in an After block).
11
- * <p>
12
- * Note: This class is not intended to be used to create reports. To create custom reports use
13
- * the {@code io.cucumber.plugin.Plugin} class. The plugin system provides a much richer access to Cucumbers then
14
- * hooks after could provide. For an example see {@code io.cucumber.core.plugin.PrettyFormatter}.
15
- */
8
+
16
9
@ API (status = API .Status .STABLE )
17
10
public interface TestCaseState {
18
11
/**
@@ -31,32 +24,36 @@ public interface TestCaseState {
31
24
boolean isFailed ();
32
25
33
26
/**
34
- * Embeds data into the report(s). Some reporters (such as the progress one) don't embed data, but others do (html and json).
35
- * Example:
36
- *
27
+ * @param data what to embed, for example an image.
28
+ * @param mediaType what is the data? Using the
29
+ * @see #embed(byte[], String, String)
30
+ * @see #embed(byte[], String, String)
31
+ * @deprecated use {@link TestCaseState#embed(byte[], String, String)} instead.
32
+ */
33
+ @ Deprecated
34
+ void embed (byte [] data , String mediaType );
35
+
36
+ /**
37
+ * Embeds data into the report(s).
37
38
* <pre>
38
39
* {@code
39
40
* // Embed a screenshot. See your UI automation tool's docs for
40
41
* // details about how to take a screenshot.
41
- * scenario.embed(pngBytes, "image/png");
42
+ * scenario.embed(pngBytes, "image/png", "Bartholomew and the Bytes of the Oobleck" );
42
43
* }
43
44
* </pre>
45
+ * <p>
46
+ * To ensure reporting tools can understand what the data is a
47
+ * {@code mediaType} must be provided. For example: {@code text/plain},
48
+ * {@code image/png}, {@code text/html;charset=utf-8}.
49
+ * <p>
50
+ * Media types are defined in <a href= https://tools.ietf.org/html/rfc7231#section-3.1.1.1>RFC 7231 Section 3.1.1.1</a>.
44
51
*
45
- * @param data what to embed, for example an image.
46
- * @param mimeType what is the data?
47
- * @deprecated use {@link TestCaseState#embed(byte[], String, String)} instead.
48
- */
49
- @ Deprecated
50
- void embed (byte [] data , String mimeType );
51
-
52
- /**
53
- * Like {@link TestCaseState#embed(byte[], String)}, but with name for the embedding.
54
- *
55
- * @param data what to embed, for example an image.
56
- * @param mimeType what is the data?
57
- * @param name embedding name
52
+ * @param data what to embed, for example an image.
53
+ * @param mediaType what is the data?
54
+ * @param name embedding name
58
55
*/
59
- void embed (byte [] data , String mimeType , String name );
56
+ void embed (byte [] data , String mediaType , String name );
60
57
61
58
/**
62
59
* Outputs some text into the report.
0 commit comments