You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I searched for the bug in question and couldn't find it. Maybe it's not a bug, but I might have misunderstood something.
I am using Crawljax version 5.2.3 along with the Testcasegenerator plugin version 5.2.3 to explore a website and automatically generate test cases (For research purposes with my university.).
I also want to specify that using Crawljax and Testcasegenerator version 4.1 works correctly.
So, I start the runner on a website, it explores it, and eventually, it generates the files eventables.json, Generatedtests.java, states.json. I copy these files to the Maven test folder and run the tests from the IDE (I also tried with mvn test), but I always get the same error when creating a new TestSuiteHelper object. When debugging, it seems that the issue arises from line 266 of the TestSuiteHelper class, which tries to create a map using eventable.json, but it throws a null pointer exception. This one: mapEventables = gson.fromJson( new BufferedReader(new FileReader(jsonEventables)), new TypeToken<Map<Long, Eventable>>() {}.getType());
jsonEventables is created at line 192.
The same line of code works correctly with version 4.1. Now, I'm not sure if it's a bug in the generation process or if I made a mistake in the configuration with the new version (5.2.3).
Here's the Error, Crawljax code and pom (I wont include the URLs and local paths because I'm not sure if it could be a problem to post them here. However, I assure you that they are correct):
Error:
java.lang.IllegalArgumentException: null type argument at index 1
at org.apache.commons.lang3.Validate.noNullElements(Validate.java:500)
at org.apache.commons.lang3.reflect.TypeUtils.parameterizeWithOwner(TypeUtils.java:1642)
at org.apache.commons.lang3.reflect.TypeUtils.parameterize(TypeUtils.java:1563)
at com.crawljax.plugins.testcasegenerator.util.GsonUtils$ImmutableListDeserializer.deserialize(GsonUtils.java:35)
at com.crawljax.plugins.testcasegenerator.util.GsonUtils$ImmutableListDeserializer.deserialize(GsonUtils.java:29)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:186)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:144)
at com.google.gson.Gson.fromJson(Gson.java:1227)
at com.google.gson.Gson.fromJson(Gson.java:1137)
at com.google.gson.Gson.fromJson(Gson.java:1107)
at com.crawljax.plugins.testcasegenerator.TestSuiteHelper.init(TestSuiteHelper.java:266)
at com.crawljax.plugins.testcasegenerator.TestSuiteHelper.<init>(TestSuiteHelper.java:199)
at generated.GeneratedTests.oneTimeSetUp(GeneratedTests.java:56)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:361)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:296)
at org.testng.internal.invokers.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:180)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:122)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:829)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:437)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391)
at org.testng.SuiteRunner.run(SuiteRunner.java:330)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
at org.testng.TestNG.runSuites(TestNG.java:1099)
at org.testng.TestNG.run(TestNG.java:1067)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Runner:
public class RunCrawler {
private static final long WAIT_TIME_AFTER_EVENT = 200;
private static final long WAIT_TIME_AFTER_RELOAD = 50;
private static final String URL = "";
public static void main(String[] args) throws Exception {
CrawljaxConfiguration.CrawljaxConfigurationBuilder builder = CrawljaxConfiguration.builderFor(URL);
builder.crawlRules().setFormFillMode(CrawlRules.FormFillMode.NORMAL);
builder.setStateVertexFactory(new DHashStateVertexFactory());
// click these elements
builder.crawlRules().clickDefaultElements();
// builder.crawlRules().click("div");
builder.crawlRules().crawlHiddenAnchors(true);
builder.setMaximumStates(5);
builder.setMaximumDepth(3);
builder.crawlRules().clickElementsInRandomOrder(false);
// Set timeouts
builder.crawlRules().waitAfterReloadUrl(WAIT_TIME_AFTER_RELOAD, TimeUnit.MILLISECONDS);
builder.crawlRules().waitAfterEvent(WAIT_TIME_AFTER_EVENT, TimeUnit.MILLISECONDS);
builder.setBrowserConfig(new BrowserConfiguration(EmbeddedBrowser.BrowserType.FIREFOX_HEADLESS, 1));
builder.addPlugin(new CrawlOverview());
builder.addPlugin(new TestSuiteGenerator()); //builder.addPlugin(new TestSuiteGenerator(new TestConfiguration(TestConfiguration.StateEquivalenceAssertionMode.BOTH)));
CrawljaxRunner crawljax = new CrawljaxRunner(builder.build());
crawljax.call();
}
}
Hello, I searched for the bug in question and couldn't find it. Maybe it's not a bug, but I might have misunderstood something.
I am using Crawljax version 5.2.3 along with the Testcasegenerator plugin version 5.2.3 to explore a website and automatically generate test cases (For research purposes with my university.).
I also want to specify that using Crawljax and Testcasegenerator version 4.1 works correctly.
So, I start the runner on a website, it explores it, and eventually, it generates the files eventables.json, Generatedtests.java, states.json. I copy these files to the Maven test folder and run the tests from the IDE (I also tried with
mvn test
), but I always get the same error when creating a new TestSuiteHelper object. When debugging, it seems that the issue arises from line 266 of the TestSuiteHelper class, which tries to create a map using eventable.json, but it throws a null pointer exception. This one:mapEventables = gson.fromJson( new BufferedReader(new FileReader(jsonEventables)), new TypeToken<Map<Long, Eventable>>() {}.getType());
jsonEventables is created at line 192.
The same line of code works correctly with version 4.1. Now, I'm not sure if it's a bug in the generation process or if I made a mistake in the configuration with the new version (5.2.3).
Here's the Error, Crawljax code and pom (I wont include the URLs and local paths because I'm not sure if it could be a problem to post them here. However, I assure you that they are correct):
Error:
Runner:
POM:
oneTimeSetUp() is the method where the TestSuiteHelper object is created and where the null .
I hope I have described the problem well, and I hope you can help me. However, for now, I'll report it as a bug and continue using version 4.1.
The text was updated successfully, but these errors were encountered: