I’m looking at KotinTest for unit testing, and one...
# getting-started
m
I’m looking at KotinTest for unit testing, and one of the examples talks about putting tests in “context blocks.”
Copy code
class MyTests : FunSpec({
    context("a test group") {
        test("String length should return the length of the string") {
            "sammy".length shouldBe 5
            "".length shouldBe 0
        }
    }
})
What would be the purpose of this? Is this a kotlin thing? Or a kotlin test thing. It turns out googling for “kotlintest context” or “kotlin context” doesn’t find much that appears relevant.
k
It's not a Kotlin thing, can you try going to the declaration of
context
to see where it comes from?
s
It's in case you want to "nest" tests. So you can have more than one test block under a context block, and then they will be organized in a tree in intellij when you run the tests.