Can i use TDD in android developing process? - android

I am a newbie to android. And feels like TDD can reduce developing time a lot. But after learning android's junit test framework, find it a bit difficult to achieve the goal that write test before coding. Especially when i want to test module like adapters, views and databases. So i wonder it's because i am not familiar with android test framework enough or android is not suitable for TDD.

Sure.. :-) In general TDD approach can be used for developing Android apps too. But not always worth.
It sometimes needs more effort, so you should consider the pros and cons carefully. I think you should not force to do every little part of your development process to be test-driven, but consider using it every time before you start typing. I prefer mixing TDD with test-last approach.

You can try by using robolectric https://github.com/pivotal/robolectric
and here is sample https://github.com/pivotal/RobolectricSample

Related

Testing android apps with TDD vs Debugger

I would like to ask something interesting. When I am developing native android apps,and want to make sure that there no null objects,I use the debugger as shown.
So I put a break point in the line I want,I step over my code and the fun begins:). However,there is this TDD,which I have never used. Are they any specific tools for that? Is it more efficient?
Regards,
Theo.
TDD is generally a better approach as it stands for Test Driven Development and its idea is to have reproducable tests to validate your code against. A good way to do so is to read youself into JUnit which is also included in Android Studio.
EDIT: Also TDD is generally more Efficient as you notice errors much earlier and you write better code

Android Netbeans Blackbox, Whitebox, or both Test Driven Development

I'm working with Android in Netbeans and trying to decide which testing framework to implement for my application (I've never done TDD in Android before). I've been using this thread to look into different resources. I'm mainly familiar with whitebox, so I feel that I would be more comfortable with the built-in Instrumentation Framework. However, this is the first time I've heard of blackbox testing (Robotium), but it looks like it would be really useful as well. Is it common practice to implement both whitebox and blackbox tests? Or is only one really necessary? If both, what things are best to be whitebox tested and which are best to be blackbox tested? Or is this a totally useless question as it's completely application dependent and I should just pick one and start messing with it?
[EDIT]: I also want to add that I don't have any experience with JUnit since a lot of explanations seem to assume a basic understanding of it.
The two options you suggest (Instrumentation and Robotium) are actually pretty much the same thing, the closes to whitebox (or true tdd/unit tests would probably be roboelectric).
Is it common to do both? Yes i think that is usually a good approach normally you want to test things as low down as possible and then have fewer of the big blackbox tests, android doesn't make this the easiest if you ask me though so you may have more luck with the instrumentation/robotium tests cases as these are fairly easy to understand and they match up with what you can see on the screen fairly easily.
With regards to junit, android is bundled with junit3 which has much less features/complexity as jUnit4, and for the most part the only thing you will need to know is to name your testmethods with the word "test" in front of it e.g. public void testXXX().

Display stock portolio in android with clojure

Would writing an Android stock portfolio display app in Clojure be a good learning exercise? I'm totally new to Clojure. My impression is that the functional programming style of Clojure might be better suited for other applications and platforms. For example, I can't find a Clojure based open source project to start from. It looks like I should call a Java charting library such as GraphView and look to port a Java open source stock graphing project?
It will certainly be a good learning experience, though it may not be a pleasant experience.
Clojure On android is not the most common learning path, though everyone makes their own way,
so I don't mean to discourage you :)
If your Totally new to Clojure a webapp is a very popular choice of first real project (and can be made to work nicely from android). Also check out 4clojure.com
Writing android apps in clojure isn't straightforward, although there are some people working on fixing that (GSOC I think), so you'd learn how hard it is :)
If you want to learn clojure, you better start with something which does not involve android.
If you want to learn android, you better start doing so in java.

How are Android-Binding and Roboguice?

As a beginner for Android development, code samples I am learning from look somewhat disorganized and are hard to test or even to understand. So I followed this post suggested: Using Dependency Injection with Roboguice? and am trying to use Android-binding and Roboguice. But I am now worrying about how good they really are.
Are they good enough for all Android projects including ones with a couple of views?
After building an app with these tools, how is the app's performance in comparison without the tools? Any problem with using these tools?
Is there any other tool that can help me for Agile/TDD?
I've only used Roboguice and this is my opinion of it.
Roboguice is derived from Guice. So it's not really a dependency injection framework built from the grounds up for mobile environment. That being said, it can cause quite some overhead to your app.
On the other hand, I haven't seen any mobile app that reached a complexity that really needs dependency injection. I had an app the used Roboguice, but soon I realized that it's making my app more complex than it needs to be. So I stripped it out. I guess this depends a lot on the scale of your app.

Starting Android Development: Native or cross-platform?

I am an experienced professional programmer who wants to delve into Android programming. I also wish to investigate cross-platform programming using tools like PhoneGap or Titanium.
However, I am a bit in doubt of which learning strategy is best.
One approach is to get a good feeling of the Android environment and later on explore the possibilities of the cross-platform tools.
Another approach is to jump start using say Titanium (which to me looks like the better option of the two mentioned) and then after a while look into the underlying Android building blocks. The reason why this approach seems worth considering is that although I have earned my living on programming for 20 years, I have no experience whatsoever with Java. And the feeling of getting something done has always been encouraging to me.
What do you think? Does option 2 make sense, or would it be more sensible to get an understanding of the Android environment first?
Thanks in advance,
Martin
I think that all depends on what will you develop:
If you want to develop simple interfaces (parsing XML/Json/...) with some forms and nice transitional effects, then Titanium is yours.
However, the most advanced functionalities aim the iOS platform. For example, the augmented reality module or the push notification are not supported for Android.
On the other hand, if you want to develop advanced interfaces (Games for example), then you have no choice: Android SDK is the best way (you can use Flash for Android but it doesn't support very first Android OS versions).
In all cases, you have to understand how the Android platform works.
I had a similar decision to make, although I am not an experienced programmer like you with vast experience , I had no java knowledge and I needed to write an android app for a project in grad school ,and i'd tend to agree with you on which is the better option , although reading the dev guide and grasping the basics will be a must. And like Zakaria says , it also depends on what you plan to develop.
in my case I learnt basic java first , then used the SDK for my project. Its not that big a learning curve actually , I did not find too many problems with the API.

Categories

Resources