Comments (4)
But only public classes/functions are ever tested by design. Which class would you like to test? Please explain a bit more about this "problem".
from jadb.
For example - see this cross-repository comparison of #38.
Shortly - I want to implement getprop
command of android device.
To make this feature testable I separated this functionality in 2 parts:
- executing shell command
- parsing
inputstream
as a result.
This allows to test most complicated part without overriding executeShell
method
Not to put garbage in module interface only actual getprop
method is public and parseProp
is not.
To actually call this method I need package level access which can be achieved only if test have the same package name as testable
class
P.S. Unit tests philosophy (as I understand - I may be wrong) is to test as little parts of the system as it is possible to reduce interference of different bugs from different modules. So if part of the system is implemented in package local class - it is no problem to test it alone even it is not visible for clients
from jadb.
I see, I think it would be a much cleaner solution to just mock the public interface. That way you test behavior rather than implementation. The latter is less likely to change, and if it does change you want to change the test. Pros:
- Calls the function exactly as a user of the library would.
- You can also assert what the actual command was, e.g.
getprop
- No need to expose internal (default visible) methods.
- No needs to mix integration and unit tests.
Disadvantage:
- You will need to extend the FakeAdbServer to also handle
executeShell
output. I can probably help out with this.
from jadb.
Plan B - Just make the getprop()
function public
from jadb.
Related Issues (20)
- Is "adb forward tcp:80 tcp:80" supported? HOT 1
- Android 10, exception in PackageManager.forceInstall(...)
- Quoting is insufficient HOT 1
- executeShell only executes command when input i HOT 2
- .executeShell doesn't work with large commands and multiple arguments HOT 2
- Could you make a new release, please? HOT 3
- Last modified time isn't propagated to the device properly when pushing HOT 1
- SELinux is blocking apk install from /sdcard/* HOT 1
- Trying to connect android with android HOT 3
- execute command not working with mutated vowels (german umlaute) HOT 6
- Provide deterministic module name for Java 9 module support HOT 4
- iOS version for this library or similar HOT 4
- RemoteFile.getPath() doesn't work as intended? HOT 1
- Do I need to manually close any connections or devices? HOT 2
- How does the server module work? HOT 1
- screencap not pulling and working HOT 1
- Is it possible to support exec-out ? HOT 1
- Dependency 'com.github.vidstige:jadb:v1.2.1' not found HOT 4
- device state change offline HOT 1
- java.io.EOFException HOT 1
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 jadb.