Package jscover.report

Examples of jscover.report.FileData


            classElement.setAttribute("complexity", "0");

            classElement.appendChild(doc.createElement("methods"));
            Element linesElement = doc.createElement("lines");
            classElement.appendChild(linesElement);
            FileData fileData = (FileData) file;
            addLines(doc, linesElement, fileData);
        }
    }
View Full Code Here


        functions.add(7);
        functions.add(2);
        functions.add(0);
        functions.add(5);

        FileData coverageData = new FileData("/test.js", lines, functions, branches);

        String result = lCovGenerator.generateRecord(coverageData, "dest");
        String expected = "SF:dest/test.js\n" +
                "FNDA:7,0\n" +
                "FNDA:2,1\n" +
View Full Code Here

        assertThat(getXPath(xpath, document, "/coverage/sources/source"), equalTo("c:/sourceDir"));
    }

    @Test
    public void shouldGenerateXmlForOneFile() throws Exception {
        FileData coverable = mock(FileData.class);
        files.add(coverable);

        given(coverable.getUri()).willReturn("/dir/file.js");
        given(coverable.getCodeLineCount()).willReturn(10);
        given(coverable.getCodeLinesCoveredCount()).willReturn(5);
        given(coverable.getLineCoverRate()).willReturn(.5d);
        given(coverable.getBranchCount()).willReturn(5);
        given(coverable.getBranchesCoveredCount()).willReturn(2);
        given(coverable.getBranchRate()).willReturn(.4d);

        data = new CoberturaData(files);
        String xml = generator.generateXml(data, "srcDir", "version");
        //System.out.println("xml = " + xml);
View Full Code Here

        assertThat(getXPath(xpath, document, classXPath + "/@filename"), equalTo("dir/file.js"));
    }

    @Test
    public void shouldGenerateXmlForTwoFiles() throws Exception {
        FileData coverable1 = mock(FileData.class);
        files.add(coverable1);
        FileData coverable2 = mock(FileData.class);
        files.add(coverable2);

        given(coverable1.getUri()).willReturn("/dir/file1.js");
        given(coverable1.getCodeLineCount()).willReturn(8);
        given(coverable1.getCodeLinesCoveredCount()).willReturn(4);
        given(coverable1.getLineCoverRate()).willReturn(.5d);
        given(coverable1.getBranchCount()).willReturn(5);
        given(coverable1.getBranchesCoveredCount()).willReturn(2);
        given(coverable1.getBranchRate()).willReturn(.4d);

        given(coverable2.getUri()).willReturn("/dir/file2.js");
        given(coverable2.getCodeLineCount()).willReturn(2);
        given(coverable2.getCodeLinesCoveredCount()).willReturn(2);
        given(coverable2.getLineCoverRate()).willReturn(1d);
        given(coverable2.getBranchCount()).willReturn(5);
        given(coverable2.getBranchesCoveredCount()).willReturn(5);
        given(coverable2.getBranchRate()).willReturn(1d);

        data = new CoberturaData(files);
        String xml = generator.generateXml(data, "srcDir", "version");
        //System.out.println("xml = " + xml);
View Full Code Here

    @Test
    public void shouldGenerateXmlLineNoBranch() throws Exception {
        List<Integer> lines = new ArrayList<Integer>(){{add(null);}{add(10);}};
        SortedMap<Integer, List<BranchData>> branchData = new TreeMap<Integer, List<BranchData>>();
        files.add(new FileData("/dir/file.js", lines, null, branchData));

        data = new CoberturaData(files);
        String xml = generator.generateXml(data, "srcDir", "version");
        //System.out.println("xml = " + xml);
View Full Code Here

        SortedMap<Integer, List<BranchData>> branchDataMap = new TreeMap<Integer, List<BranchData>>();
        List<BranchData> conditionsList = new ArrayList<BranchData>();
        conditionsList.add(null);
        conditionsList.add(new BranchData(0, 0, null, 1, 0));
        branchDataMap.put(1, conditionsList);
        files.add(new FileData("/dir/file.js", lines, null, branchDataMap));

        data = new CoberturaData(files);
        String xml = generator.generateXml(data, "srcDir", "version");
        //System.out.println("xml = " + xml);
View Full Code Here

        SortedMap<Integer, List<BranchData>> branchDataMap = new TreeMap<Integer, List<BranchData>>();
        List<BranchData> conditionsList = new ArrayList<BranchData>();
        conditionsList.add(null);
        conditionsList.add(new BranchData(0, 0, null, 0, 1));
        branchDataMap.put(1, conditionsList);
        files.add(new FileData("/dir/file.js", lines, null, branchDataMap));

        data = new CoberturaData(files);
        String xml = generator.generateXml(data, "srcDir", "version");
        //System.out.println("xml = " + xml);
View Full Code Here

        SortedMap<Integer, List<BranchData>> branchDataMap = new TreeMap<Integer, List<BranchData>>();
        List<BranchData> conditionsList = new ArrayList<BranchData>();
        conditionsList.add(null);
        conditionsList.add(new BranchData(0, 0, null, 0, 0));
        branchDataMap.put(1, conditionsList);
        files.add(new FileData("/dir/file.js", lines, null, branchDataMap));

        data = new CoberturaData(files);
        String xml = generator.generateXml(data, "srcDir", "version");
        //System.out.println("xml = " + xml);
View Full Code Here

TOP

Related Classes of jscover.report.FileData

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.