Comments (6)
Would you mind adding a hint in the changelog as this is a "breaking" behavior change (depending on usage of course).
Done in cd15758
from testparameterinjector.
Hi!
Thanks for letting me know.
The behavior you are seeing surprises me, because we have a unit test since 2020-08-05 that tests that
@Test
public void withFloat(@TestParameter({"1.2", "2"}) float param) {
testNameToParameterMap.put(testName.getMethodName(), param);
}
gets the test name
"withFloat[param=2.0]"
which seems to match your use case.
(I can't link to the test because it is removed when exporting to Github due to a dependency on textproto parsing)
I suspect this may be a combination of a change in TestParameterInjector and your JVM being different (e.g. Anroid vs openJDK).
from testparameterinjector.
Hmm, scrap that. Even before this library was open sourced, we had a unit test that ran on an Android emulator that checks that @TestParameter({"1.2", "2"}) float param)
gives "withFloat[param=2.0]".
Since May 2022, we extended this test with multiple Android versions, starting at SDK version 15.
So that's probably not it either.
from testparameterinjector.
it's very likely that this had an unintended behavior change:
e390bab#diff-f0f3c84fc90c4da3bd5e1267e7b74d5774029389e86dfe1bba895740b8b886d0R142
(just reading this now)
It feels like it can't be a coincidence, I agree.
In your case, since parameter names are not present and the value is not an array, it should change value()
to valueAsString()
, which in turn becomes String.valueOf(value());
.
So then String.valueOf(value())
should give a different result as MessageFormat.format("{0}", value())
.
From the documentation of MessageFormat
, it seems like it uses something like NumberFormat.getInstance(getLocale()).format(argument)
to format the float. That could explain why you are seeing a different result than the Google test infrastructure.
If that's the case, I'd argue this is actually an improvement because it makes the result independent of the locale.
from testparameterinjector.
Ok, I'd say fair evaluation, nice! :)
Would you mind adding a hint in the changelog as this is a "breaking" behavior change (depending on usage of course).
from testparameterinjector.
Oh, btw my execution is on JVM, not Android devices. Paparazzi is amazing tech!
from testparameterinjector.
Related Issues (20)
- Build fails with firebase dependency HOT 3
- Support JUnit 5 HOT 27
- Support non-number floating point values HOT 2
- Support tests written in kotlin with parameter types that are `@JvmInline` value classes HOT 4
- Wrong transitive dependency protobuf HOT 3
- Feature request: shade protobuf dependency HOT 6
- JUnit 5: Support `@Nested` classes HOT 5
- Run in Firebase Test Lab HOT 2
- Feature request: Expose `PluggableTestRunner` HOT 2
- Trying to run the test but nothing happened
- How to be inject parameter into the test class constructor HOT 2
- How to set custom name for `@TestParameter` HOT 2
- Running a single test using maven verify HOT 2
- Does this work with Powermock libraries? HOT 12
- test execution time is not accurate HOT 10
- Non-static method support for dynamic parameter generation HOT 10
- Run a single test in IntelliJ HOT 12
- Consider keeping a changelog? HOT 1
- Can't use more than one `TestParameter` annotation with Android Instrumentation tests. HOT 8
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 testparameterinjector.