GZoltar / gzoltar

GZoltar - Java Library for Automatic Debugging http://www.gzoltar.com
Other
77 stars 34 forks source link

Running Gzoltar plugin in VSCode results in error #35

Closed ttoktassynov closed 3 years ago

ttoktassynov commented 3 years ago

Context

Hi! When trying to initiate gzoltar plugin run in VSCode it results in following error:

Error running command gzoltar.run: Running the contributed command: 'gzoltar.run' failed.. This is likely caused by the extension that contributes gzoltar.run.

Steps to Reproduce

  1. Creating a maven project in VSCode from maven-archetype-quickstart template
  2. Add following function in App.java:
    int mid(int x, int y, int z) {
        int m = z;
        if (y < z) {
            if (x < y)
                m = y;
            else if (x < z)
                m = y;//should be m = x;
        } else {
            if (x > y)
                m = y;
            else if (x > z)
                m = x;
        }
        return m;
    }
  3. Add couple test cases in AppTest.java:
    @Test
    public void test1() {
        assertEquals(2, faulty.mid(3,2, 1));
    }
    @Test
    public void test2(){
        assertEquals(2, faulty.mid(1,3,2));
    }
    @Test
    public void test3(){
        assertEquals(2, faulty.mid(2,1,3));
    }
    @Test
    public void test4(){
        assertEquals(2, faulty.mid(2,2,1));
    }
    @Test
    public void test5(){
        assertEquals(2,faulty.mid(2,1,2));
    }
    @Test
    public void test6(){
        assertEquals(2, faulty.mid(1,2,2));
    }
  4. Go to Gzoltar tab and hit Run Gzoltar

GZoltar arguments

I have used Gzoltar plugin from VSCode marketplace

Expected behaviour

I assume the plugin should provide graphical representation of possible faulty lines, which is line 7 in mid function.

Environment (please complete the following information, if relevant):

Additional comments

Klaysb commented 3 years ago

Hello!

Is it possible for you to show us the full App.java & AppTest.java files, and the folder structure of this project? Just to clear up some things before trying to see what the problem might be.

ttoktassynov commented 3 years ago

Hi Klaysb, thanks for reaching out. Here is my repo https://github.com/ttoktassynov/TestGzoltarOnVS

jose commented 3 years ago

Hi @ttoktassynov,

The repository https://github.com/ttoktassynov/TestGzoltarOnVS is no longer available, could you please share that project with us once more? (Sorry for the trouble.) In the meantime, could you please tell us which java/junit version are you using?

-- Best, Jose

ttoktassynov commented 3 years ago

HI Jose, Here is the link to the simple project I created on VS code via maven: https://github.com/ttoktassynov/gzoltar-test-vs

The following error happens when following all instructions of Gzoltar VS extension:

Error running command gzoltar.run: Running the contributed command: 'gzoltar.run' failed.. This is likely caused by the extension that contributes gzoltar.run.

jose commented 3 years ago

Hi @ttoktassynov,

I've managed to reproduce the same output you got, not sure whether I managed to reproduce the same issue, as that error message was thrown by GZoltar/VSCode in many different places. I've updated GZoltar's VSCode extension to version 1.0.2 (which will be online shortly) and GZoltar now reports more meaningingful error messages, in case we come across any other odd behaviour.

On my mac, the issue was related to the Java Path. GZoltar/VSCode was not able to figure out where was the java exec and it was not able to run any Java command. I addressed the issue by adding

export JAVA_HOME=__path_to_your_java_installation__/Contents/Home
export PATH="$JAVA_HOME/bin:$PATH"

to my .bashrc. These two exports will force any java/javac command to use that specific version of Java.

-- Best, Jose