XUnit Debugging Fails in Resharper - resharper

I've got a new project with XUnit tests, and they'll run just fine in Resharper's test runner. However, when I try to debug one of those tests, I get an error:
"Cannot launch debugger. Error Code: 897100016. Error Message: 0. Error Info: 0"
Also, the error message sometimes changes from 0 to 198255
After this error, the test runner hangs in a pending state until I manually quit the test run.
I've added "Debugger.Launch();" to the XUnit test, and there is no change. I've also updated my target references in the JetBrains.ReSharper.TaskRunner.CLR4xxx config files, though that seems to have been an error with Resharper 5 builds.
I've created the same test in NUnit, and debugging works fine.
I've got VS2015 and Resharper Ultimate installed, running XUnit 2.20. Target framework is 4.6.

Related

Flutter Integration Test run/debug configuration in Android Studio

I am trying to run/debug some integration tests on a flutter project. my tests are running fine when I run "flutter drive --target=test_driver/app.dart" on my project.
I am trying to create a Debug configuration in my Android Studio as per following steps in the StackOverflow answer-
How to automate Flutter Integration testing command?
however, when I try to run the test with this configuration I get the following error
Any pointers about how this can be resolved?
Removing Break points and Flutter clean did not yield any results
00:00 +0: Flutter Driver demo (setUpAll)
[info ] FlutterDriver: Connecting to Flutter application at http://127.0.0.1:55319/L_Bm--V4Kjg=/
[trace] FlutterDriver: Isolate found with number: 283666305
[trace] FlutterDriver: Isolate is not paused. Assuming application is ready.
00:00 +0 -1: Flutter Driver demo (setUpAll) [E]
JSON-RPC error -32601 (method not found): Method not found
package:json_rpc_2/src/client.dart 110:64 Client.sendRequest
package:json_rpc_2/src/peer.dart 68:15 Peer.sendRequest
package:vm_service_client/src/scope.dart 64:23 Scope.sendRequestRaw
Run Configuration is as follows
Checking the logs and your setup, the run config is fine and works without issues. The issue here is caused by a "Method not found" error thrown by json_rpc_2. Trace where the error is thrown from your test, and see if this could just be an unhandled Exception that causes the issue.
Another workaround here is to set up flutter drive as an External Tool, and configure created External Tool to run 'Before launch'. Note that the path set on 'Program' points to the Flutter SDK.
This works well for me, and using this approach, you won't need to set a VM_SERVICE_URL Environment for your flutter drive run config.

Android Build Failing with Command, but not in Android Studio

I'm learning React Native and all of sudden my Android build has started to fail. When I type the command 'react-native run-android' the build fails with following error
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
java.lang.NullPointerException (no error message)
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s Could not install the app on the device, read the
error above for details. Make sure you have an Android emulator
running or a device connected and have set up your Android development
environment:
https://facebook.github.io/react-native/docs/getting-started.html
I have closed and re-opened the terminal, emulator, and Android Studio and made sure that the emulator is running before typing the command. But the build still fails. However if I go into Android Studio and click the 'Play' button (Run App), and the build succeeds and my App is displayed on the Android emulator.
I have also tried copying my project to another folder and all of the same errors still occur. Not a pressing issue, more just of an annoyance so if you have any suggestions that'd be great :)
Same error occurs for me when i change gradle version in build.gradle file.
This error of NullPointerException occurs when the version in build.gradle does not match the version installed in your project root folder.
Then change to the same version resolved the error.

Test failed to run to completion. Reason: 'Instrumentation run failed due to 'java.lang.IllegalArgumentException'

I get this error when I build Android Studio project from Jenkins.
Starting 6 tests on test10_googleAPIs(AVD) - 4.1.2
com.MobileTornado.sdk.newclient.screens.login.MessageScreenTest > AAA_signIn[test10_googleAPIs(AVD) - 4.1.2] [31mFAILED [0m
Test failed to run to completion. Reason: 'Instrumentation run failed due to 'java.lang.IllegalArgumentException''. Check device logcat for details
Tests on test10_googleAPIs(AVD) - 4.1.2 failed: Instrumentation run failed due to 'java.lang.IllegalArgumentException'
:new-client:connectedDevDebugAndroidTest FAILED
The code is compiled, then starts running the tests from the project and then falls.
I use here gradle, junit, espresso and emulator.
In addition, when I build the project on Windows machine, it's successful. But with the Linux machine(centOS) failed.
I searched for an answer all over the net. Some offer to change the code. But it's a very big project and the code run on windows machine.
Any suggestion?

Running unit tests doesn't catch changes

I'm going through the kotlin koans repo (https://github.com/kotlin/kotlin-koans). Whenever I make changes to my .kt files and run the unit tests, the changes in the .kt files aren't reflected in the test results. I've been getting around this by running ./gradlew build before running the unit tests.
I'm using Android Studio as my IDE. Any idea what's happening?
There is bug in Android studio.
https://github.com/Kotlin/kotlin-koans/issues/90
https://youtrack.jetbrains.com/issue/KT-18948
When you are running test, project doesn't recompile.
You should build project and then run tests again.

Failed to start : Class not found: "class name" - JUnit, Robolectric

Am developing unit tests using JUnit and Robolectric, occasionally my Android Studio throw this error - Failed to start : Class not found: "class name". Process finished with exit code 1. Why is this happening. Sometimes restarting my studio works, sometimes it works right away.
EDIT : I see this issue when I switch between Android app and Android Unittests
Try cleaning the project and rebuilding it before running test cases.

Resources