How to add timeline report in webdriver.io - mocha.js

How can I add timeline report in webdriver.io project.
Sample report screenshot

https://github.com/QualityOps/wdio-timeline-reporter#readme
Step 1: Add wdio-timeline-reporter in dev dependency "wdio-timeline-reporter": "^5.1.1"
npm i wdio-timeline-reporter --save-dev
Step 2: Add timeline in services of the wdio config file
Step 3: Add timeline in the reporters for wdio config along with output directory for report.
Step 4: Run your tests and you will report generated in output directory.

Related

Script for open cypress test runner

There are multiple projects inside our repo.
Eg.
MainProject/
SubProject_1/
SubProject_2/
After I installed cypress, "Cypress" folders were created for each project.
MainProject/
Cypress
SubProject_1/
Cypress
SubProject_2/
Cypress
Now in package.json file I've got;
Script
{
"cypress:open": "cypress open",
}
When I run npm run cypress:open, it opens up UI for root directory. Which is;
MainProject/
Cypress
If I want to open cypress for different folder as below, how should I try modify the script ?
SubProject_1/
Cypress
Please note that, I've got cypress v10.
When I run Cypress open --project ./SubProject_1/Cypress, it created a folder /SubProject_1/Cypress.
Thanks
I think you want to specify the config file for the particular project,
See Specifying an Alternative Config File
"open:sub1": "cypress open --config-file SubProject_1/cypress.config.js"
Each project config would specify the folders relative to that project.

How to run tests outside of integration folder in Cypress

I have project B linked to project A with npm link and am trying to run tests from B in A. Project A builds the entire front end and could use other modules than just B and so I want to be able have the test runner use A and its tests but also use tests from the linked project (assuming the linked projects all use similar Cypress directory structures). I first tried this by setting the testFiles attribute in the config to an array like [/path/to/ProjectATestingRoot/integration/**/*.*", "/path/to/ProjectBTestingRoot/integration/**/*.*"]
and running Cypress with integrationFolder to be from project A. While I'm able to see all my tests when I open Cypress, only project A's tests can be run. When I run project B's they get stuck when the browser loads the test and displays the "Your tests are loading..." screen for eternity.
Is there any way that I could run tests from outside the set integration folder? I thought I could write a little plugin to copy the testing files over but that seems more laborious than needed.
Using spec should solve the problem
npx cypress run --spec [abloluteFolderPath}
"testFiles": "**/*.{feature,spec.tsx}",
"integrationFolder": ".",
"ignoreTestFiles": "**/node_modules/**/*{feature,spec.js}"
Add this to your cypress.json. It adds all the files with .spec.tsx ignoring the ones inside the node_module.
https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/unit-testing__application-code
There are 2 options
1 You can specify integrationFolder in the cypress.json
{
//....
"integrationFolder": "cypress/tests"
// or
// "integrationFolder": "tests"
}
More information https://docs.cypress.io/guides/references/configuration#Folders-Files
2 You can specify integration folder for each test run
npx cypress --config integrationFolder=cypress/tests
npx cypress --config integrationFolder=tests
More information https://github.com/cypress-io/cypress/issues/2256#issuecomment-544408366

CircleCI runs zero tests on my maven Java project

I have a test project that is built with Maven (Java). I can either execute the test from IntelliJ manually or from the command line by writing mvn test.
I put the project on CircleCI and it generated a yml file. And it was able to execute the tests on pipelines as well without any issue at first
Then I made something stupid. Initially tests were in this root: src/main/java/api/test. But I decided to move the test class to this root: src/test/java/api.
I did this change because src/test/java was the actual test folder created automatically when you create a Maven project. (The other test folder was created by me manually so I thought this was not the best practice and therefore decided to move the test class to src/test/java. Basically what I did is, I created a package named api under src/test/java and moved the test class to this package. After that I deleted src/main/java/api/test as it is empty now.
After this change, I didn't observe any issue. I could still run the tests from IntelliJ or from the command line by mvn test command. But after I commit my changes, I just checked the pipelines and saw this:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.793
My project is still built and tested on CircleCI but it obviously does not execute the test class. I dont know why it is happening. I checked the yml file and there is nothing related with paths and it was working before. Here is my yml file:
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
jobs:
# Below is the definition of your job to build and test your app, you can rename and customize it as you want.
build-and-test:
# These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# Be sure to update the Docker image tag below to openjdk version of your application.
# A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/openjdk
docker:
- image: cimg/openjdk:11.0
steps:
# Checkout the code as the first step.
- checkout
# Use mvn clean and package as the standard maven build phase
- run:
name: Build
command: mvn -B -DskipTests clean package
# Then run your tests!
- run:
name: Test
command: mvn test
workflows:
# Below is the definition of your workflow.
# Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
# CircleCI will run this workflow on every commit.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
sample:
jobs:
- build-and-test
As I said the same yml file was working fine before I moved the test class. Now it probably can not locate my test file. What could be the problem here and how can I solve this? Any help is appreciated.

Teamcity + NYC + Istanbul - generate test coverage report

I am trying to generate tests report into teamcity, everytime built is made. I've researched the several methods and ended up finding Istanbul's teamcity reporter: teamcity
Now I am trying to integrate it into teamcity, but I've not found any instructions about it.
All you need to do is add a script target in your package.json that uses the reporter:
"script": {
...
"coverage:teamcity": "nyc --reporter=teamcity mocha ...etc..."
...
}
Then, in your build step, simply invoke it via command line npm run coverage:teamcity
Teamcity will automatically parse the output and generate the coverage summary for you.

Sonar Runner not picking up the report xml file in TeamCity

Sonar Runner stepWe are trying to setup Sonar for a project(Modules) in TeamCity. We have the following build steps:
1) Nuget Install
2) Visual Studio sln
3) Inspections(.Net)
4) Sonar Runner
In the Sonar Runner step,it is unable to get hold of that file.see image 2
unable to find that xml file
Please help by pointing me in the right direction on how to make it pick the xml file.
The main trick here is to pass report XML to SonarQube runner - it could be done with /output resharper option (see step #2 below). There are though some more things which could ruin your day so I composed a full procedure.
First of all make sure that SonarQube Server is configured correctly to accept Resharper data. You'll need installed Resharper and C# plugins and configured Quality Profile with Resharper rules. To check configuration I recommend running analysis manually as described in the Resharper plugin documentation.
Then configure your Inspections(.Net) TeamCity build step to create report XML in a well-known place: open advanced options and in the field "Additional inspectCode.exe arguments:" add /output=%system.teamcity.build.tempDir%\inspectReport.xml (or any other location). Important! The step will fail because it expects the report in default location (see issue on YouTrack). All subsequent steps will need Execute step: if some of the previous steps failed option to run
In SonarQube Runner step open advanced options and to the "Additional parameters:" field add this 2 lines (replace pathToSolutionFile with real path):
-Dsonar.resharper.cs.reportPath=%system.teamcity.build.tempDir%\inspectReport.xml
-Dsonar.resharper.solutionFile=pathToSolutionFile
Finally to see the inspections report in TeamCity UI as well add a new Command Line build step with:
echo "##teamcity[importData path='%system.teamcity.build.tempDir%\inspect.xml' type='ReSharperInspectCode']"

Resources