Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RfFault with NoSuchElementException for classes in org.utbot package #1347

Closed
alisevych opened this issue Nov 10, 2022 · 4 comments
Closed
Assignees
Labels
comp-rd Issue is related RD ctg-bug Issue is a bug status-wont-fix This will not be worked on

Comments

@alisevych
Copy link
Member

alisevych commented Nov 10, 2022

Description

Soot throws NoSuchElementException: Collection contains no element matching the predicate
Displayed as IDEA exception with RdFault

To Reproduce

  1. IDEA Ultimate 2022.2.3 with one of the latest plugin built from main installed
  2. Run the 'UTBotSiteTest' project in IntelliJ Idea
  3. Use plugin to generate tests for Dropdown
    or use the following code:
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;

public class Dropdown {

    public final String name;
    public final SelenideElement field;
    public final ElementsCollection items;

    public Dropdown(String name, By fieldLocator, By itemLocator) {
        field = $(fieldLocator);
        items = field.$$(itemLocator);
        this.name = name;
    }

    public void select(String text) {
        field.hover();  //so that list is expanded
        items.filterBy(text(text)).first().click();
    }

}

Expected behavior

No exception is expected to be thrown in IDEA.

Actual behavior

Exception in IDEA:
com.jetbrains.rd.util.reactive.RdFault: Collection contains no element matching the predicate., reason: java.util.NoSuchElementException: Collection contains no element matching the predicate.

Visual proofs (screenshots, logs, images)

com.jetbrains.rd.util.reactive.RdFault: Collection contains no element matching the predicate., reason: java.util.NoSuchElementException: Collection contains no element matching the predicate.
	at org.utbot.framework.util.SootUtilsKt.getSootMethod(SootUtils.kt:223)
	at org.utbot.engine.UtBotSymbolicEngine.<init>(UtBotSymbolicEngine.kt:172)
	at org.utbot.framework.plugin.api.TestCaseGenerator.createSymbolicEngine(TestCaseGenerator.kt:275)
	at org.utbot.framework.plugin.api.TestCaseGenerator.access$createSymbolicEngine(TestCaseGenerator.kt:61)
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3$1$1.invokeSuspend(TestCaseGenerator.kt:166)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38)
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3.invoke(TestCaseGenerator.kt:157)
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3.invoke(TestCaseGenerator.kt:156)
	at org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47)
	at org.utbot.framework.plugin.api.TestCaseGenerator.generate(TestCaseGenerator.kt:156)
	at org.utbot.framework.process.EngineMainKt$setup$3.invoke(EngineMain.kt:104)
	at org.utbot.framework.process.EngineMainKt$setup$3.invoke(EngineMain.kt:94)
	at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1$1.invoke(ClientProcessUtil.kt:84)
	at org.utbot.rd.CallsSynchronizer.measureExecutionForTermination(ClientProcessUtil.kt:75)
	at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1.invoke(ClientProcessUtil.kt:83)
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
	at com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:360)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:56)
	at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:148)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:54)
	at com.jetbrains.rd.util.threading.SingleThreadSchedulerBase.queue$lambda-3(SingleThreadScheduler.kt:41)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

	at com.jetbrains.rd.framework.RdTaskResult$Companion.read(TaskInterfaces.kt:30)
	at com.jetbrains.rd.framework.impl.CallSiteWiredRdTask.onWireReceived(RdTask.kt:104)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:56)
	at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:148)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:54)
	at com.jetbrains.rd.framework.impl.RdCall$createResponseScheduler$1.queue$execute(RdTask.kt:278)
	at com.jetbrains.rd.framework.impl.RdCall$createResponseScheduler$1.access$queue$execute(RdTask.kt:267)
	at com.jetbrains.rd.framework.impl.RdCall$createResponseScheduler$1$queue$1.invokeSuspend(RdTask.kt:287)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at org.utbot.intellij.plugin.process.EngineProcess.generate(EngineProcess.kt:265)
	at org.utbot.intellij.plugin.generator.UtTestsDialogProcessor$createTests$1$1.run(UtTestsDialogProcessor.kt:234)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Environment

IntelliJ IDEA 2022.2.3 Build #IU-222.4345.14
JDK: 17.0.4.1; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
OS: Windows 10
Plugin to blame: UnitTestBot version: 2022.11.525.

Additional context

Selenide elements and Selenium's By classes are used in constructor and method calls.

@alisevych alisevych added the ctg-bug Issue is a bug label Nov 10, 2022
@alisevych
Copy link
Member Author

@alisevych alisevych changed the title RfFault with NoSuchElementException for Selenide based project RfFault with NoSuchElementException for Selenide based class Nov 14, 2022
@alisevych alisevych added this to the 2022.12 Release milestone Nov 21, 2022
@alisevych
Copy link
Member Author

Additional information

Same exception is thrown when generating tests for the following method in UTBotJava utbot-framework module:
org.utbot.instrumentation.warmup.Warmup::doWarmup2

@alisevych alisevych added priority-top-focus Top priority chosen by dev team comp-rd Issue is related RD labels Nov 30, 2022
@Domonion
Copy link
Collaborator

Domonion commented Dec 5, 2022

Discovered with @Vassiliy-Kudryashov:

The reason is that the class you were generating tests for resides in org.utbot package. All classes in org.utbot are considered as internal classes and filtered out from instrumentation.

Proposed fix: throw exception when generating tests for such classes.
71CF4910-64A9-4430-8AED-A0E96DA0E179

@alisevych alisevych changed the title RfFault with NoSuchElementException for Selenide based class RfFault with NoSuchElementException for classes in org.utbot package Dec 6, 2022
@alisevych alisevych removed the priority-top-focus Top priority chosen by dev team label Dec 6, 2022
@alisevych
Copy link
Member Author

As discussed with the team the issue is of low priority and thus should be closed.
The restriction described in the previous comment is needed to guarantee UTBot correct work. There should be a very important reason to get rid of it - because it requires complex refactoring and related issues fixes.

@alisevych alisevych closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
@alisevych alisevych added the status-wont-fix This will not be worked on label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-rd Issue is related RD ctg-bug Issue is a bug status-wont-fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants