@Test
    void testXmlRenderingWithTimeTracking() throws Exception {
        Query q = new Query("/?query=a&tracelevel=5");
        q.getPresentation().setTiming(true);

        Result result = new Result(q);
        result.setCoverage(new Coverage(500, 1, 1));

        TimeTracker t = new TimeTracker(new Chain<Searcher>(new NoopSearcher("first"),
                new NoopSearcher("second"),
                new NoopSearcher("third")));
        ElapsedTimeTestCase.doInjectTimeSource(t, new CreativeTimeSource(new long[]{1L, 2L, 3L, 4L, 5L, 6L, 7L}));
        t.sampleSearch(0, true);
        t.sampleSearch(1, true);
        t.sampleSearch(2, true);
        t.sampleSearch(3, true);
        t.sampleSearchReturn(2, true, null);
        t.sampleSearchReturn(1, true, null);
        t.sampleSearchReturn(0, true, null);
        result.getElapsedTime().add(t);

        String summary = render(result);

        assertEquals("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<result total-hit-count=\"0\"",
                summary.substring(0, 67));
        assertTrue(summary.contains("querytime="));
        assertTrue(summary.contains("summaryfetchtime="));
        assertTrue(summary.contains("searchtime="));
        assertTrue(summary.contains("<meta type=\"context\">"));
    }
Test the XML renderer

@author Steinar Knutsen
@author bratseth
container-search/src/test/java/com/yahoo/search/rendering/XMLRendererTestCase.java