How can I do unit testing without the use of gradl...
# getting-started
r
How can I do unit testing without the use of gradle/maven
j
You'll have to manually compile your main and test classes with some test framework (like JUnit) on the classpath, and then use your test framework runner to run your test classes. For instance with JUnit 5: https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher
But what are you trying to do with this? It's usually much simpler to run tests using a build tool
r
I am trying to do projects from scratch in vscode, and setting up anything related to gradle seems like it's going to take up an entire afternoon of reading dry documentation
just wanting to write some quick kotlin scripts, and be able to test them while doing so.
j
Setting up things without Gradle is most likely going to require much more than one afternoon if you're not familiar with the ecosystem 🙂
👍 1
r
yeah
I meant though
without using JUnit even
is there any technique I can do for writing tests
j
I don't know of any approach that will not amount to implementing your own test framework
k
Well you could write your tests in
fun main
and use
check
as your assertion library, but a proper test framework offers you so much more.
👍 1
a
JUnit has a console launcher - but it's going to be easier to use Maven or Gradle for sure https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher