STAMP-project / EvoCrash-demo

See https://stamp-project.github.io/botsing/ for the latest version of STAMP crash reproduction tool.
https://stamp-project.github.io/botsing/
Apache License 2.0
1 stars 2 forks source link

Make it easier to run tests generated by evocrash #7

Closed vmassol closed 6 years ago

vmassol commented 6 years ago

For example evocrash generated the following tests for https://jira.xwiki.org/browse/XRENDERING-422

import org.evosuite.shaded.org.mockito.Matchers;
import org.evosuite.shaded.org.mockito.Mockito;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.Map;
import java.util.NoSuchElementException;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.xwiki.rendering.listener.Format;
import org.xwiki.rendering.listener.Listener;
import org.xwiki.rendering.listener.chaining.BlockStateChainingListener;
import org.xwiki.rendering.listener.chaining.ConsecutiveNewLineStateChainingListener;
import org.xwiki.rendering.listener.chaining.EmptyBlockChainingListener;
import org.xwiki.rendering.listener.chaining.ListenerChain;

public class XRENDERING_422_Frame7 {
    @Test(timeout = 4000)
    public void test0()  throws Throwable  {
        ListenerChain listenerChain0 = new ListenerChain();
        EmptyBlockChainingListener emptyBlockChainingListener0 = new EmptyBlockChainingListener(listenerChain0);
        ListenerChain listenerChain1 = Mockito.mock(ListenerChain.class, new ViolatedAssumptionAnswer());
        Mockito.doReturn(emptyBlockChainingListener0).when(listenerChain1).getNextListener(Matchers.any(java.lang.Class.class));
        BlockStateChainingListener blockStateChainingListener0 = new BlockStateChainingListener(listenerChain1);
        ListenerChain listenerChain2 = Mockito.mock(ListenerChain.class, new ViolatedAssumptionAnswer());
        Mockito.doReturn(blockStateChainingListener0).when(listenerChain2).getNextListener(Matchers.any(java.lang.Class.class));
        ConsecutiveNewLineStateChainingListener consecutiveNewLineStateChainingListener0 =
                new ConsecutiveNewLineStateChainingListener(listenerChain2);
        ListenerChain listenerChain3 = Mockito.mock(ListenerChain.class, new ViolatedAssumptionAnswer());
        Mockito.doReturn(consecutiveNewLineStateChainingListener0).when(listenerChain3).getNextListener(Matchers.any(java.lang.Class.class));
        EmptyBlockChainingListener emptyBlockChainingListener1 = new EmptyBlockChainingListener(listenerChain3);
        Map<String, String> map0 = Listener.EMPTY_PARAMETERS;
        Format format0 = Format.NONE;
        emptyBlockChainingListener1.endFormat(format0, map0);

}
}

I've found the following limitations:

Ideally, I'd like to be able to copy paste the test generated by evocrash in my IDE in a new test class and have it work right away.

Possible? :)

MaelAudren commented 6 years ago

This pull request should fix some problems mentioned is this issue : https://github.com/STAMP-project/EvoCrash-demo/pull/11

xdevroey commented 6 years ago

See https://github.com/STAMP-project/EvoCrash/issues/4