tom-writes-code / rpgle-repl

A green-screen REPL style workspace to assist with RPGLE development
MIT License
26 stars 3 forks source link

Run test suites via command, non-interactively #49

Closed JDubbTX closed 5 months ago

JDubbTX commented 9 months ago

It occurs to me that it would be powerful to have REPL tests available to run in a test suite, as part of a ci/cd pipeline.

I would like to be able to call REPL via bash command, and it return 0 if all tests pass, and not zero if there is a failure. It would be nice to have stdout be the screen output, controlled via parameter (like REPL -v REPLTESTS would print everything to stdout, while REPL REPLTESTS would not).

tom-writes-code commented 9 months ago

Hey, are you imagining here that REPLTEST is a saved snippet (or collection of saved snippets) in REPL, or is it a separate source file? I could see both being useful - either to be able to run an existing snippet, or just get REPL to process a copy of an existing source file as though it had been typed in.

And are you thinking of some kind of built in assertion statement, e.g. something like:

x = doSomething();
replAssert(2.5: x);

And so verbose would print out something like Test passed, x=2.5 or Test failed, expected x=2.5, actual x=5.0

JDubbTX commented 8 months ago

Sorry for the late response. Yes, something like that. RPGUNIT has different kinds of assertions like assert true, assert false, assert equal, even something that searches the joblog for a particular message etc.

I think just assert equal would be enough to get started. Might be nice to have a list screen that shows which tests are passing / failing, etc. too

tom-writes-code commented 8 months ago

Yeah, that's great. I'll have a think about how best to slot that in. I can definitely add in a few assertions, and then I'll look at wrapping it up in a shell script.

tom-writes-code commented 8 months ago

OK, we're part way there. The GUI now supports replPrint() and replEquals() to check existing values and make assertions about existing values.

image

Next on my list is allow these to be executed remotely and print out the results - I'm planning on starting with using named snippets, and if I can extend to it, specify any source code stored anywhere else, and execute that within the repl framework

tom-writes-code commented 7 months ago

Basic bash script added, with wrapper CL functions. Still to do: