Code example for XmlSerializer

Methods: attributeendTagsetOutputstartDocumentstartTag

     * @param context context of the test application 
     * @param targetContext context of the application under test 
     * @param reportFile name of the report file(s) to create 
     * @param reportDir  path of the directory under which to write files 
     *                  (may be null in which case files are written under 
     *                  the context using {@link Context#openFileOutput(String, int)}). 
     * @param filterTraces if true, stack traces will have common noise (e.g. 
     *            framework methods) omitted for clarity 
     * @param multiFile if true, use a separate file for each test suite 
    public JUnitReportListener(Context context, Context targetContext, String reportFile, String reportDir, boolean filterTraces, boolean multiFile) {
        this.mContext = context;
        this.mTargetContext = targetContext;
        this.mReportFile = reportFile;
        this.mReportDir = reportDir;
        this.mFilterTraces = filterTraces;
        this.mMultiFile = multiFile;
    public void startTest(Test test) {
        try { 
            if (test instanceof TestCase) {
                TestCase testCase = (TestCase) test;
                mSerializer.startTag("", TAG_CASE);
                mSerializer.attribute("", ATTRIBUTE_CLASS, mCurrentSuite);
                mSerializer.attribute("", ATTRIBUTE_NAME, testCase.getName());
                mTimeAlreadyWritten = false;
                mTestStartTime = System.currentTimeMillis();
        } catch (IOException e) {
            Log.e(LOG_TAG, safeMessage(e));
    private void checkForNewSuite(TestCase testCase) throws IOException {
        String suiteName = testCase.getClass().getName();
Contextual code suggestions in your IDE  Get Codota for Java