public final class AllureResultsUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
createDirectories(File dir)
Try to create the directory named by this abstract pathname, including any
necessary but nonexistent parent directories.
|
static Marshaller |
createMarshallerForClass(Class<?> clazz)
Creates a new
Marshaller for given class. |
static boolean |
deleteAttachment(ru.yandex.qatools.allure.model.Attachment attachment)
Remove attachment form
resultsDirectory |
static String |
generateAttachmentName()
Generate attachment name.
|
static String |
getExtensionByMimeType(String type)
Generate attachment extension from mime type
|
static File |
getResultsDirectory()
Returns results directory.
|
static Marshaller |
marshaller(Class<?> clazz)
Creates a new
Marshaller for given class. |
static void |
setPropertySafely(Marshaller marshaller,
String name,
Object value)
Try to set specified property to given marshaller
|
static void |
setResultsDirectory(File resultsDirectory)
Sets results directory.
|
static ru.yandex.qatools.allure.model.Attachment |
writeAttachment(byte[] attachment,
String title)
Write attachment without specified type.
|
static ru.yandex.qatools.allure.model.Attachment |
writeAttachment(byte[] attachment,
String title,
String type)
Write attachment with specified type.
|
static ru.yandex.qatools.allure.model.Attachment |
writeAttachmentSafely(byte[] attachment,
String title,
String type)
Write attachment uses
writeAttachment(byte[], String, String) (if
specified attachment type not empty) or writeAttachment(byte[], String)
otherwise. |
static ru.yandex.qatools.allure.model.Attachment |
writeAttachmentWithErrorMessage(Throwable throwable,
String title)
Write throwable as attachment.
|
static void |
writeTestSuiteResult(ru.yandex.qatools.allure.model.TestSuiteResult testSuite)
Marshal given testSuite to results folder.
|
static void |
writeTestSuiteResult(ru.yandex.qatools.allure.model.TestSuiteResult testSuite,
File testSuiteResultFile)
Marshal
TestSuiteResult to specified file
uses BadXmlCharacterFilterWriter. |
public static File getResultsDirectory()
resultsDirectory not set create new
directory uses createResultsDirectory() method.public static boolean createDirectories(File dir)
dir - to createpublic static void setResultsDirectory(File resultsDirectory)
resultsDirectory - results directory to setpublic static void writeTestSuiteResult(ru.yandex.qatools.allure.model.TestSuiteResult testSuite)
public static void writeTestSuiteResult(ru.yandex.qatools.allure.model.TestSuiteResult testSuite,
File testSuiteResultFile)
TestSuiteResult to specified file
uses BadXmlCharacterFilterWriter. Name of file generated uses
AllureNamingUtils.generateTestSuiteFileName()testSuite - to marshalpublic static Marshaller marshaller(Class<?> clazz)
Marshaller for given class.
If marshaller created successfully, try to set following properties:
Marshaller.JAXB_FORMATTED_OUTPUT and Marshaller.JAXB_ENCODING
using setPropertySafely(javax.xml.bind.Marshaller, String, Object)clazz - specified classAllureException - if can't create marshaller for given class.public static Marshaller createMarshallerForClass(Class<?> clazz)
Marshaller for given class.clazz - specified classAllureException - if can't create marshaller for given class.public static void setPropertySafely(Marshaller marshaller, String name, Object value)
marshaller - specified marshallername - name of property to setvalue - value of property to setpublic static boolean deleteAttachment(ru.yandex.qatools.allure.model.Attachment attachment)
resultsDirectoryattachment - to removepublic static ru.yandex.qatools.allure.model.Attachment writeAttachmentSafely(byte[] attachment,
String title,
String type)
writeAttachment(byte[], String, String) (if
specified attachment type not empty) or writeAttachment(byte[], String)
otherwise. If something went wrong uses
writeAttachmentWithErrorMessage(Throwable, String)attachment - which will writetitle - attachment titletype - attachment type (should be valid mime-type, empty string or null)Attachmentpublic static ru.yandex.qatools.allure.model.Attachment writeAttachmentWithErrorMessage(Throwable throwable, String title)
throwable - to writetitle - title of attachmentAttachmentpublic static ru.yandex.qatools.allure.model.Attachment writeAttachment(byte[] attachment,
String title,
String type)
throws IOException
generateAttachmentName(), attachment extension uses
getExtensionByMimeType(String)attachment - byte array with attachmenttitle - attachment titletype - valid mime-type of attachmentAttachmentIOException - if can't write attachmentpublic static ru.yandex.qatools.allure.model.Attachment writeAttachment(byte[] attachment,
String title)
throws IOException
MimeTypes.detect(java.io.InputStream, org.apache.tika.metadata.Metadata)
to autodetect attachment type from attachment content.attachment - to writetitle - attachment titleAttachmentIOException - if can't write attachmentpublic static String generateAttachmentName()
Copyright © 2017 Yandex. All rights reserved.