Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:07:38+00:00 2026-06-09T00:07:38+00:00

I have a bit of a special situation. Basically I have a unit test,

  • 0

I have a bit of a special situation. Basically I have a unit test, annotated with @Test, and inside that test I need to execute a Cucumber JVM test class.

Why? Long story. Something to do with classloaders and RoboGuice, it’s not very important but it does impose limits on what I can and cannot do.

Here’s the test method:

@Test
public void runCucumberFeature() throws Exception {
    Cucumber cucumber = new Cucumber(MyCucumberTest.class);
    cucumber.run(new RunNotifier());
}

MyCucumberTest is a class I have created, and annotated like this:

//@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty", "html:target/cucumber"}, strict=true)
public class MyCucumberTest {
    // Empty, as required by Cucumber JVM
}

Why have I commented out the @RunWith annotation? Because if I don’t, the Cucumber test runner will pick up the test and run it, which I don’t want because I am running the test manually.

The problem is that the above doesn’t work. It looks like Cucumber is finding the feature files, it is verifying that MyCucumberTest contains the @Givens etc, it even prints out the test as if it was running it.

But it doesn’t. No code is executing inside the @Given, @When and @Then methods. I’m not sure why this is, but I have a vague idea that the Cucumber JVM test runner doesn’t want to execute the code because the class isn’t annotated with @RunWith.

Can anyone help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:07:41+00:00Added an answer on June 9, 2026 at 12:07 am

    I can’t provide the solution you’re looking for, but….

    … have you considered tagging the test that you want to run manually (e.g. with @Manual)?

    Then you could uncomment your @RunWith annototation and exclude the manual test by adding --tags ~@Manual to your Cucumber-JVM invocation.

    In your manual JUnit invocation you could add --tags @Manual

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a bit of a special moment here. Basically I have a DB table
I have a Git project that it's a bit special because the files in
I have a bit of a special requirement when combining lists. I will try
i have bit of code that causes an underflow: var t1, t2, delta: DWORD:
Have a bit of confusion here. I added a few objects from a class
I have a bit of code that fits theoretical prediction to experimental data, and
I have a bit of a problem that I can't seem to code my
I have a bit of a strange problem. I have a music app that
I have a bit of a unique problem with an upcoming project; I need
I've got a .jsp file that is working fine. It's maybe a bit special

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.