Skip to content
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

Package declaration produce empty output for JUnit target #168

Open
leomillon opened this issue Jul 29, 2020 · 1 comment
Open

Package declaration produce empty output for JUnit target #168

leomillon opened this issue Jul 29, 2020 · 1 comment
Labels
bug Something isn't working junit

Comments

@leomillon
Copy link

Hello,

Thanks for this great project!

It seems there is an issue with the JUnit target (aka /test) when a package declaration is present.

Simple working use-case

Given the following working use-case:

import org.junit.Assert
import org.junit.Test

class TestStart {
    @Test fun testOk() {
        Assert.assertEquals("OK", "OK")
    }
}

The output is:

Passed: testOk

Request payload

{
  "args": "",
  "files": [
    {
      "name": "File.kt",
      "text": "import org.junit.Assert\nimport org.junit.Test\n\nclass TestStart {\n    @Test fun testOk() {\n        Assert.assertEquals(\"OK\", \"OK\")\n    }\n}",
      "publicId": ""
    }
  ]
}

Response body

{
  "testResults": {
    "TestStart": [
      {
        "output": "",
        "className": "TestStart",
        "methodName": "testOk",
        "executionTime": 1,
        "exception": null,
        "comparisonFailure": null,
        "status": "OK"
      }
    ]
  },
  "errors": {
    "File.kt": []
  }
}

Same use-case with package declaration

Now if we just add a package declaration (for example package anything.there:

package anything.there

import org.junit.Assert
import org.junit.Test

class TestStart {
    @Test fun testOk() {
        Assert.assertEquals("OK", "OK")
    }
}

The output is empty:

Request payload

{
  "args": "",
  "files": [
    {
      "name": "File.kt",
      "text": "package anything.there\n\nimport org.junit.Assert\nimport org.junit.Test\n\nclass TestStart {\n    @Test fun testOk() {\n        Assert.assertEquals(\"OK\", \"OK\")\n    }\n}",
      "publicId": ""
    }
  ]
}

Response body

{"errors":{"File.kt":[]}}

It seems to be working fine with a simple JVM target execution, but not with the JUnit target...

Is there anything known about this bug?

@AlexanderPrendota
Copy link
Collaborator

Hey, thanks for report the issue. Should have a look :)

@AlexanderPrendota AlexanderPrendota added bug Something isn't working junit labels Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working junit
Projects
None yet
Development

No branches or pull requests

2 participants