Skip to content

The child process working directory differs from the test runner working directory #694

Closed
@sergeypospelov

Description

@sergeypospelov

Description

When we refer to some file relatively, we strictly rely on the current working dir. The problem is that the child process working directory differs from the test runner working directory.

It's the reason of SAT-1710 (False ExceptionInInitializerError in Spring project).

To Reproduce

Steps to reproduce the behavior:

  1. Open any project
  2. Add an empty file with the name "definitely_exists" to the root project directory
  3. Leave only fuzzing turned on
  4. Generate tests for this method:
    boolean checkFileExists() {
        File file = new File("./definitely_exists");
        if (file.exists()) {
            return true;
        } else {
            return false;
        }
    }

Expected behavior

  public void testCheckFileExistsReturnsTrue() {
      CMCSyncService cMCSyncService = new CMCSyncService();

      boolean actual = cMCSyncService.checkFileExists();

      assertTrue(actual);
  }

And test passes.

Actual behavior

  public void testCheckFileExistsReturnsTrue() {
      CMCSyncService cMCSyncService = new CMCSyncService();

      boolean actual = cMCSyncService.checkFileExists();

      assertFalse(actual);
  }

And test fails.

Metadata

Metadata

Labels

comp-springIssue is related to Spring projects supportctg-bugIssue is a bugspec-internalInternal issue

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions