Comments (11)
Test structure is not known upfront (unlike JUnit, where whole test structure information can be extracted via reflection prior to execution), so it is not possible to mark single given
, it
or on
to run same way as in JUnit.
However, it may be good idea to add focus idiom to Spek - similar to specta for iOS, where you can add f
prefix to make only focused specs run. It would look like this:
given("a calculator") {
on("add two numbers") {
it ("returns sum") {}
}
fon("substract two numberts") {
it ("returns difference") {}
it ("doesn't return sum")
}
}
in example above, execution result is as follows:
given: a calculator
on: substract two numbers
it: returns difference
it: doesn't return sum
Drawback: your test code has to be modified to run single or a bunch of specs, instead of just telling IDE to run specified test without touching sources.
@hhariri, wdyt?
from spek.
@jskierbi really not in favor of having to modify tests to be honest :/
from spek.
Test structure is not known upfront (unlike JUnit, where whole test structure information can be extracted via reflection prior to execution), so it is not possible to mark single given, it or on to run same way as in JUnit.
Sorry, but that's untrue, in scalatest we can able to run single test from a hierarchy
class Test extends FunSpec with Matchers {
describe("1") {
describe("2") {
it("31") {
println("1")
}
it("32") {
println("2")
}
}
}
}
from spek.
@yaroslav-ulanovych does scalatest come with its own IntelliJ plugin? As for now, for current execution model, without additional logic on the IDE side, for my knowledge this is not possible.
from spek.
@jskierbi The IntelliJ Scala plugin comes with good ScalaTest support. Anyway I believe pull requests with spek support should be gladly accepted by IntelliJ team.
from spek.
Branch 1.0 should solve this.
from spek.
@hhariri I just downloaded 1.0.0 and I still don't appear to be able to run individual tests. IntelliJ does show them separately (as before) but I don't see any way to run them in isolation.
Is there something more I need to do in order to run isolated tests?
from spek.
Sorry. I was closing a few different issues, and mistakenly closed this one. This current limitation still remains (for now)
from spek.
I've taken a stab at implementing focused tests here: #75
Does this address your issue @Zoltu ?
from spek.
It partially addresses my issue, but I don't think it does so enough to make me switch back from JUnit to Spek for test authoring. I utilize the JUnit IntelliJ integration pretty heavily and use the GUI to run, debug or coverage one test at a item, or a whole class of tests depending on what I am doing. I also sometimes use the run configurations created by doing that to switch back and forth between a couple of different tests.
This fix does allow me to debug a single test, which is a significant improvement, but I still am missing the GUI integration which I heavily rely on. I may try to switch back to Spek again at some point in the future to see how having this feels... but I'm worried that I'll be frustrated at not having the GUI integration working as I would expect.
Also, I believe this won't allow me to do things like use the "re-run all failing tests" feature in IntelliJ, since that will result in all classes with any failing tests being fully re-run.
from spek.
For now this won't be resolved due to the way Spek is designed and the impossibility of actually running individual functions. If/when we move to scripts and Kotlin provides support for identifying line numbers or expression trees, then we can try and address this issue.
from spek.
Related Issues (20)
- use IR for JS
- Spek plugin 2.0.19 crashes on AS Flamingo and Java 1.8 HOT 1
- The plugin is not compatible with the current version
- Before and After scenario not in proper order HOT 1
- Kotlin 1.5.0 - TestSuiteExecutionException testing function with "when" and enum HOT 8
- MockK crashes when running Spek tests from Android Studio HOT 4
- Port #965 to 2.x branch
- Test fails in Spek Android Studio plugin but works in Gradle due to different classpath HOT 3
- JCenter migration issue, spek-runtime is missing HOT 1
- Spek Framework Plugin incompatible with IntelliJ IDEA 2021.2 HOT 2
- add automatic-module name so that it can be used as proper module
- Could not find spek-dsl-metadata 2.0.17 HOT 6
- Run test button does nothing HOT 2
- Spek should be compatible with JUnit Platform suites HOT 1
- Feature: Support running tests in random order
- Incompatible with IntelliJ IDEA 2022.1 HOT 25
- Gherkin rule dsl missing
- Multiplatform status? HOT 2
- Incompatible with 2022.2.1 HOT 13
- klib publishing fails due to missing checksum
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spek.