Comments (18)
relates to https://github.com/KentBeck/junit/issues/117
from junit4.
Can you encode this information using Annotations passed in to the Description constructor?
from junit4.
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.
I had not intended to close this issue. Is there a way to reopen it?
from junit4.
[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.
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.
Opened the bug with the Eclipse folk at:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=338770
from junit4.
It would help if Description could be subclassed to override getMethodName(). Maybe not for this use case, but for similar ones.
from junit4.
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.
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.
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.
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.
Which UI are you talking about? Eclipse? IDEA?
from junit4.
Eclipse, although theoretically IDEA could want this too.
from junit4.
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.
That would be fine with me. By default Description.getUTL() can return null and then IDEs can fallback to their current behavior.
from junit4.
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.
The eclipse folks just need to be sure that the annotation survives across the wire.
from junit4.
Related Issues (20)
- Confusing problem... get differernt result between `main method` and `test method` HOT 7
- Compilation error in org.junit.runner.Result - ObjectInputStream.GetField.get(name, object) throws ClassNotFoundException
- Update to hamcrest 2.2 HOT 16
- Test case grouping - Run subset of test cases depending on specific environment variables HOT 8
- Thread context classloader not reset between tests HOT 1
- Cross site scripting HOT 1
- How to test Redis Time out exception for @Cacheable method with Junit+ Spring integration test HOT 3
- Make Assert failNotEquals public HOT 1
- Assert error messages are not clear HOT 2
- Exception handling of suite() method breaks Jenkins JUnit test history reporting HOT 6
- Add support for "dynamic" default runner selection via system property HOT 8
- When will a new version of junit be released? HOT 1
- JUnitCore could not invoke test HOT 1
- Strange links on "Download and Install" page HOT 1
- junit-4.13.2 compilation error with java 21 HOT 4
- Treat org.opentest4j.TestAbortedException the same as AssumptionViolatedException HOT 4
- Which junit version supports Java 17 ? HOT 2
- Assert check not consistent HOT 9
- Receiving excessively long build DEBUG logs after updating maven-surefire-plugin from 2.22.2 to 3.3.0 HOT 1
- Refactoring Confirmation for Replace ‘expected’ Attribute with Try-Catch HOT 5
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 junit4.