Coder Social home page Coder Social logo

Comments (18)

pniederw avatar pniederw commented on August 22, 2024

relates to https://github.com/KentBeck/junit/issues/117

from junit4.

dsaff avatar dsaff commented on August 22, 2024

Can you encode this information using Annotations passed in to the Description constructor?

from junit4.

fowles avatar fowles commented on August 22, 2024

If there were well defined annotations for file and line number and the UI knew to use those for when people click on the tests, then yes.

from junit4.

fowles avatar fowles commented on August 22, 2024

I had not intended to close this issue. Is there a way to reopen it?

from junit4.

dsaff avatar dsaff commented on August 22, 2024

[I have an "Open" option under the Actions menu. I just used it. I don't know if that's available to everyone, or just project owners.]

from junit4.

dsaff avatar dsaff commented on August 22, 2024

Eclipse currently parses the description, and finds a class and method based on that. I'd be thrilled if it had another option: the Eclipse committers and JUnit committers would need to agree on an API/format. Can you create an issue in the Eclipse bugzilla, and link it here, to get the conversation started? Thanks.

from junit4.

fowles avatar fowles commented on August 22, 2024

Opened the bug with the Eclipse folk at:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=338770

from junit4.

pniederw avatar pniederw commented on August 22, 2024

It would help if Description could be subclassed to override getMethodName(). Maybe not for this use case, but for similar ones.

from junit4.

fowles avatar fowles commented on August 22, 2024

I had considered that but it doesn't provide quite enough rope for the case where you have your tests written in a test specification language that you interpret. Because then you want to specify both a file and line, not just a method name.

from junit4.

pniederw avatar pniederw commented on August 22, 2024

As I said, it depends on the specific requirements. In the case of my custom runner, the ability to subclass Description would solve the problem immediately.

from junit4.

dsaff avatar dsaff commented on August 22, 2024

Matt,

Do you have a proposal about how this would work? Would there be one way of reporting location for descriptions that relate to Java classes and methods, and another for descriptions that related to non-Java files, or do you have a single, unified location strategy in mind? Thanks.

from junit4.

fowles avatar fowles commented on August 22, 2024

Currently the UI uses:

Description.getClassName()
Description.getMethodName()

which is unfortunately very specific to a JUnit class runner. I would suggest adding

Description.hasCustomLocation()
Description.getFileName()
Description.getLineNumber()

where the first method indicates that the other two should be used.

from junit4.

dsaff avatar dsaff commented on August 22, 2024

Which UI are you talking about? Eclipse? IDEA?

from junit4.

fowles avatar fowles commented on August 22, 2024

Eclipse, although theoretically IDEA could want this too.

from junit4.

dsaff avatar dsaff commented on August 22, 2024

I didn't think that Eclipse used Description.getClassName(). I wonder if we want something textual, like a UTL (uniform test locator):

method://org.junit.tests.core.RunnerTest/testFoo
project://testdata/scripts/test1.xml:23

This would give maximum flexibility for IDEs and custom runners to work together without needing additional API from JUnit. What do you think?

from junit4.

fowles avatar fowles commented on August 22, 2024

That would be fine with me. By default Description.getUTL() can return null and then IDEs can fallback to their current behavior.

from junit4.

dsaff avatar dsaff commented on August 22, 2024

On second (third?) thought, I think that Annotations make the most sense: this information is obviously metadata, and adding a @filelocation annotation that runners could optionally add, and IDE's optionally honor, would require no change to the Description API. See https://github.com/KentBeck/junit/issues/198 for a similar proposal around test classes and methods.

from junit4.

fowles avatar fowles commented on August 22, 2024

The eclipse folks just need to be sure that the annotation survives across the wire.

from junit4.

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.