Hi I'm absolutely new to testing and I have no idea how to add karma to your projects using command line. I actually have no idea how to access my projects using command line and then add Karma test runner to it to test the code. Can someone please help me out ? Thanks
Related
I have a LibGDX project with some tests. The structure is as follow:
core/src -> for my java sources code
core/test -> for my tests source code
core/assets -> for all my assets
When I run the tests from eclipse, they all go green but whenever I try to run them from the gradle command line (./gradlew test) I get an error with the assets folder. I believe this is because the tests are not launched from the assets folder as it is from eclipse.
How can I solve this problem ? Is there a way to tell gradle to use core/assets as the workspace directory when running the tests ?
Here is the error I get:
com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load dependencies of asset: myasset.png
I found a way to achieve what I wanted. I post my solution here for anyone that might need it. There is a property named workingDir for the test task in gradle. So I just needed to set it to the right folder. Inside the build.gradle file of your project (the root folder) just add the following section:
project(":core") {
apply plugin: "java"
// Add the following test section
test{
workingDir= new File("/assets")
}
// Rest of the file
}
That's it! My tests are running green from the command line now.
I have this build :
It works fine. The only issue is that the Test Results are overridden. So I actually end up with the test results for the last test project executed.
This is executed by build engine;
C:\Program Files\dotnet\dotnet.exe test C:/agent/_work/4/s/test/Services.UnitTests/project.json --configuration release -xml ./TEST-tle.xml
C:\Program Files\dotnet\dotnet.exe test C:/agent/_work/4/s/test/Web.UnitTests/project.json --configuration release -xml ./TEST-tle.xml
What could help:
1) having "dotnet test" generate XML output file - did not find a way how to do that
2) Use a variable for -xml output file in Build Task. That variable could be a random string/number or just a project name being tested - like what Build engine feeds to "dotnet.exe test". No way how to do that.
Any ideas? Thanks.
I think that, although you're running the task against all of the projects in one go, as the .Net Core (Preview) task doesn't have a working directory, that the test results are being generated at solution root (or similar) and done for each project in turn.
I set mine up using simple command line tasks...
Tool: dotnet
Arguments: test -xml testresults.xml
Working folder: {insert the folder for the project to test here}
These work fine but I have one set up for each project. You could try creating a task for each library and adding the full path to the test results argument (or name them appropriately as starain suggested).
This feels like a minor bug to me.
Based on my test, it doesn’t recognize the date variable as Build Number.
To deal with this issue, you can add another .Net Core (Test) step to run xunit test with different result file.
For example:
In WebStorm 11 I want to create a run configuration which runs all dart tests in my project.
However there is no option to do this in the "Dart Test" configuration template. The only options are:
Test Kind: All in file, Test group, single test
Test file: must point to a .dart file, otherwise I get "Dart file is not found"
VM Options (text input)
If I point WebStorm to a single test file this command gets executed in the test window:
C:\path\to\dart\bin\dart.exe --ignore-unrecognized-flags --checked --trace_service_pause_events file:\\\C:\path\to\dart\bin\snapshots\pub.dart.snapshot run test:test -r json C:/path/to/project/test/someclass_test.dart
I don't want to create a run configuration for every unit test class I write, there must be a better way.
Currently I prefer to navigate to the project directory and just run
pub run test:test
This runs all tests which live in files ending with _test.dart which is perfectly what I want. More info here: https://github.com/dart-lang/test#running-tests
Is there no such option in WebStorm for dart developers?
Accordingly to WEB-14747 ticket this functionality is already implemented for the next major version.
You can try latest EAP build of WebStorm v12 here.
I guess that's currently not supported.
The feature to run tests this way is quite new anyway.
If you think this feature is important, lease create a feature request in https://youtrack.jetbrains.com/issues/WEB
I am using the new SpriteBuilder (was Cocosbuilder) and Cocos2d-v3 to build an interactive book. It is my normal practice to code using unit tests and I want this project to incorporate XCTest.
So far I have gone to the test navigator in Xcode, hit the '+' at the bottom and added a test target per Apple's documentation. Xcode then created a test target and a sample test class (just a .m file with a failing unit test).
I commented out the textExample, and hit Command+U to test - and it failed to compile...monumentally. Bazillions of errors and warnings.
Is there a simple way to solve this?
Things were running fine. Who knows what changed, but now I end up with:
Unit Test Runner failed to load test assembly:
JetBrains.Resharper.TaskRunnerFramework.TaskException:Exception of type 'Microsoft.VisualStudio.TestTools.CommandLine.CommandLineParameterException' was thrown.
Any suggestions?
I've just been having the same problem. It turned out that the Solution Items "folder" had a couple of .testsettings files in it which didn't actually exist (probably because they weren't added to the Git repo). Anyway, I removed them from the Solution and the R# runner now works fine.
Hope that helps.
You can check here for R# bugs that have the same description and maybe find the cause of your problem or a possible workaround. This bug seems to come close.
The other answers did not work for me unfortunately, instead I had to create a testsettings file manually to resolve the issue:
Right click Solution root
Add > New Item...
Select Test Settings from the Installed Templates column
Select the Test Settings item, and rename to the desired file name as necessary
Add
You should now be able to run your unit tests correctly.