-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* used "@7sean68/jacoco-parse" instead of "jacoco-parse" to support jacoco aggregate * added multimodule test * fix version Co-authored-by: Ryan Luker <ryanluker@outlook.com> * added multimodule java to example * added notice blocks to copied files --------- Co-authored-by: Ryan Luker <ryanluker@outlook.com>
- Loading branch information
Showing
15 changed files
with
409 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.1//EN" "report.dtd"><report name="module3"><sessioninfo id="admin-ac7aa039" start="1682364826758" dump="1682364827009"/><sessioninfo id="admin-d1fdb3fa" start="1682364827853" dump="1682364828128"/><sessioninfo id="admin-f4fe0db" start="1682364829397" dump="1682364830516"/><group name="module1"><package name="com/praveen/samples/jacoco/multimodule"><class name="com/praveen/samples/jacoco/multimodule/Module1Class" sourcefilename="Module1Class.java"><method name="<init>" desc="()V" line="3"><counter type="INSTRUCTION" missed="0" covered="3"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="convertToString" desc="(I)Ljava/lang/String;" line="9"><counter type="INSTRUCTION" missed="0" covered="3"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="convertToLong" desc="(I)J" line="13"><counter type="INSTRUCTION" missed="0" covered="5"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="concatenate" desc="(I)Ljava/lang/String;" line="26"><counter type="INSTRUCTION" missed="0" covered="18"/><counter type="LINE" missed="0" covered="3"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="getNumber" desc="()I" line="32"><counter type="INSTRUCTION" missed="0" covered="3"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="setNumber" desc="(I)V" line="36"><counter type="INSTRUCTION" missed="0" covered="4"/><counter type="LINE" missed="0" covered="2"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="getResult" desc="()Ljava/lang/String;" line="40"><counter type="INSTRUCTION" missed="0" covered="3"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="setResult" desc="(Ljava/lang/String;)V" line="44"><counter type="INSTRUCTION" missed="0" covered="4"/><counter type="LINE" missed="0" covered="2"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><counter type="INSTRUCTION" missed="0" covered="43"/><counter type="LINE" missed="0" covered="12"/><counter type="COMPLEXITY" missed="0" covered="8"/><counter type="METHOD" missed="0" covered="8"/><counter type="CLASS" missed="0" covered="1"/></class><sourcefile name="Module1Class.java"><line nr="3" mi="0" ci="3" mb="0" cb="0"/><line nr="9" mi="0" ci="3" mb="0" cb="0"/><line nr="13" mi="0" ci="5" mb="0" cb="0"/><line nr="26" mi="0" ci="13" mb="0" cb="0"/><line nr="27" mi="0" ci="3" mb="0" cb="0"/><line nr="28" mi="0" ci="2" mb="0" cb="0"/><line nr="32" mi="0" ci="3" mb="0" cb="0"/><line nr="36" mi="0" ci="3" mb="0" cb="0"/><line nr="37" mi="0" ci="1" mb="0" cb="0"/><line nr="40" mi="0" ci="3" mb="0" cb="0"/><line nr="44" mi="0" ci="3" mb="0" cb="0"/><line nr="45" mi="0" ci="1" mb="0" cb="0"/><counter type="INSTRUCTION" missed="0" covered="43"/><counter type="LINE" missed="0" covered="12"/><counter type="COMPLEXITY" missed="0" covered="8"/><counter type="METHOD" missed="0" covered="8"/><counter type="CLASS" missed="0" covered="1"/></sourcefile><counter type="INSTRUCTION" missed="0" covered="43"/><counter type="LINE" missed="0" covered="12"/><counter type="COMPLEXITY" missed="0" covered="8"/><counter type="METHOD" missed="0" covered="8"/><counter type="CLASS" missed="0" covered="1"/></package><counter type="INSTRUCTION" missed="0" covered="43"/><counter type="LINE" missed="0" covered="12"/><counter type="COMPLEXITY" missed="0" covered="8"/><counter type="METHOD" missed="0" covered="8"/><counter type="CLASS" missed="0" covered="1"/></group><group name="module2"><package name="com/praveen/samples/jacoco/multimodule"><class name="com/praveen/samples/jacoco/multimodule/Module2Class" sourcefilename="Module2Class.java"><method name="<init>" desc="()V" line="3"><counter type="INSTRUCTION" missed="0" covered="3"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="convertToDouble" desc="(I)D" line="6"><counter type="INSTRUCTION" missed="0" covered="5"/><counter type="LINE" missed="0" covered="1"/><counter type="COMPLEXITY" missed="0" covered="1"/><counter type="METHOD" missed="0" covered="1"/></method><method name="convertToFloat" desc="(I)F" line="10"><counter type="INSTRUCTION" missed="5" covered="0"/><counter type="LINE" missed="1" covered="0"/><counter type="COMPLEXITY" missed="1" covered="0"/><counter type="METHOD" missed="1" covered="0"/></method><counter type="INSTRUCTION" missed="5" covered="8"/><counter type="LINE" missed="1" covered="2"/><counter type="COMPLEXITY" missed="1" covered="2"/><counter type="METHOD" missed="1" covered="2"/><counter type="CLASS" missed="0" covered="1"/></class><sourcefile name="Module2Class.java"><line nr="3" mi="0" ci="3" mb="0" cb="0"/><line nr="6" mi="0" ci="5" mb="0" cb="0"/><line nr="10" mi="5" ci="0" mb="0" cb="0"/><counter type="INSTRUCTION" missed="5" covered="8"/><counter type="LINE" missed="1" covered="2"/><counter type="COMPLEXITY" missed="1" covered="2"/><counter type="METHOD" missed="1" covered="2"/><counter type="CLASS" missed="0" covered="1"/></sourcefile><counter type="INSTRUCTION" missed="5" covered="8"/><counter type="LINE" missed="1" covered="2"/><counter type="COMPLEXITY" missed="1" covered="2"/><counter type="METHOD" missed="1" covered="2"/><counter type="CLASS" missed="0" covered="1"/></package><counter type="INSTRUCTION" missed="5" covered="8"/><counter type="LINE" missed="1" covered="2"/><counter type="COMPLEXITY" missed="1" covered="2"/><counter type="METHOD" missed="1" covered="2"/><counter type="CLASS" missed="0" covered="1"/></group><counter type="INSTRUCTION" missed="5" covered="51"/><counter type="LINE" missed="1" covered="14"/><counter type="COMPLEXITY" missed="1" covered="10"/><counter type="METHOD" missed="1" covered="10"/><counter type="CLASS" missed="0" covered="2"/></report> |
64 changes: 64 additions & 0 deletions
64
...odule-java/module1/src/main/java/com/praveen/samples/jacoco/multimodule/Module1Class.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package com.praveen.samples.jacoco.multimodule; | ||
|
||
public class Module1Class { | ||
|
||
private int number; | ||
private String result; | ||
|
||
public String convertToString(int inputNumber) { | ||
return String.valueOf(inputNumber); | ||
} | ||
|
||
public long convertToLong(int inputNumber) { | ||
return Long.valueOf(inputNumber); | ||
} | ||
|
||
/** | ||
* A concatenation function. We will not write unit/integration test for this function. Rather we | ||
* would invoke this method from module3 i.e functional tests using cucumber, To see if we are | ||
* getting overall test coverage. | ||
* | ||
* @param inputNumber any number. | ||
* @return self conatenated number in string. | ||
*/ | ||
public String concatenate(int inputNumber) { | ||
// Just some random operation | ||
String result = convertToString(inputNumber) + convertToLong(inputNumber); | ||
this.setResult(result); | ||
return result; | ||
} | ||
|
||
public int getNumber() { | ||
return number; | ||
} | ||
|
||
public void setNumber(int number) { | ||
this.number = number; | ||
} | ||
|
||
public String getResult() { | ||
return result; | ||
} | ||
|
||
public void setResult(String result) { | ||
this.result = result; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...le1/src/test/java/com/praveen/samples/jacoco/multimodule/Module1ClassIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package com.praveen.samples.jacoco.multimodule; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class Module1ClassIntegrationTest { | ||
|
||
@Test | ||
public void testConvertToLongIntegrationTestTwo() { | ||
Module1Class module1Class = new Module1Class(); | ||
assertEquals(180L, module1Class.convertToLong(180)); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...e-java/module1/src/test/java/com/praveen/samples/jacoco/multimodule/Module1ClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package com.praveen.samples.jacoco.multimodule; | ||
|
||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class Module1ClassTest { | ||
@Test | ||
public void testConvertToStringUnitTestOne() { | ||
Module1Class domainClass1 = new Module1Class(); | ||
assertEquals( "190", domainClass1.convertToString( 190)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...odule-java/module2/src/main/java/com/praveen/samples/jacoco/multimodule/Module2Class.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package com.praveen.samples.jacoco.multimodule; | ||
|
||
public class Module2Class { | ||
|
||
public double convertToDouble(int inputNumber) { | ||
return Double.valueOf(inputNumber); | ||
} | ||
|
||
public float convertToFloat(int inputNumber) { | ||
return Float.valueOf(inputNumber); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...le2/src/test/java/com/praveen/samples/jacoco/multimodule/Module2ClassIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package com.praveen.samples.jacoco.multimodule; | ||
|
||
import static junit.framework.TestCase.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
|
||
public class Module2ClassIntegrationTest { | ||
@Test | ||
public void testConvertFloatIntegrationTestTwo() { | ||
Module2Class module2Class = new Module2Class(); | ||
assertEquals( 129f, module2Class.convertToFloat( 129)); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...e-java/module2/src/test/java/com/praveen/samples/jacoco/multimodule/Module2ClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package com.praveen.samples.jacoco.multimodule; | ||
|
||
import static junit.framework.TestCase.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class Module2ClassTest { | ||
|
||
@Test | ||
public void testConvertDoubleUnitTestOne() { | ||
Module2Class module2Class = new Module2Class(); | ||
assertEquals(103.0, module2Class.convertToDouble(103)); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
example/multimodule-java/module3/src/test/java/cucumbertest/ConcatenateSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package cucumbertest; | ||
|
||
import com.praveen.samples.jacoco.multimodule.Module1Class; | ||
|
||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static junit.framework.TestCase.assertEquals; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class ConcatenateSteps { | ||
private Logger logger = LoggerFactory.getLogger(ConcatenateSteps.class); | ||
|
||
private Module1Class module1Class; | ||
|
||
@Given("^that an integer (\\d+)$") | ||
public void setNumber(int number) throws Throwable { | ||
logger.info( "Given: that: " + number); | ||
module1Class = new Module1Class(); | ||
module1Class.setNumber(number); | ||
|
||
} | ||
|
||
@When("^number (\\d+) is self concatenated$") | ||
public void concatenateNow(int number) throws Throwable { | ||
logger.info( "When: number: " + number); | ||
module1Class.concatenate(number); | ||
} | ||
|
||
@Then("^The concatenated output for number (\\d+) should be (.*)$") | ||
public void calculationDone(int number, String result) throws Throwable { | ||
assertThat(number, is(module1Class.getNumber())); | ||
assertEquals(result, module1Class.getResult()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
example/multimodule-java/module3/src/test/java/cucumbertest/ConcatenateTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright {yyyy} {name of copyright owner} | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// | ||
// this file is copied from https://github.com/PraveenGNair/jacoco-multi-module-sample/ | ||
|
||
|
||
package cucumbertest; | ||
|
||
import io.cucumber.junit.Cucumber; | ||
import io.cucumber.junit.CucumberOptions; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Cucumber.class) | ||
@CucumberOptions( | ||
features = "src/test/resources/features", | ||
glue = "cucumbertest", | ||
strict = true//to suppress unwanted warnings related to cucumber | ||
) | ||
public class ConcatenateTest { | ||
|
||
} |
Oops, something went wrong.