Testcafe: find current working directory from test - testcafe

I have a working TestCafe test suite which generates a custom xml report generated by code in the test suite. I would like to place this report in the "standard" ./results location that TestCafe uses for its reports, but I can't find an option to retrieve the current working directory (e.g., the bash pwd command).
I'm getting it by adding export pwd=$(pwd) on the command line when I run the test, but I wonder if there's a built-in mechanism in TestCafe to do this?

If you run the tests from the command line, you can just use the reporter option as follows:
testcafe chrome test.js --reporter xunit:results/output.txt
See this question for details: How to save report results from console to a file (TestCafe)?.

Related

Cypress BDD - Unable to populate log.json file & messages.ndjson using the latest boiler plate code

I'm using the new boiler plate code present here - https://github.com/JoanEsquivel/cypress-cucumber-boilerplate on a Windows machine to generate a log.json file, which in turn makes use of the "cucumber-json-formatter.exe" to format the json file and generate a cucumber-html report. Seem to have followed all the steps correctly, but the log.json file is not getting populated with any data and in turn no cucumber-html report.
Steps followed:
Cloned the project
Performed npm commands to install all latest packages (not required but as a double-check)
Downloaded cucumber-json-formatter-windows-386 from https://github.com/cucumber/json-formatter/releases/tag/v19.0.0 , renamed to cucumber-json-formatter.exe and included in the project folder
Performed "npm run cypress:execution" command - This comes from the script in package.json file. Able to see the feature files getting executed in the terminal. This creates the json logs folder with the 2 json files (log.json, messages.ndjson)
Performed "node .\cucumber-html-report.js" command. This generates the cucumber-html report which is empty, because it should be the formatted version of the log.json file. The formatting is done by the cucumber-json-formatter.exe.
Reaching out, if anyone else also came across the same issue. If yes, require some guidance here please.

How to get karma javascript junit xml reports into sonar

Is there a karma reporter which can be used to generate a results.xml file which is compatible with the sonar Generic Test Coverage plugin? Or alternatively a parser for the junit file which is output by karma-junit-reporter and which will work with the generic plugin?
I am using SonarQube 5.3 and Karma / Jasmine
I want to import the junit reports that come from karma into SonarQube but cannot see a way to do this easily. Something like https://www.npmjs.com/package/mocha-sonar-generic-test-coverage for karma
FYI I have seen
karma-junit-sonarqube-reporter (https://www.npmjs.com/package/karma-junit-sonarqube-reporter) but that seems to expect the name of the test to match the path to the file which is too restrictive for me.
karma-sonarqube-unit-reporter seems to be unfinished
grunt-karma-sonar seems to rely on jstestdriver which is deprecated
I managed to achieve this by doing the following.
To get javascript junit reports into sonar
find and download sonar-karma-test-report-plugin-1.0.0.4.jar which is not available via the update center
put jar file in /usr/local/Cellar/sonar/5.3/libexec/extensions/plugins and restart sonar
Tell karma to omit the name of the browser
junitReporter: {
useBrowserName: false
}
Get Karma to create a junit xml file via the normal karma-junit-reporter and have it call the file TESTS-xunit.xml (I had the file called test-results.xml and sonar would not detect it WTF)
In the sonar-project.properties file set sonar.javascript.karmajstestdriver.reportsPath=reports/js/unit-components/results/
call sonar-runner
Sonar requires the path to the test file in order to process the report. Jasmine does not make this available to the reporter. My understanding is the sonar plugin iterates over xml file and finds the classname for each test which has the test name (ie my cool tests) and does a string replace to change that to the location of the file

How to open a window in Vivado using Tcl script?

I'd like to open a .vhd and .vhi file in window for editing in Vivado from Tcl Console, but I can't find any command for that.
As of at least Vivado 2014.2 any unrecognized Tcl command will be sent to the OS shell for execution, so you can simply open whatever editor you like as if you were not in the Tcl shell. It basically automatically runs exec for you. Older versions you may have to run exec yourself.
eg
nedit file.vhd
Vivado being a design tool works on projects instead of individual files. So to edit a file, say xyz.vhd, the file needs to be part of a project. This can be done through Tcl console by creating a new project, adding xyz.vhd file to it and then loading the project.
Create a new project using the following command:
project -new
Add files:
add_file -vhd "xyz.vhd"
Save the project and run.
project -save
project -run
You can find further resources at this link.

How can jenkins find junit.xml in a zip file?

I am running Jenkins on a script, that generates a junit.xml report file and other files. However, all those files are zipped by the script, hence Jenkins cannot find it.
Is there a way to make Jenkins unzip the .zip file , find my particular junit file and generate the run results ?
All this is in Linux.
Thanks
Jenkins has the ability to execute arbitrary shell commands as a build step, just add the 'Execute Shell' step to your build and put in the commands you want (presumably 'unzip' would be among them).
Once you've extracted the xml, provided your internal tool generates it using this schema the JUnit plugin just needs the path you extracted to and it will show the results on the build page.
If you have the option, I would really suggest executing your tests via gradle or maven, as outputs from those tasks will produce a report that Jenkins (and other tools) can already read, and can streamline the job setup process for your users. But, if you can't get away with that, the above should work for you.

Custom Reporting to Jenkins

I'm trying to hook up our own private testing tool to Jenkins. I'm able to run the test through the command line and create a report on my local machine. I will need to convert that report to xml JUnit format, specifically for Jenkins. Once that is done, how do I associate the xml file that was just created to the most recent job. This way the correct report gets put with the correct job?
The way Jenkins works is simple: you create a job and Jenkins runs it. Every run of a job is called a build. If you configure the job to look for test report files at the end of a build, the test reports are loaded and presented in the Jenkins UI. There is no way to submit test reports to a build outside of the build or after the build.
Usually this is not a problem. You run your test program/script as part of the build and it produces xml files in the JUnit format. When all the build steps are done, Jenkins looks for the xml files and loads them. You have to tell Jenkins to do it, though. You open the job configuration and you add a new post-build action titled "Publish JUnit test result report". Then you give Jenkins a pattern it uses to search for the files. You can use **/*.xml which means Jenkins will look for all *.xml files in every directory and subdirectory. Or you can e.g. use **/testreports/*.xml if you know where the test reports are going to be.