Skip to content

Commit

Permalink
Merge pull request #31 from Goodie01/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Goodie01 authored Jun 19, 2024
2 parents d0b882f + 7bdfe6d commit 309b4ca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Melinoe
![Java CI with Maven](https://github.com/Goodie01/Melinoe/workflows/Java%20CI%20with%20Maven/badge.svg)
![Release](https://github.com/Goodie01/Melinoe/actions/workflows/release.yml/badge.svg)

The goal is to provide a testing framework that can cover testing all aspects of a application in a similar method, that can have new components added to it as needed. This could, eventually, extend as far as testing a thick GUI Client.

Expand All @@ -9,11 +10,11 @@ Melinoë is a chthonic nymph or goddess invoked in one of the Orphic Hymns and r

In my time I've seen many automation frameworks. I have found that many of them focused on making the inputs as easy to read and digestible as possible. Often leaning in to such paradigms as BDD.

Often this would follow a workflow where testers would write a BDD statement, which developers would then ensure connects to the correct code in the backend. In theory this means that developers only have to fill in the new blocks, and allows for code re-usability and for testers to know what the test was doing. In practice I often found that the testers BDD statements were often written in such a way as to often need new code, and re-usability was often a afterthought.
Often this would follow a workflow where testers would write a BDD statement, which developers would then ensure connects to the correct code in the backend. In theory this means that developers only have to fill in the new blocks, and allows for code re-usability and for testers to know what the test was doing. In practice I often found that BDD did not live up to this dream. Statements either became long and coveted, and reusable, or not reusable, and readable.

In other words I often found this liken to wringing blood from a stone. In my experience the most successful test framework I used was one that focused on making the output as digestible as possible.
In my experience the most successful test framework I used was one that focused on making the output as digestible as possible.

With this framework, and workflow testers describe what they want the tests to do in whatever method they want, developers are free to write code to do this as they like, and the output is readable by developers, testers, and others involved in the project as required.
With this framework, the suggested workflow is that testers describe what they want the tests to do, and developers are free to write code to do this as they like, and the output is readable by product and project managers, developers, and testers.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @author Goodie
*/
public class MelinoeExtension implements BeforeTestExecutionCallback, AfterTestExecutionCallback, BeforeAllCallback, BeforeEachCallback, AfterEachCallback, AfterAllCallback {
public static String CLASS_DISPLAY_NAME;
public static String DISPLAY_NAME;
public static String CLASS_NAME;
public static String METHOD_NAME;
Expand Down Expand Up @@ -89,6 +90,9 @@ private static void populateInformation(ExtensionContext context) {
METHOD_NAME = context.getTestMethod().map(Method::getName).orElse(null);
CLASS_NAME = context.getTestClass().map(Class::getCanonicalName).orElse(null);
DISPLAY_NAME = context.getDisplayName();
if(METHOD_NAME == null) {
CLASS_DISPLAY_NAME = DISPLAY_NAME;
}

context.getExecutionException().ifPresentOrElse(throwable -> {
THROWABLE = throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public Session newSession() {
return new SessionImpl(fileManager, rootLogger, closableRegister);
}

String prettyName = MelinoeExtension.DISPLAY_NAME + System.lineSeparator() + MelinoeExtension.METHOD_NAME + "()";
String logMessage = switch (MelinoeExtension.EXECUTION_TYPE) {
case BEFORE_ALL -> "Before all";
case BEFORE_EACH -> "Before each";
Expand All @@ -78,8 +77,7 @@ public Session newSession() {
default -> "Other???";
};

String classLoggerKey = MelinoeExtension.CLASS_NAME;
LoggerImpl classLogger = loggersMap.computeIfAbsent(classLoggerKey, s -> rootLogger.createSublogger(MelinoeExtension.CLASS_NAME));
LoggerImpl classLogger = loggersMap.computeIfAbsent(MelinoeExtension.CLASS_NAME, s -> rootLogger.createSublogger(MelinoeExtension.CLASS_DISPLAY_NAME));
MelinoeExtension.storeLogger(classLogger);

if(isBeforeOrAfterAll()) {
Expand All @@ -88,7 +86,7 @@ public Session newSession() {
return new SessionImpl(fileManager, beforeAfterAllLogger, closableRegister);
} else {
String methodLoggerKey = MelinoeExtension.CLASS_NAME + MelinoeExtension.METHOD_NAME;
LoggerImpl methodLogger = loggersMap.computeIfAbsent(methodLoggerKey, s -> classLogger.createSublogger(prettyName));
LoggerImpl methodLogger = loggersMap.computeIfAbsent(methodLoggerKey, s -> classLogger.createSublogger(MelinoeExtension.DISPLAY_NAME));

if(isBeforeOrAfterEach()) {
LoggerImpl sublogger = methodLogger.createSublogger(logMessage);
Expand Down

0 comments on commit 309b4ca

Please sign in to comment.