Giter VIP home page Giter VIP logo

Comments (11)

jskierbi avatar jskierbi commented on September 4, 2024

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.

hhariri avatar hhariri commented on September 4, 2024

@jskierbi really not in favor of having to modify tests to be honest :/

from spek.

yaroslav-ulanovych avatar yaroslav-ulanovych commented on September 4, 2024

@jskierbi

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")
      }
    }
  }
}

Screenshot

from spek.

jskierbi avatar jskierbi commented on September 4, 2024

@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.

yaroslav-ulanovych avatar yaroslav-ulanovych commented on September 4, 2024

@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.

hhariri avatar hhariri commented on September 4, 2024

Branch 1.0 should solve this.

from spek.

MicahZoltu avatar MicahZoltu commented on September 4, 2024

@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.

hhariri avatar hhariri commented on September 4, 2024

Sorry. I was closing a few different issues, and mistakenly closed this one. This current limitation still remains (for now)

from spek.

lkogler avatar lkogler commented on September 4, 2024

I've taken a stab at implementing focused tests here: #75

Does this address your issue @Zoltu ?

from spek.

MicahZoltu avatar MicahZoltu commented on September 4, 2024

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.

hhariri avatar hhariri commented on September 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.