Technical Articles
Running ABAP unit tests on GitHub Actions
Ideally, unit tests are fast and only run the code in a single unit, ie. dependencies are mocked.
This makes unit tests great for CI, but there is no easy way to spawn a new ABAP system for each commit(?).
But what if we go one step further and mock the ABAP system?
It’s a bit more work, a bit more difficult, but fun π
The abaplint transpiler can run some ABAP on GitHub Actions.
Using GitHub actions is free for public projects, and very useful when the changes can come from anywhere(untrusted).
Setup
I’ve prepared a sample repository, which can be cloned, and is open to test pull requests:
https://github.com/larshp/unit-test-test
Some basic Node.js knowledge is required, the scripts are located in package.json and work with Node.js 14+.
The Actions workflow is configured so the unit tests runs for each commit,
Real Continuous Integration
Note how this is a real Continuous Integration setup, unit tests are run for each push for every developer, this setup is running 300+ unit tests for abapGit in 18 seconds, giving fast feedback to the developer.
It might give false positives, but please see it as a step running before involving a real system(Scenario 9).
Recommendations
If you would like to try it out, start early, and start with the basics of your application.
Keep strict track of all dependencies, abaplint can help with this.
If the code use 702+ syntax, an extra downport step must be added to the compilation.
And expect a lot of bugs π as always, bug reports are welcome on GitHub.
Very cool. Sounds like it's just aΒ Small Matter of ProgrammingΒ to get it all working π
Yes, but also not it is working, running 300+ unit tests in abapGit
Sorry, was meant tongue in cheek, emphasis on _all_ working, "run some ABAP" --> run all ABAP
The current state is a huge achievement for sure!