0

I am a beginner at automation testing.

I am trying to execute tests that were written in java using Selenium WebDriver, Cucumber with Gherkin annotations in JMeter.

When I run my tests without JMeter, I just use the opportunity to run them as Junit test using the runner class (in Eclipse).

Runner class

To run my tests in JMeter, I created a jar file, uploaded it to Junit sub-folder, all dependencies-jars were uploaded to lib sub-folder.

I tried to create a JUnit request in JMeter, but it didn't help as when we use Cucumber, we don't mark methods with @Test. I have just an empty constructor for my Runner class (as you can see from the picture above).

I tried to add my jar to Test Plan and create an instance of my class in BeanShell, but it is not executed as JUnit tests.

JMeter - screen1

JMeter - screen2

My question is how to run java test scripts that were written based on Cucumber with Gherkin (based on Selenium WebDriver)?

Maybe I have to use other Samplers...

Any examples are greatly appreciated.

1 Answer 1

0

I believe you need to run another class, in particular io.cucumber.core.cli.Main, something like:

io.cucumber.core.cli.Main.main(new String[]{
        "--glue",
        "the package which contains the glue classes", 
        "/your/feature/file"});

Check out Running Cucumber -> From the command line for all the available arguments explained. By the way, you can use OS Process Sampler for this, it will be way easier.


Depending on what you're trying to achieve it might be faster and easier to convert your Selenium tests into "native" JMeter ones as if you're going to use your Selenium tests for creating the load it will require immense hardware resources and you won't get performance metrics on the HTTP protocol level.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.