Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-8414 Colored testsuite progress #5610

Conversation

tristantarrant
Copy link
Member

https://issues.jboss.org/browse/ISPN-8414

All new and improved:

  • does not use jansi
  • each test is coded: green (success), red (failure), yellow (skipped)
  • does not cause OOME (like my previous iteration)
  • shows test progress and cumulative status on a single line for compactness
    mavenlog

private static final Logger log = Logger.getLogger(TestSuiteProgress.class);
private static final char ESC = (char) 27;
private static final String RED = string(ESC, '[', '3', '1', 'm');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything wrong with RED = "\u001b[31m" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the way I'm doing it is a leftover from some preprocessing I had to play nice with Surefire's way of encoding special chars. I'll fix that.

}

private static void consoleLog(String message) {
System.out.println("[" + TestSuiteProgress.class.getSimpleName() + "] " + message);
public static String string(char... chars) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess God did not want us to have a String constructor taking a variable number of chars for a reason... :)

@anistor
Copy link
Member

anistor commented Nov 29, 2017

Everything looks awesome, aside from my nitpicking on string theory :)

if (useColor) {
progress(color + message + RESET);
} else
progress(message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using curly on the else branch? :)

@tristantarrant
Copy link
Member Author

@anistor fixed all !

skipped.get();
consoleLog(message);
synchronized void progress(CharSequence message) {
out.printf("[OK: %5s, KO: %5s, SKIP: %5s] %s\n", succeeded.get(), failed.get(), skipped.get(), message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could not test this on Windows to see if it matters, but was thinking maybe we should use %n instead of \n for maximum crossplatform compat.

@anistor
Copy link
Member

anistor commented Nov 29, 2017

Integrated in master. Thanks @tristantarrant !

@anistor anistor closed this Nov 29, 2017
@tristantarrant tristantarrant deleted the ISPN-8414/ansi_test_progress branch April 10, 2018 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants