GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” Static code analysis with UTBotJava action

Static code analysis with UTBotJava action

Jump to bottom
Olga Naumenko edited this page Nov 17, 2022 ยท 1 revision

To analyse the Java project with UTBotJava-action you need to follow these simple steps:

  1. Apply the UTBot gradle plugin to your project:
plugins {
    id "org.utbot.gradle.plugin" version "1.0.0-alpha"
}
  1. Create a new file <your-repository>/.github/workflows/run-utbot-java-action.yml with a workflow that can be run and configured manually:
name: "Run UTBotJava action"

on:
  workflow_dispatch:
    inputs:
      pushTests:
        description: "Push generated tests to the repository"
        type: boolean
        default: true
      generatedTestsRelativeRoot:
        description: "Relative path to the root of the tests"
        type: string
        default: '.utbot/test'
      testFramework:
        type: choice
        options:
          - junit4
          - junit5
          - testng
        default: 'junit5'
      generationTimeout:
        description: "Time budget for one class (ms)"
        type: string
        default: '60000'
      codegenLanguage:
        type: choice
        options:
          - java
          - kotlin
        default: java
      mockStrategy:
        type: choice
        options:
          - 'no-mocks'
          - 'other-packages'
          - 'other-classes'
        default: 'other-packages'
      staticsMocking:
        type: choice
        options: 
          - 'do-not-mock-statics'
          - 'mock-statics'
        default: 'mock-statics'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Setup Java
      uses: actions/setup-java@v2
      with:
        distribution: adopt
        java-version: 8

    - name: Setup Gradle
      uses: gradle/gradle-build-action@v2
      with:
        gradle-version: 6.8

    - name: Run UTBotJava-action
      uses: UnitTestBot/UTBotJava-action@v1
      with:
        pushTests: ${{ inputs.pushTests }}
        generatedTestsRelativeRoot: ${{ inputs.generatedTestsRelativeRoot }}
        testFramework: ${{ inputs.testFramework }}
        generationTimeout: ${{ inputs.generationTimeout }}
        codegenLanguage: ${{ inputs.codegenLanguage }}
        mockStrategy: ${{ inputs.mockStrategy }}
        staticsMocking: ${{ inputs.staticsMocking }}
  1. On the Actions tab find the section Run UTBotJava action:

image

  1. Click Run workflow and select the needed options:

image

  1. After the workflow is completed, look at the Security โ†’ Code Scanning Alerts to find the detected errors (by the way, you won`t find any if your code is fine ๐Ÿ˜‰):

image

  1. Explore any alert by clicking on it:

image

As you see in this case above, UTBot detected an unchecked ArrayIndexOutOfBoundsException by passing the array [-192, -192] to the isSorted method.

Click Show paths button, and you see the execution trace.

๐Ÿ“ Note: You can find all these steps performed in our sample project: UTBotJava-action-example

User guides

IntelliJ IDEA plugin

Testing pure Java code

  • Check system requirements
  • Install or update plugin
  • Generate tests with default configuration
  • Fine-tune test generation
  • Get use of test results

Testing Spring-based code

  • General notes
  • Standard unit tests
  • Spring-specific unit tests
  • Integration tests

Troubleshooting

Command-line interface

GitHub Action

Contributor guides

(redirect to /docs in main repo)

General info

  • Contributing guide
  • Developer guide
  • Naming and labeling conventions
  • Interprocess debugging
  • Interprocess logging

Continuous integration

  • CI in UnitTestBot Java
  • Docker for UnitTestBot Java
  • SSH session with GitHub agent

Design docs

  • UnitTestBot overall architecture
  • Android Studio support
  • Assumption mechanism
  • Choosing language-specific IDE
  • Code generation and rendering
  • Fuzzing Platform (FP) Design
  • Instrumented process API: handling errors and results
  • UnitTestBot JavaScript plugin setup
  • Night statistics monitoring
  • RD for UnitTestBot
  • Sandboxing
  • UnitTestBot settings
  • Speculative field non-nullability assumptions
  • Symbolic analysis of static initializers
  • Summarization module
  • Taint analysis
  • UnitTestBot decomposition
  • UtUtils class
  • UnitTestBot Family changes

Clone this wiki locally

You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.