Package net.mindengine.galen.reports

Examples of net.mindengine.galen.reports.GalenTestInfo


            if (matchesPattern(test.getName(), filterPattern)) {
                Runnable thread = new Runnable() {
                    @Override
                    public void run() {
                       
                        GalenTestInfo info = new GalenTestInfo(test.getName(), test);
                        TestReport report = new TestReport();

                        info.setStartedAt(new Date());
                        info.setReport(report);
                       
                       
                        testInfoLock.lock();
                        try {
                            testInfos.add(info);
                            TestSession session = TestSession.register(info);
                            session.setReport(report);
                            session.setListener(listener);
                        }
                        catch (Exception ex) {
                            ex.printStackTrace();
                        }
                        finally {
                            testInfoLock.unlock();
                        }
                       
                        eventHandler.invokeBeforeTestEvents(info);
                       
                        tellTestStarted(listener, test);
                        try {
                            test.execute(report, listener);
                        }
                        catch(Throwable ex) {
                            info.setException(ex);
                            report.error(ex);
                            ex.printStackTrace();
                        }
                        info.setEndedAt(new Date());
                       
                        eventHandler.invokeAfterTestEvents(info);
                        tellTestFinished(listener, test);
                       
                        TestSession.clear();
View Full Code Here


    @Test public void shouldReport_inTestNgFormat_successfully() throws IOException, TemplateException {
        String reportPath = Files.createTempDir().getAbsolutePath() + "/testng-report/report.xml";
       
        List<GalenTestInfo> testInfos = new LinkedList<GalenTestInfo>();
       
        GalenTestInfo testInfo = new GalenTestInfo("Home page test", null);

        testInfo.setReport(new TestReport());
        testInfo.setStartedAt(new Date(1399741000000L));
        testInfo.setEndedAt(new Date(1399746930000L));
        testInfo.setException(new FakeException("Some exception here"));
        testInfos.add(testInfo);
       
        testInfo = new GalenTestInfo("Login page test", null);
        testInfo.setReport(new TestReport());
        testInfo.setStartedAt(new Date(1399741000000L));
        testInfo.setEndedAt(new Date(1399746930000L));
        testInfos.add(testInfo);
       
       
        new TestNgReportBuilder().build(testInfos, reportPath);
       
View Full Code Here

    @Test public void shouldReport_inHtmlFormat_withException_andAttachments() throws IOException, TemplateException {
        String reportDirPath = Files.createTempDir().getAbsolutePath() + "/reports";
       
        List<GalenTestInfo> testInfos = new LinkedList<GalenTestInfo>();
       
        GalenTestInfo testInfo = new GalenTestInfo("Home page test", null);
        testInfo.setStartedAt(new Date(1399741000000L));
        testInfo.setEndedAt(new Date(1399746930000L));

        File attachmentFile = new File(Files.createTempDir().getAbsolutePath() + File.separator + "custom.txt");
        attachmentFile.createNewFile();
       
        testInfo.getReport().error(new FakeException("Some exception here")).withAttachment("custom.txt", attachmentFile);
        testInfo.getReport().info("Some detailed report").withDetails("Some details");
        testInfo.getReport().getNodes().get(0).setTime(new Date(1399741000000L));
        testInfo.getReport().getNodes().get(1).setTime(new Date(1399741000000L));
        testInfos.add(testInfo);
        new HtmlReportBuilder().build(testInfos, reportDirPath);
       
        String expectedSuite1Html = trimEveryLine(IOUtils.toString(getClass().getResourceAsStream("/expected-reports/test-with-attachment.html")));
        String realSuite1Html = trimEveryLine(FileUtils.readFileToString(new File(reportDirPath + "/report-1-home-page-test.html")));
View Full Code Here

    @Test public void shouldReport_inHtmlFormat_successfully_andSplitFiles_perTest() throws IOException, TemplateException {
        String reportDirPath = Files.createTempDir().getAbsolutePath() + "/reports";
       
        List<GalenTestInfo> testInfos = new LinkedList<GalenTestInfo>();
       
        GalenTestInfo testInfo = new GalenTestInfo("Home page test", null);

        TestReport report = new TestReport();
        LayoutReport layoutReport = new LayoutReport();
        layoutReport.setScreenshotFullPath(File.createTempFile("screenshot", ".png").getAbsolutePath());
        ReportingListenerTestUtils.performSampleReporting("Home page test", null, new LayoutReportListener(layoutReport), null);



        report.addNode(new LayoutReportNode(layoutReport, "check layout"));
        report.getNodes().get(0).setTime(new Date(1404681346000L));


        testInfo.setReport(report);
        testInfos.add(testInfo);
        testInfo.setStartedAt(new Date(1404681346000L));
        testInfo.setEndedAt(new Date(1404681416000L));

        new HtmlReportBuilder().build(testInfos, reportDirPath);
       
       
        String expectedGeneralHtml = trimEveryLine(IOUtils.toString(getClass().getResourceAsStream("/expected-reports/report.html")));
View Full Code Here

        }
       
    }

    private static void tellAfterSuite(SuiteListener suiteListener) {
        GalenTestInfo test = new GalenTestInfo("page1.test", null);
        TestReport report = new TestReport();
        for (int i=0; i< 6; i++) {
            report.info("info" + i);
        }
        for (int i=0; i< 5; i++) {
            report.error("error" + i);
        }
        test.setReport(report);
        suiteListener.afterTestSuite(asList(test));
    }
View Full Code Here

        startDate = new Date().getTime() - 10;
    }

    @Test
    public void shouldCreate_testInfo_fromString() {
        GalenTestInfo testInfo = GalenTestInfo.fromString("Test 1");
        verifyTestInfo(testInfo, "Test 1");
    }
View Full Code Here

    }

    @Test
    public void shouldCreate_testInfo_fromMethod() throws NoSuchMethodException {
        Method method = getClass().getMethod("shouldCreate_testInfo_fromMethod");
        GalenTestInfo testInfo = GalenTestInfo.fromMethod(method);
        verifyTestInfo(testInfo, GalenTestInfoTest.class.getName() + "#" + "shouldCreate_testInfo_fromMethod");
    }
View Full Code Here

TOP

Related Classes of net.mindengine.galen.reports.GalenTestInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.