How do you do Unit Testing in B4A?

kcorey

Member
Licensed User
Longtime User
I'm progressing well writing on my first B4A app, and I'm in the middle of writing the AI for the computer.

As is normal, this is throwing up issues I hadn't considered before, suggesting sweeping changes to base parts of my code.

Up to now I could just run a little bit, and see if it broke. As development progresses that's taking longer and longer.

I'd like to automate the unit testing to guard against regressions, but I don't see anything built-in to B4A's IDE to provide for that...so that this point I'm considering a hidden testing mode within my app.

Can anyone out there tell me their automated testing methodology for B4A?

:sign0163:

Do you have a hidden testing mode in your app?

Do you write target-specific code (debug/release/release-obfuscate)?

Is there a clever use of modules that I don't yet understand?

Since B4A compiles down to Java as an intermediate step, can we hook into java unit testing tools?

Thanks,

-Ken
 

kcorey

Member
Licensed User
Longtime User
Classes and unit testing...

Ah, okay, I understand about classes.

I guess I was wondering if there's a way to kick off a testing cycle, maybe from the IDE?

Is there conditional compilation? If that's the case there could be another target 'UnitTest', and in the code that is only compiled when this is in effect, I can kick off testing.

Otherwise, maybe in Android one could create another activity that responds to a "unittesting" intent, that can call the various bits and pieces of the app to exercise it.

Finally, I suppose I could put the testing code in my app tied to a button, and as part of the release cycle just hide the button. I don't like it for several reasons, but it'd get the job done, I suppose.

Surely someone has come up with a better plan than that?

-Ken
 
Upvote 0

jgmdavies

Member
Licensed User
Longtime User
@Ken

Did you get any further with this please?

I've used various UT frameworks in the past, e.g. for Delphi, Arduino, .NET - bit surprised that nothing leaps out for B4A.

Regards,
Jim
 
Upvote 0
Top