Show number of tests executed and passed in SonarQube with Jest, Vitest and Pytest

Show number of tests executed and passed in SonarQube with Jest, Vitest and Pytest

Tiempo de lectura: 2 minutos Today we are going to learn how to pass and display the number of tests that have been covered in SonarQube. For React with Vite: First, we install: npm install -D vitest-sonar-reporter Now, we go to the vitest.config.ts We add: html reporters: [‘default’, ‘vitest-sonar-reporter’], // JUnit reporter to generate test reports outputFile: ‘test-results/test-results.xml’, // XML … Read more

Implementing Vitest in a React Environment with Vite for Unit Tests

Implementing Vitest in a React Environment with Vite for Unit Tests

Tiempo de lectura: 2 minutos Today we are going to learn how we can install Vitest in a React environment with Vite. First, we will install Vitest: npm install -D vitest After we will install the necessary libraries: npm install vitest @testing-library/react @testing-library/jest-dom –save-dev Now let’s create the directory structure for the tests, outside our src folder: And within components, … Read more

Integrating Unit Tests with Jest in React

Integrating Unit Tests with Jest in React

Tiempo de lectura: 2 minutos Today we are going to learn how we can integrate tests with Jest that allow us to test the React components created. The first thing we have to do is install Jest: npm install –save-dev jest Install testing-library/jest-dom: npm install –save-dev @testing-library/jest-dom We installed ts-jest npm install –save-dev ts-jest We installed: npm install –save-dev babel-jest … Read more

Use Jest to unit test your React project

Use Jest to unit test your React project

Tiempo de lectura: 2 minutos Unit testing is an essential part of software development that ensures different parts of your application work correctly. In this tutorial, we will learn how to write unit tests for a React component using Jest and @testing-library/react. Prerequisites Make sure you have Node.js and npm installed on your machine before starting. You can verify this … Read more

Unit testing with React Native and Mocha

Unit testing with React Native and Mocha

Tiempo de lectura: 2 minutos Reading time: 2 minutes Hello, today we are going to see how we can perform Unit Tests using Mocha in React Native. The first thing we need to do is install the dependencies for testing: npm install –save-dev mocha chai sinon nyc istanbul-lib-coverage istanbul-reports npm install –save-dev mocha-junit-reporter npm install –save-dev @babel/core @babel/register @babel/preset-env Create … Read more

Ejecutar test Selenium en un contenedor Docker Compose

Ejecutar test Selenium en un contenedor Docker Compose

Tiempo de lectura: < 1 minuto Reading Time: < 1 minute Today I’m going to show you how we can run Selenium tests in a Docker container. First, let’s create a Docker Compose container with Selenium (using this image https://github.com/nixel2007/docker-selenium-side-runner) version: '3' services: chromedriver: image: robcherry/docker-chromedriver privileged: true restart: always environment: - CHROMEDRIVER_WHITELISTED_IPS='' # ports: # - '4444:4444' selenium-side-runner: image: nixel2007/docker-selenium-side-runner ... Read more

Deploy Docker Container with SonarQube and Integrate with Jenkins for Code Analysis

Deploy Docker Container with SonarQube and Integrate with Jenkins for Code Analysis

Tiempo de lectura: 2 minutos Reading time: 4 minutes Today we are going to see how to install SonarQube using a Docker container. To do this, we will use the following Docker container: version: “3.1” services: sonarqube: image: sonarqube:lts-community container_name: sonarqube hostname: sonarqube ports: – 9000:9000 environment: – sonar.jdbc.url=jdbc:postgresql://posgres_db:5432/sonar – sonar.jdbc.username=posgres – sonar.jdbc.password=adminposgres – sonar.search.javaAdditionalOpts=-Dbootstrap.system_call_filter=false volumes: – ./config/sonarqube/logs:/opt/sonarqube/logs – ./config/sonarqube/data:/opt/sonarqube/data … Read more

SonarQube Scanner PLUGIN for Jenkins, send your code to your Sonarqube server for analysis

SonarQube Scanner PLUGIN for Jenkins, send your code to your Sonarqube server for analysis

Tiempo de lectura: 2 minutos Reading time: 4 minutes Hello, today I’m going to show you how to install and send code to SonarQube using SonarQube Scanner Plugin and Jenkins. This way, we can create a stage within the CI/CD pipeline that is responsible for analyzing the code integration. The first thing we need to do is open Jenkins and … Read more

Unit Testing in Java with JUnit 4

Unit Testing in Java with JUnit 4

Tiempo de lectura: 2 minutos Reading time: 3 minutes Today, I’m going to show you how you can implement JUnit tests in Java with a simple example. The first thing you need to do is to start a Java project and create an example class called Multiplication: Now let’s create a simple function for multiplication: public class Multiplication { } … Read more