Skip to content

Commit

Permalink
Provide a session test framework for JUnit 5
Browse files Browse the repository at this point in the history
A first draft for realizing session tests with JUnit 5.

It uses an extension that intercepts test methods calls to start a
separate Eclipse session in which the tests are executed. The results
are evaluated in the intercepted method execution in way they were
evaluated for existing JUnit-3-based session tests.

Functionality is demonstrated in a manually executed sample session test
as well as by application to the session test in the runtime tests
project. Since JUnit 5 test suites are not yet supported, the project is
adapted to execute tests without suites.

In order to get the session test running with Tycho, an adaptation of
the test application provided via PDE is necessary, because a faulty
class loader is currently used for the test engines during remote
execution.
  • Loading branch information
HeikoKlare committed Jan 15, 2024
1 parent 0114667 commit 6bf2a85
Show file tree
Hide file tree
Showing 12 changed files with 544 additions and 46 deletions.
17 changes: 15 additions & 2 deletions runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,35 @@ Bundle-SymbolicName: org.eclipse.core.tests.harness;singleton:=true
Bundle-Version: 3.15.300.qualifier
Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.core.tests.harness;version="2.0",
org.eclipse.core.tests.harness.session,
org.eclipse.core.tests.session;version="2.0"
Require-Bundle: org.junit,
org.eclipse.test.performance,
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.jdt.junit.runtime,
org.eclipse.jdt.junit4.runtime,
org.eclipse.pde.junit.runtime
org.eclipse.jdt.junit5.runtime,
org.eclipse.pde.junit.runtime,
junit-platform-launcher,
junit-platform-engine,
junit-jupiter-engine,
junit-vintage-engine,
junit-platform-suite-commons,
junit-platform-suite-engine
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: javax.xml.parsers,
net.bytebuddy,
org.apiguardian.api,
org.assertj.core.api,
org.junit.jupiter.api,
org.junit.platform.suite.api,
org.junit.jupiter.api.condition,
org.junit.jupiter.api.extension,
org.junit.jupiter.migrationsupport,
org.junit.jupiter.params,
org.junit.platform.commons,
org.junit.platform.runner,
org.junit.platform.suite.api,
org.opentest4j,
org.w3c.dom,
org.xml.sax
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2023 Vector Informatik GmbH and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.core.tests.harness.session;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Indicates that a session of a test case is expected to terminate with a
* failure or error. To be used in combination with a
* {@link SessionTestExtension}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SessionShouldError {
// Marker annotation
}
Loading

0 comments on commit 6bf2a85

Please sign in to comment.