I am able to export unit testing report from Android Studio IDE. We have button to export in Android studio as below image
After clicking export button I will get a new dialog to select location of export and file type like below image
I need terminal command to do the export .
Terminal Command "flutter test" is just executing my test cases. I want to know the command for exporting unit test cases.
You need to pass --coverage argument with flutter test and then can generate html file with genhtml
flutter test --coverage && genhtml coverage/lcov.info --output=/User/Desktop/coverage
This will create a coverage folder having the index.html file
The contents of /User/Desktop/coverage should look like this
Related
I'm new in Flutter, i started creating unit tests and UI interface tests, if i put the tests classes under test directory everything works fine, but when i decided to separate UI and unitTest in separate folders under test folder
test/unitTest/test1.dart
test/ui/widget1.dart
I got an error
Error: Not found: 'dart:ui'
is it possible to create folders under test folder ?
Finally i found the solution
OK so I actually found a solution for this.
In Android studio in the run dropdown you select Edit Configurations
Then you press the + button and select Flutter test Make sure the Test
scope is All in file and point it at your test file. You can now run
the individual test file and also debug it in android studio by
selecting >this configuration in the run drop-down.
chose Flutter test > click + > Flutter test > click Test File > select the test file from your project.
Origin solution from here
For my reactjs app, I'm adding integration tests to a view and want to keep an eye on coverage along the way. I'm currently getting all files on every run.
Question
While adding tests to increase coverage, how can I get jest coverage to show only files in a specific folder?
Examples tried
$ yarn test --collectCoverageFrom=src/app/components/Tools
Test run, bu no coverage is showing here.
$ yarn test Tools --coverage --collectCoverageFrom=src/app/components/Tools
I get Ran all test suites matching "Tools".
$ yarn test src/app/components/Tools --coverage
Here I see the coverage percentage is smaller but still lists all files.
$ yarn test -o --coverage
Again as the previous, I see the coverage percentage is smaller but still lists all files.
It would be best to have an argument in the CLI, but you can add a temporary script in your package.json:
"tools-coverage": "react-app-rewired test --env=jsdom src/app/components/Tools --coverage --collectCoverageFrom=src/app/components/Tools/**/*.js"
Running the full command in the terminal just doesn't work.
Now you can instead run $ yarn tools-coverage to just test your Tools folder you targeted in your package.json.
An example shown here in the create-react-app issue:
https://github.com/facebook/create-react-app/issues/1455#issuecomment-277010725
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'd like to be able to produce a HTML based report from the Results.trx and data.coverage files that MSTest creates. Ideally this would just list any failures, and show some basic coverage stats.
Does anyone know of a tool that does this?
you can use TRXER tool to generate HTML reports from trx file. Download TrxerConsole.exe file from here
Build/Rebuild the project to create .dll file.
If your project name is UnitTest1 then the .dll file name will be UnitTest1.dll. Go to the location of .dll like
C:\Users\NAME\source\repos\UnitTest1 \UnitTest1
\bin\Debug\netcoreapp3.1\UnitTest1.dll
Open Developer command prompt of Visual studio 2019
Run command to set the location
cd
C:\Users\NAME\source\repos\UnitTest1\UnitTest1\bin\Debug\netcoreapp3.1\UnitTest1.dll
Run the Command to Generate trx file:
vstest.console.exe UnitTest1.dll /logger:trx
Trx file will be generated in the folder TestReults which is present in the same location where project dll file is present.
If TrxerConsole.exe is in downloads then run the command to convert into HTML.
Path of trxerconsole.exe file then space then Path of trxfile as below
C:\Users\NAME\Downloads\TrxerConsole.exe C:\Users\NAME\source\repos\DesktopWithMSTest\DesktopWithMSTest\bin\Debug\netcoreapp3.1\TestResults\TestResult.trx
HTML file will be generated in same TestResults Folder.
link to refer
your Reports will look like:
Actually we did that using the open source tool Trx2Html
Its really simple - gets trx file and output html. There are specific versions for VS2005 trx and VS2008 trx.
You can publish to the report server and then the reports will be available from a web interface.
( I did it in PowerShell)
You need this dll
Microsoft.VisualStudio.Coverage.Analysis.dll
then this line will turn .coverage into an xml file (which the .trx already is)
$dataStore = ([Microsoft.VisualStudio.CodeCoverage.CoverageInfoManager]::CreateInfoFromFile("$homeDir\tests.coverage")).BuildDataSet($null)
$dataStore.WriteXml("$homeDir\Coverage.xml")
Then you could use the MsTest xsl file from cruisecontrol.net to put the test results in a nice html format, and I have an XSL for the coverage. WHich won't fit here. I wish they had a way to upload files. Email me alex dot hutton at hotmail, and I can get you the xsl to display that coverage
The trx files are fairly simple xml documents that can easily be processed with XSLT to produce flexible and customized reports.
If you google trx and xslt you'le find a number of examples to get you started.
I have added a codeplex project for this, you can generate the html from trx as well as add code-coverage data to the same report. http://trxtohtml.codeplex.com/
try the new trx2html.codeplex.com it's not based on XSLT, but in LINQ2XML so it's easier to extend
I am writing a simple batch file to convert your XML report into HTML
Pre-requisites
Download trx2html.exe from here
Paste it to any location on your machine where XML file is being generated
Create a report.bat file and paste the code given below
#echo off
::*****************************Constants*****************************************************************
set "trxFileName=TestResult"
set "trx2html_path=C:\Users\Desktop\0.6\TrxerConsole.exe"
::********************************************************************************************
echo ------------------------"Generating test report "----------------------------------------------
%trx2html_path% ".\Results\%trxFileName%"
echo -----------------------"Test Report Generated at location=.\Results\%trxFileName%"------------
pause
I have created a tool to generate html from trx.
The tool is available from Nuget.org.
Install as global tool:
dotnet tool install --global trxlog2html --version 1.0.0
Install as local tool:
dotnet new tool-manifest
dotnet tool install --local trxlog2html --version 1.0.0
Converting the TRX to html file:
After installation, you can convert the trx file to html file with the following command.
dotnet run trxlog2html -i [input trx file path] -o [output html file path]
See the links below for more information.
https://github.com/HikosakaRyo/trxlog2html
https://www.nuget.org/packages/trxlog2html/