How can I unit test a gluon mobile application? - gluon-mobile

I have created a "Gluon Mobile - Multi View Project with FXML" using IntelliJ. Now I would like to write junit tests for code residing in the main directory, additionally I would like to write unit tests for platform specific code residing in the android, desktop and ios folders.
I managed to write unit tests for the main code by adding a src/test/java folder. Those tests get automatically executed when building the project.
But how can I add platform specific unit tests and integration tests? What do I have to add to build.gradle to make the jfxmobile-plugin know and execute those tests?
Any help is very much appreciated.

Related

How to write integration tests in Xcode?

There are three basic layers of testing:
Unit test — making sure each function/unit of code works as expected
Functional test — making sure units interact with each other as expected
Integration test — making sure our app integrate with other app/api/services as expected
I can handle cases 1. and 2. using Xcode's iOS Unit Testing Bundle and iOS UI Testing Bundle I don't know how to write tests from point 3.
I would like to write to tests to check if me app correctly integrate with backend, BLE device, etc.
Note that I have already written unit tests which I run using CI.
Integration test should not be run in CI because it depends on external environment. I would like to run its only manually.
How to handle it in Xcode? Second Unit Testing Target? Any advice? How are you dealing with it in yours systems?
Depending on the style of integration test that you are after you may want to use dedicated a unit or UI tests target.
From your question I'm guessing the style you want to have leans towards black box testing with other real systems. If that's the case a dedicated UI tests target would do the job.
With UI tests you can do stuff like opening other apps on the device and test how your app interacts with them. For example, this post shows how to write a UI test that uses the Messages app to test Universal Links.
I'd reach for using a dedicated unit tests target only if you need to control part of the code in your app, for example stubbing network requests. But that doesn't really fit with the definition of integration test you have given.

Code coverage of Vue files in Rails project

In existing Rails+Vue.js (with webpacker) project we have plenty of feature tests (Capybara tests).
At the moment we can only see code coverage of ruby code.
Is there a way to setup code coverage for Vue/Javascript code without writing JS based tests from scratch?

How to test dart pub lib package before deploy?

what is the best way to test a pub lib package before deploy, as if I had downloaded it via pub install? (not talking about unit tests)
You can use path packages. Instead of going through a pub server this will fetch the package from the local filesystem.
It very much depends on the type of package you are looking to use.
If the pub package is primarily a non-UI library then you should be able to exercise its API via a UnitTest script, a small script that has a main to kick off a bunch of unit tests (grouped or otherwise).
Another option for a non-UI package is to find the source project (usually noted in the package's page on pub.dartlang.org) and download it, where if you're lucky there will be a test directory with a unit test script in it.
Some UI providing packages do include unit tests in their project too.
A lot of projects include an example or two you can run to see how it works and pick up some tips from their source code, so I encourage you to check out the original source of the project you're interested in.
But generally (especially for UI providing packages), you're going to get best results by creating a small skeleton app for the purpose of playing with the package and then apply what you learn to your main application.
Hope that helps.

Is it possible to perform GUI testing using Xcode Unit test

I would like to perform the following iPad/iPhone testing scenario automatically:
Tap Edit box A
Type text "abcd"
Verify button B is high-lightened
I understand UIAutomation 4.0 allow you to write a simple JavaScript to perform the above steps. However, UIAutomation does not have test infrastructure ready. For example it lacks testing macros to show if any tests failed and does not have a clear way to run setup and shutdown for each test cases.
That is why I look back to XCode unit testing. Logic tests won't work for me. How about Application tests?
Basically, I am looking for something that can do GUI testing and at the same time has test infrastructure. It is even better if it can be integrated to continuous build environment.
Check out Zucchini. It's just come out and I saw a demo at a recent YOW! conference. It's basically a BDD testing framework that uses coffeescript for scripting and runs against an actual device. It's also fully runnable from CI servers which makes it perfect for agile teams.
I haven't run it myself yet, but it seems to exactly what I'm looking for and No I don't work for PlayUp :-)

Good test runner for OCUnit/XCode Unit Tests

Is there a good GUI based test runner for the OCUnit/XCode 4 unit testing frameworks? I'm looking for a redlight/greenlight type GUI, maybe something that looks like the NUnit test runner. I found OCRunner, but it looks like it hasn't been maintained since 2009. It's unfortunate, because OCRunner looks like it was exactly what I was searching for. It loads on Lion, but I can't get it to pick up my test bundle and run it.
Any suggestions for an alternative or a way to get OCRunner to run on a unit test bundle against an iOS project?
*FYI - I'm running XCode 4 with the default unit testing bundle template
You should use GHUnit.
I've also managed it to run it automatically under Jenkins with the iOS Simulator. GHUnit can also export Jenkins valid XML's (JRun).

Resources