-
Notifications
You must be signed in to change notification settings - Fork 641
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Focus option for top level tests #329
Comments
This is awesome! |
It's in 3.1.1 if you want to use it :) |
@sksamuel Does this work in all test types? |
Should work for all, but only top level tests. @dave08 |
It would be great if it could work for groupings and top level tests, since in KotlinTest there's no IDE arrows like in Spek and JUnit besides each test, so one has to run the whole class or disable all the other tests just to concentrate on the one test he/she's developing... @sksamuel Or is there another way to do that? Also, you mean that |
If you put f: in front of your test name then only that test (and nested tests under it) will be executed @dave08 See I'm not sure what you mean by your second comment about ! and options. |
Say: class FooTest : DescribeSpec({
describe("A foo") {
context("!Planned feature (not yet working on this)") {
// ... All the tests are skipped/disabled under here because of the ! prefix
}
context("Feature already finished") {
// ... These tests should run when there are no `f:`s
}
context("f:Current feature") {
// ... Only these tests should run as long as there's `f:` here
}
}
}) |
I see, no you can't do that. The reason is, inner tests are not known until runtime. So it would break the way the test runners work. You can put the f: on the describe block. |
So how does providing the I suppose the multi-level I feel this feature is pretty important given that there aren't any arrows to use to run individual cases in the IDE. Maybe this could be implemented under the hood using one test per class with an internal marking that other tests should not be run? |
In order to determine which test to run, it has to check all of them in the same scope. If you do: test("test 1") { }
test("f: test 2") { } Then test 1 needs to be skipped because you've focused test 2. So it needs to scan ahead. We can't do this in nested scopes as the test closures are executed lazily, so that variable initialisation etc, works properly. |
So maybe have a Sorry for insisting, its fine if you just say its not possible and thats it, I'm just trying to see if there's a workable solution, I think its a nice addition to a dev's workflow. |
That's not the problem. |
I mean f2 would be on the parent to indicate the second test or group under it is focused so you know before running what's under it |
You mean f2 would indicate the 2nd test was focused, and f3 the third test and so on? |
Yes, the second test under the indicated scope, but a clearer naming might be chosen to indicate not focusing on the item with the f but its child maybe It might get complicated in parameterized tests, I don't know if it would be possible to run the whole parameter set (not just the 4th one for eg.), which makes I think more sense in the devs workflow. |
Yeah, this is pretty annoying. Using DescribeSpec, I need to literally comment out every test but the one I want to focus on in order to isolate it. |
I believe that with the intellij plugin, this will be somewhat easier,
right?
…On Wed., Feb. 20, 2019, 09:03 David ***@***.*** wrote:
I see, no you can't do that. The reason is, inner tests are not known
until runtime. So it would break the way the test runners work.
Yeah, this is pretty annoying. Using DescribeSpec, I need to literally
comment out every test but the one I want to focus on in order to isolate
it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#329 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABgRIxGx0Qs4oQCuLWujc-4tovW8WRYnks5vPTmdgaJpZM4T9oLO>
.
|
Yes, you can run in the inner test with the plugin.
It will actually make focus a bit redundant.
On Wed, 20 Feb 2019 at 12:05, Leonardo Colman Lopes <
notifications@github.com> wrote:
… I believe that with the intellij plugin, this will be somewhat easier,
right?
On Wed., Feb. 20, 2019, 09:03 David ***@***.*** wrote:
> I see, no you can't do that. The reason is, inner tests are not known
> until runtime. So it would break the way the test runners work.
>
> Yeah, this is pretty annoying. Using DescribeSpec, I need to literally
> comment out every test but the one I want to focus on in order to isolate
> it.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <
#329 (comment)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/ABgRIxGx0Qs4oQCuLWujc-4tovW8WRYnks5vPTmdgaJpZM4T9oLO
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#329 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtZGtrRbhFs8MPrId_ad6dJ30Xc93HQks5vPTnygaJpZM4T9oLO>
.
|
Oh, I didn't realise there was a plugin, that's neat. I just installed it and now notice there's arrows in the IDE beside each individual test case (within a This is what I mean: |
Not redundant if you consider people still use eclipse |
Do they? In 2019 :)
Yes fair point.
…On Wed, 20 Feb 2019 at 12:34, Leonardo Colman Lopes < ***@***.***> wrote:
It will actually make focus a bit redundant.
Not redundant if you consider people still use eclipse
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#329 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtZGqh_MmVWL2cMz7DBCargTvgBkVxSks5vPUDZgaJpZM4T9oLO>
.
|
@TAGC You're the second person to say this. Although the "run" tool tip is wrong (I don't know how to fix that currently), for me it does only run the correct single test. Can you try it, and take a screenshot of the run configuration page. |
Sure, the run configuration (this is used regardless of which green arrow I click): And here's the test output pane: Here's the relevant logging output:
|
Thanks.
It's not actually created it as a kotlintest run but a standard junit 5.
Is there an option to create a KT test manually if you click the plus icon ?
…On Wed, 20 Feb 2019 at 12:43, David ***@***.***> wrote:
Sure, the run configuration:
[image: idea64_2019-02-20_12-39-08]
<https://user-images.githubusercontent.com/1588951/53092489-d58a4880-350c-11e9-8db5-4a2663eea7f1.png>
And here's the test output pane:
[image: idea64_2019-02-20_12-40-40]
<https://user-images.githubusercontent.com/1588951/53092498-d7540c00-350c-11e9-9d5c-a75756df262f.png>
Here's the relevant logging output:
40 [main] DEBUG KotlinTestEngine - configurationParameters=LauncherConfigurationParameters []
40 [main] DEBUG KotlinTestEngine - uniqueId=[engine:kotlintest]
60 [main] DEBUG KotlinTestEngine - LauncherDiscoveryRequest [
classpathRootSelectors=[]
classpathResourceSelectors=[]
classSelectors=[com.mycompany.testmaster.domain.nodes.CompositeNodeTests]
methodSelectors=[]
directorySelectors=[]
fileSelectors=[]
moduleSelectors=[]
packageSelectors=[]
uniqueIdSelectors=[]
uriSelectors=[]
engineFilters=[]
postDiscoveryFilters=[]
classnameFilters=[]
packageNameFilters=[]
]
120 [main] DEBUG TestDiscovery - Loaded 1 classes from classnames...
395 [main] DEBUG TestDiscovery - ...which has filtered to 1 non abstract classes
395 [main] DEBUG TestDiscovery - 1 classes after applying discovery extensions405 [main] DEBUG KotlinTestEngine - configurationParameters=LauncherConfigurationParameters []
405 [main] DEBUG KotlinTestEngine - uniqueId=[engine:kotlintest]
405 [main] DEBUG KotlinTestEngine - LauncherDiscoveryRequest [
classpathRootSelectors=[]
classpathResourceSelectors=[]
classSelectors=[com.mycompany.testmaster.domain.nodes.CompositeNodeTests]
methodSelectors=[]
directorySelectors=[]
fileSelectors=[]
moduleSelectors=[]
packageSelectors=[]
uniqueIdSelectors=[]
uriSelectors=[]
engineFilters=[]
postDiscoveryFilters=[]
classnameFilters=[]
packageNameFilters=[]
]
415 [main] DEBUG KotlinTestEngine - JUnit execution request [configurationParameters=LauncherConfigurationParameters []; rootTestDescriptor=KotlinTestEngineDescriptor: [engine:kotlintest]]
415 [main] DEBUG JUnitTestRunnerListener - Engine started; classes=[[class com.mycompany.testmaster.domain.nodes.CompositeNodeTests]]
415 [main] DEBUG TestEngine - Submitting 1 specs
415 [main] DEBUG TestEngine - Waiting for spec execution service to terminate
437 [kotlintest-engine-0] DEBUG JUnitTestRunnerListener - prepareSpec [Description(parents=[], name=CompositeNodeTests)]447 [kotlintest-test-executor-0] DEBUG JUnitTestRunnerListener - Creating test case descriptor Description(parents=[CompositeNodeTests], name=Describe: Composite node)/Container
457 [kotlintest-test-executor-0] DEBUG JUnitTestRunnerListener - Notifying junit of start event [engine:kotlintest]/[spec:CompositeNodeTests]/[test:Describe%3A Composite node]457 [kotlintest-test-executor-0] DEBUG JUnitTestRunnerListener - Creating test case descriptor Description(parents=[CompositeNodeTests, Describe: Composite node], name=Scenario: immediately executes once and terminates if it has no inputs and no outputs)/Test
457 [kotlintest-test-executor-0] DEBUG JUnitTestRunnerListener - Notifying junit of start event [engine:kotlintest]/[spec:CompositeNodeTests]/[test:Describe%3A Composite node]/[test:Scenario%3A immediately executes once and terminates if it has no inputs and no outputs]
634 [kotlintest-engine-0] DEBUG JUnitTestRunnerListener - Notifying junit of test case completion [engine:kotlintest]/[spec:CompositeNodeTests]/[test:Describe%3A Composite node]=TestResult(status=Failure, error=java.lang.AssertionError: Expected exception java.lang.IllegalStateException but no exception was thrown, reason=null, metaData={})
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#329 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtZGtoHHAQ92hpilLQJoZNcz2_A18Z-ks5vPULwgaJpZM4T9oLO>
.
|
Prefix a test with f: (top level only) and that test (or group of tests) will be the only ones executed.
The text was updated successfully, but these errors were encountered: