picture of console output showing red info line
EDIT:
I found the code that creates this red INFO line in my IntelliJ console -
public List<Feature> parseJsonFiles(List<String> jsonFiles) {
if (jsonFiles.isEmpty()) {
throw new ValidationException("None report file was added!");
}
List<Feature> featureResults = new ArrayList<>();
for (int i = 0; i < jsonFiles.size(); i++) {
String jsonFile = jsonFiles.get(i);
// if file is empty (is not valid JSON report), check if should be skipped or not
if (new File(jsonFile).length() == 0
&& configuration.containsReducingMethod(ReducingMethod.SKIP_EMPTY_JSON_FILES)) {
continue;
}
Feature[] features = parseForFeature(jsonFile);
**LOG.log(Level.INFO, String.format("File '%s' contains %d features", jsonFile, features.length));**
featureResults.addAll(Arrays.asList(features));
}
So this line seems to be expected behavior here - so my question I guess becomes, is there a way to suppress this INFO line in my IntelliJ console, or else change the color from Red to white because at first glance this seems like an error, when really it is not?
Original Post:
I am trying to integrate Cucumber Reports with Karate and it seems to work, i.e., Karate script passes and generates the Karate report and the Cucumber Report is created too, however, I get an annoying INFO line in red in my IntelliJ IDE at bottom of ouput console -
INFO: File 'C:\Users\ferdman\IdeaProjects\ms_client_automation\target\karate-reports\src.test.resources.feature.users.users.json' contains 1 feature(s)
This is kind of annoying because it indicates an error because it is in red even tho there is no error. I have tried playing around with different settings of logback-test.xml and log4j2.properties (pasted below too) but I don't think whatever is doing this is impacted by either of those things, I am running this as a JUnit test in IntelliJ (right clicking on runner java file and clicking play) - any advice appreciated, thanks.
Console output:
Karate version: 1.4.1
elapsed: 5.30 | threads: 5 | thread time: 0.90 features: 1 | skipped: 0 | efficiency: 0.03 scenarios: 1 | passed: 1 | failed: 0
HTML report: (paste into browser to view) | Karate version: 1.4.1 file:///C:/Users/ferdman/IdeaProjects/ms_client_automation/target/karate-reports/karate-summary.html
Dec 13, 2023 1:14:51 PM net.masterthought.cucumber.ReportParser parseJsonFiles INFO: File 'C:\Users\ferdman\IdeaProjects\ms_client_automation\target\karate-reports\src.test.resources.feature.users.users.json' contains 1 feature(s)
Here is my runner:
`public class KarateUsersParallelRunnerTest {
@Test
void testParallel() {
Results results = Runner.path("src/test/resources/feature/users")
.tags("@users")
.outputCucumberJson(true)
.parallel(5);
generateReport(results.getReportDir());
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}
public static void generateReport(String karateOutputPath) {
Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
List<String> jsonPaths = new ArrayList<>(jsonFiles.size());
jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
Configuration config = new Configuration(new File("target"), "demo");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
}
logback-test.xml:
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>target/karate.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="com.intuit.karate" level="DEBUG"/>
<root level="info">
<!-- <<appender-ref ref="STDOUT" /> -->
<appender-ref ref="FILE" />
</root>
log4j2.properties:
log4j.rootLogger.level = WARN
log4j.appender.CONSOLE = org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout`
I tried playing with the logback-test.xml and log4j2.properties files but this did not change what i was seeing in the console in IntelliJ