ehubscher / briarproject_390

Concordia University Mini-Capstone (i.e. SOEN 390) project for Team La Famiglia. The Open-Source Project forked is an Android-based secure messaging app called Briar.
Other
4 stars 1 forks source link

As a developper, I want to have automated UI tests so that I can test the application as a whole #117

Open BenjaminTanguay opened 6 years ago

ddicorpo commented 6 years ago

There are issues with running UI tests with Briar because Briar uses ProGuard.

Proguard is used to shrink your code, which in turn, detects and removes unused classes, fields, methods and attributes from the project.

UI test frameworks that I tried. Espresso: Upon writing my test class, proguard was an issue since gradle was trying to shrink my code and it didnt work. This caused proguard to throw an error. I even went into the gradle file to manipulate the proguard setting to disable it, and to completely remove the proguard file, with no luck.

UIAutomation: This framework had potential since writing the tests were much easier than espresso but there was still the issue of proguard. I consulted google and their only option was to remove the file and gradle "should" forget the filepath.

In conclusion, even when removing the proguard file, i believe that it is used elsewhere in Briar that I am unaware of which is causing my tests to crash. UI testing is nit possible unless there is a workaround to proguard.

I will keep looking for alternatives while doing other tasks.

ehubscher commented 6 years ago

For the Past couple of days I've been struggling with Appium, it runs on top of UI Automator, but it seems to be failing for a whole other reason. What I did was follow the steps in the getting started guide on the website at : http://appium.io/docs/en/about-appium/getting-started/?lang=en#getting-started

I installed the dependencies globally as it asked. As a helper, I downloaded Appium-desktop and ran the server in a separate and then ran the script from the getting started guide and it keeps giving this error:

[Appium] Welcome to Appium v1.7.2 [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platformName":"Android","platformVersion":"8.0","deviceName":"Android Emulator","app":"..\\..\\..\\..\\..\\build\\outputs\\apk\\debug\\briar-android-debug.apk","automationName":"UiAutomator2","requestOrigins":{"url":"http://webdriver.io","version":"4.12.0","name":"webdriverio"}}} [MJSONWP] Calling AppiumDriver.createSession() with args: [{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platformName":"Android","platformVersion":"8.0","deviceName":"Android Emulator","app":"..\\..\\..\\..\\..\\build\\outputs\\apk\\debug\\briar-android-debug.apk","automationName":"UiAutomator2","requestOrigins":{"url":"http://webdriver.io","version":"4.12.0","name":"webdriverio"}},null,null] [BaseDriver] Event 'newSessionRequested' logged at 1522637016013 (22:43:36 GMT-0400 (Eastern Daylight Time)) [Appium] Creating new AndroidUiautomator2Driver (v0.11.0) session [Appium] Capabilities: [Appium] javascriptEnabled: true [Appium] locationContextEnabled: true [Appium] handlesAlerts: true [Appium] rotatable: true [Appium] platformName: Android [Appium] platformVersion: 8.0 [Appium] deviceName: Android Emulator [Appium] app: ..\..\..\..\..\build\outputs\apk\debug\briar-android-debug.apk [Appium] automationName: UiAutomator2 [Appium] requestOrigins: { [Appium] url: http://webdriver.io [Appium] version: 4.12.0 [Appium] name: webdriverio [Appium] } [BaseDriver] The following capabilities were provided, but are not recognized by appium: javascriptEnabled, locationContextEnabled, handlesAlerts, rotatable, requestOrigins. [BaseDriver] Session created with session id: 1fd828e6-3559-477d-8b84-6fc1734f1cb9 [BaseDriver] Using local app '..\..\..\..\..\build\outputs\apk\debug\briar-android-debug.apk' [UiAutomator2] Deleting UiAutomator2 session [MJSONWP] Encountered internal error running command: Error: The application at '..\..\..\..\..\build\outputs\apk\debug\briar-android-debug.apk' does not exist or is not accessible at Object.configureApp$ (C:\Users\jordan.hubsher\AppData\Local\appium-desktop\app-1.4.1\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\helpers.js:39:13) at tryCatch (C:\Users\jordan.hubsher\AppData\Local\appium-desktop\app-1.4.1\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\jordan.hubsher\AppData\Local\appium-desktop\app-1.4.1\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\jordan.hubsher\AppData\Local\appium-desktop\app-1.4.1\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js: 100: 21) at GeneratorFunctionPrototype.invoke (C:\Users\jordan.hubsher\AppData\Local\appium-desktop\app-1.4.1\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37) at [HTTP] <-- POST /wd/hub/session 500 77 ms - 265

ehubscher commented 6 years ago

I've been reading online and StackOverflow, and even the guide is very simplistic and vague, almost too good to be true. Nothing regarding these sorts of errors are remotely helpful.

Winterhart commented 6 years ago

This issue will continue on in Iteration 6

ehubscher commented 6 years ago

        It seems that unit tests accessing UI features weren't working because they needed to use the Android Support Test library and the Instrumentation Registry. In order to do that, the gradle build needed to be configured for the instrumented test libraries using androidTestImplementation (newer version of androidTestCompile) as opposed to testImplementation (newer version of testCompile), or even implementation (newer version of compile) for "com.android.support.test:rules:1.0.1" and "com.android.support.test: runner:1.0.1".

        To configure AndroidJUnitRunner as the instrumentation test runner, simply add testInstrumentationRunner to the defaultConfig block in the build.gradle file (in this case, all the changes apply to briar-android module sub-project).

        With that, I added the androidTest directory and mimicked the underlying directory structure identical to the test and main directories as well as matching package names and scope.

//TODO: Extend the default global application class to include MultiDex support (already configured in build.gradle for briar-android module, but the rest needs to be configured through a POJO.).