Best Spek code snippet using org.spekframework.spek2.kotlin.SpekExtension.visitClass
SpekExtension.kt
Source:SpekExtension.kt
...57 private var collectedSpeks = mutableListOf<IrClass>()58 override fun visitElement(element: IrElement) {59 element.acceptChildrenVoid(this)60 }61 override fun visitClass(declaration: IrClass) {62 super.visitClass(declaration)63 if (!declaration.isSpek) {64 return65 }66 if (declaration.kind != ClassKind.OBJECT) {67 if (!declaration.isAbstract) {68 commonContext.reportWarning("Declaration ${declaration.name} inherits from $spekClassName but is not an object (it has kind ${declaration.kind}) and so will be not be run.", file, declaration)69 }70 return71 }72 collectedSpeks.add(declaration)73 }74 fun generateRegistrations() {75 collectedSpeks.forEach { generateRegistration(it) }76 }...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!