Skip to content

Commit

Permalink
NATT print test case fail summary (System.out)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMartin committed Aug 13, 2024
1 parent 00e6dff commit 8c7f7a8
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 8 deletions.
Binary file modified examples/plugin-example/plugin/libs/natt-spi-1.1.0.jar
Binary file not shown.
Binary file modified examples/project-example/NATT.jar
Binary file not shown.
Binary file modified natt-config-editor/NATT.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion natt-vscode-extension/out/extension.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions natt-vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publisher": "0xM4R71N",
"repository": "https://github.com/0xMartin/NetworkAppTestingTool",
"description": "Test scenario configuration editor for black box network application testing tool.",
"version": "1.3.0",
"version": "1.3.1",
"engines": {
"vscode": "^1.91.1"
},
Expand Down Expand Up @@ -90,7 +90,7 @@
"properties": {
"yourExtension.nattJarUrl": {
"type": "string",
"default": "https://github.com/0xMartin/NetworkAppTestingTool/releases/download/1.6.6/NATT.jar",
"default": "https://github.com/0xMartin/NetworkAppTestingTool/releases/download/1.6.7/NATT.jar",
"description": "URL for the NATT JAR file"
}
}
Expand Down
2 changes: 1 addition & 1 deletion natt-vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export function activate(context: vscode.ExtensionContext) {
/****************************************************************************************************************************** */
// Define the URL and destination path for the JAR file
const config = vscode.workspace.getConfiguration('natt-configuration-editor');
const jarUrl = config.get<string>('nattJarUrl', 'https://github.com/0xMartin/NetworkAppTestingTool/releases/download/1.6.6/NATT.jar');
const jarUrl = config.get<string>('nattJarUrl', 'https://github.com/0xMartin/NetworkAppTestingTool/releases/download/1.6.7/NATT.jar');
const destJarPath = path.join(projectPath, 'NATT.jar');

// Function to download the file
Expand Down
2 changes: 1 addition & 1 deletion natt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ task writeVersionProperties {

processResources.dependsOn writeVersionProperties

version = '1.6.6'
version = '1.6.7'
group = 'utb.fai.natt'
Binary file modified natt/libs/natt-spi-1.1.0.jar
Binary file not shown.
24 changes: 21 additions & 3 deletions natt/src/main/java/utb/fai/natt/core/NATTCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

/**
* Hlavni trida testovaciho nastroju. Zajistuje pospupne zpracovani vsech testu
Expand Down Expand Up @@ -405,13 +406,30 @@ public void generateReport() throws InternalErrorException {
throw new InternalErrorException("Failed to generate report!");
}

// urci finalni status testovani a podle jeho vysledku navrati prislusny status
// kod
// shrnuti vysledku testovani (vypise vsechny pripadne testovaci pripady ktere selhaly)
LinkedList<String> list = new LinkedList<>();
NATTContext.instance().getTestCaseResults().stream().forEach(tc -> {
if (!tc.isPassed()) {
list.add(tc.getTestCaseName());
}
});
if(list.isEmpty()) {
logger.info("All test cases passed.");
} else {
String listStr = list.stream()
.map(s -> "\"" + s + "\"")
.collect(Collectors.joining(", "));
logger.warning("Failed test cases: " + listStr);
}

// vypise finalni skore testovani (pokud je vyzadovano)
boolean passed = NATTContext.instance().getTestCaseResults().stream().allMatch(tc -> tc.isPassed());
if (NATTContext.instance().getMaxScore() > 0) {
logger.info(String.format("Final score: %f", NATTContext.instance().getFinalScore()));
}
logger.info(String.format("Report generating done. Leaving status: %s", passed ? "PASSED" : "FAILED"));

// finalni status celeho testovani
logger.info(String.format("Testing done. Leaving status: %s", passed ? "PASSED" : "FAILED"));

// navrati finalni status kod
System.exit(passed ? StatusCode.TEST_PASSED : StatusCode.TEST_FAILED);
Expand Down

0 comments on commit 8c7f7a8

Please sign in to comment.