Coming from Typescript using Jest there I could send the --watch flag and every time I changed the test file the test will automatically run.
Is there something similar with Android Studio using JUnit5 ?
This can be achieved using Gradle 6.7 or higher. Adding --watch-fs enables Gradle's fs watcher. You might want to also include -Dorg.gradle.vfs.verbose=true to get more information about the virtual fs state and events it received.
Example to run tests:
./gradlew --watch-fs -Dorg.gradle.vfs.verbose=true test
Related
Having an android library project working fine with AS 4.1.2.
Just installed Android studio (fox) 2020.3.1 patch 3 without change anything (except set the sdk jre to java 8, version 18.6.0_60, since the project is using JavaVersion.VERSION_1_8).
with new AS(fox) the build and run is fine, but the it has issue with unit test and coverage test.
when run unit test, the test will pass but showing some error log:
Caused by: java.lang.IllegalStateException: Cannot process instrumented class com/push/NotificationManager. Please supply original non-instrumented classes.
when try to run the coverage test, it can only do it through the Rnu xxxtest with coverage
not like in AS 4.1.2, it can run the coverage test from Gradle pane/tasks:
also in AS 4.1.2 it could view the coverage test report in the build/report/jacoco folder:
While in new AS(fox) it fails a lot with test events were not not received
and in new AS(fox), in the build/report folder, it could not find the jacoco folder for the result (the html file tells what is the coverage test result, i.e how is branches covered).
the related dependencies:
Gradle: classpath "com.android.tools.build:gradle:4.0.0"
distributionUrl=https://services.gradle.org/distributions/gradle-6.8.3-bin.zip
test:
classpath "org.jacoco:org.jacoco.core:0.8.1"
testImplementation "junit:junit:4.12"
testApi "org.robolectric:robolectric:4.3"
Question
How to resolve the Please supply original non-instrumented classes error in AS (fox)?
How to resolve the test events were not not received?
Where is the jacoco coverage test result html, which shows the coverage percentage details?
Using Visual Studio 2019, I have downloaded all the dependencies needed to run NodeJS scripts and all works well. I can only run each .js script from VS (Ctrl+F5), but I want to know whether its possible to run a series of scripts like I would normally do via command prompt using npm start, but in real-time through VS? It's very important to me that I do not modify any script file in order to make this work, but rather let VS do the job instead of npm start, if It's possible at all.
I already have a project setup which I can successfully run via command prompt with npm start, but can I run and debug it with VS?
My main goal is to get any console output and even use breakpoints, aka. properly debug my code.
Actually, in VS IDE, there is a default node js project template that Microsoft provided.
You only have to install the workload Node.js development on the vs_installer so that you can use that template.
I think you should create such project template which follows the rule of VS IDE with node.js. And then migrate your old project's content into this new project.
Note: in this project, there is no such easy way to start several js files at the same time unless you nest nested js methods in the starting js file. And other types of projects do the same.
If you want to debug other js files, you only need to right-click on the file on the Solution Explorer. Every time switch like this, you can debug other js files.
You do not have to use npm start in this way and just click Debug to debug the project.
I am not sure about Visual studio, but you can debug on Visual Studio Code.
you can debug from run menu.
I use latest version of Orchard
I enable codegen with two mode: Command-line or UI
however I got the succeed message : codegen was enabled
but when I want to create module such as: codegen module MyModule
I encountering with this message:error executing command "codegen module MyModule"
No command found matching arguments "codegen module MyModule"
?
I had this same issue. I am running version 1.10.1 from a fork of the git repo.
You might have to blow away your database if you attempted to install it already and it is in an inconsistent state. If this is not an option you will need to manually remove it from the db and potentially a manifest file, I can't guide you on that.
Ensure you have run the application and completed initial setup (cooked a recipe).
Close visual studio and any other applications that might have a file lock in your Orchard.Web directory.
Run the orchard command line tool ...\Orchard\src\Orchard.Web\bin\orchard.exe then call feature enable Orchard.CodeGeneration
Ensure the codegen commands appear when you type help commands to confirm successful install.
i've renamed my test folder to "test". Before it was set to AndroidTest and everything works. But i have a task from my superior that the test folder must be called "test". After i renamed the folder to test in android studio the test stopped running so i went into the run configuration for the test and specified teh package name but that did not help. Here are some details on issue:
and here is the build configuration i am running for the test:
The manifest does not have anything about test in it. This is just a dummy project i made. Do i need to enter something in the manifest ?
After reading the article provided in the comments i thought i'd share how one might resolved the issue:
Android studio does not know how to respond to our test runner unless we tell it. so i made a gradle task like the following:
when you run this gradle task it will run all test cases.
To explain, here we will cleanTest (which cleans all previous tests) then we will run the test task (its like doing gradle test on command line to run test). The test dont run again if they are successful so if you give it the option of --rerun-tasks then it will return the same test task. As for the --tests * option its used to specify which tests you want to run. in my case it was everything but you can specify a class path or even down to the method level here. very useful. so its like running this on the command line: gradle test --rerun-tasks
I try to run my first Spock Test inside Eclipse, and it does not work.
I added all the Maven dependencies and plugins in my pom.xml, but when I run my test with jUnit, there is a popup windows with this Warning message : "No jUnit tests found".
Did you already seen this kind of message ?
What config has to be done, in order to run a Spock Test inside Eclipse ?
Thanks a lot.
Its same as running Junit test cases.
Right click on the class and run as 4Junit Test runner. see below for complete configurations and running the spock test.
Running Spock Framework with Eclipse, Gradle, Groovy: Source -
Krzysztof Goralski, blog
-Install Gradle Plugin, check it here
-Install Groovy-Eclipse for Juno or Indigo from Eclipse Marketplace (or maybe Groovy/Grails Tool Suite for Eclipse)
-Install Spock Plugin From Eclipse Marketplace if you want, check it here
-Import Project to Eclipse through Gradle Import
-Add these lines to build.gradle:
apply plugin: ‘groovy’
testCompile ‘org.spockframework:spock-spring:1.0-groovy-2.3’ (for Spring)
this is quite important, version can make some conflicts
-After this *.groovy and *.gradle files will problably looks different, Syntax colour highlightning etc. Remember that you can right click on for eg. build.gradle -> Open with -> Open With Minimalist gradle Editor etc.
-Probably you will need to make additional folder for *.groovy test files
Create new *.groovy file, class
-Basic test example, extends Specification from Spock framework and needs specific Annotations when running with Spring
-Now you can run it with JUnit from Eclipse
For integration tests you can’t use #RunWith(SpringJUnit4ClassRunner.class), and Context should looks like here #ContextConfiguration(locations = [ “/restTestContext.xml” ]) , not {} braces, but [ ]
-Spock can be used for Mocks too. Something like this: Subscriber subscriber1 = Mock() , subscriber1.isActive() >> true , So, remember >> operator for mocks.
Right click on the project > Properties > Java Build Bath > Add External Jars and add spock-core-0.6-groovy-1.8.jar and check if Groovy Libraries are there in Build Path or not. If not click on Add Library and select Groovy Runtime Libraries and restart Eclipse. Now you should be able to run. If still can't Run then try creating New Configuration and change the Test runner to Junit4 and Run it...
Check if the folder your tests are in is a source folder.