Selenium Cucumber Java BDD Framework 11 | How to run from CommandLine

preview_player
Показать описание
Hi, I am Raghav. You can follow the notes here:
1 - What is Command Line execution
2 - Why to use Command Line
3 - When to use Command Line
4 - How - Step by Step Demo

#CucumberJavaTutorials
Running your tests or features from command line or terminal without using the IDE or GUI
Command Line
Terminal
Console

Why to use Command Line
No dependency on IDE or GUI
Useful in integrations with other processes
Continuous Integration, Delivery and Deployment
Easier & Faster
Consumes less memory

When to use Command Line
Whenever you need to run the tests faster without opening IDE
Whenever you need to do integrations with other processes
CI, CD, DevOps
Whenever using CI tools like Jenkins
Whenever you need any batch or scheduled execution
Whenever you are done with your test creation and setup

Step 1 - Right-click on the project and select Run As - Maven test
Step 2 - Check the console logs
Step 3 - Troubleshoot and correct the errors
Step 4 - Open CMD prompt
Step 5 - Check MAVEN is installed mvn -version
Step 6 - CD to the project location
Step 7 - Run command mvn test

By default mvn test will run the files with naming syntax
**/Test*.java

Overriding Cucumber Options from Command Line
mvn test

Running with multiple parameters
Can run with multiple parameters from command line

example
mvn test

Every LIKE & SUBSCRIPTION gives me great motivation to keep working for you

You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can.

________ ONLINE COURSES TO LEARN ________

Never Stop Learning
Raghav
Рекомендации по теме
Комментарии
Автор

Usually MNC'S give Training but in that they also didn't teach this, Thanks for this Hidden jam Raghav, I appreciate your hard work

ajinkyadhoke
Автор

I would definitely recommend everyone who is a beginner in this automation field like me.
These videos helped me a lot in my projects... ❤️❤️

muhammadasifansari
Автор

Hi Raghav:
Thank you so much for sharing your amazing courses. I love them and am learning soooo much.

sunshineandsmilesk
Автор

Hey Raghav:
Thank you so much for sharing this amazing courses....

deepeshjain
Автор

Thanks Raghav. Appreciate your efforts

jagratsahoo
Автор

Hi Raghav, thanks you very much for informative video. I really appreciate this session it's simple as you explain it.

rahuljadhav
Автор

Hi Raghav sir, The videos are quite helpful. I have couple of questions:
1) Can the background be used across multiple feature files?
2) In my project I have to cache couple of values in run time and use it in across multiple feature files. Is it possible? If so could you please provide a video for it?

vanithasadhu
Автор

You mentioned but did not show how to run a specific runner. If it is, for example, in

rebelScience
Автор

Great Info. Very useful and clearly explained. Thanks Raghav.🙌

krishnamoorthynatarajan
Автор

Hi Raghav, I using this command on cli mvn test -Dcucumber.options="-tags @regressionUI"
but facing an issue like this

[ERROR] Unknown lifecycle phase ".options=-tags @regressionUI". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-
Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resourc
es, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, proces
s-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clea
n, pre-site, site, post-site, site-deploy.

:( :( :(

weleyam
Автор

Thanks a lot Raghav for this helpful tutorial.

abdulnazer
Автор

If anyone has trouble with the commands execution those are the new command (at least for junit), I didn't check for testNG :

For example, if you are using Maven and want to run a subset of scenarios tagged with @smoke:

Supported properties are:

# true or false. default: false
cucumber.execution.dry-run= # true or false. default: false
cucumber.execution.limit= # number of scenarios to execute (CLI only).
cucumber.execution.order= # lexical, reverse, random or random:[seed] (CLI only). default: lexical
cucumber.execution.wip= # true or false. default: false.
cucumber.features= # comma separated paths to feature files. example: path/to/example.feature, path/to/other.feature
cucumber.filter.name= # regex. example: .*Hello.*
cucumber.filter.tags= # tag expression. example: @smoke and not @slow
cucumber.glue= # comma separated package names. example: com.example.glue
cucumber.plugin= # comma separated plugin strings. example: pretty, json:path/to/report.json
cucumber.object-factory= # object factory class name. example: com.example.

Also a question for you @Raghav, do you know how can I cancel the execution for the tests inside a Test Class? The problem is that if I want to execute only a feature, it executes also all of the @Test annotations from project, I have a separate class where I have some tests like this, ex:


@Test
public void throws IOException {
Assert.assertTrue("Searching for something is not successful", Login - Practice Test Automation"));
}

UCIUbafblNQGAqO
Автор

Thanks Raghav for this amazing video. I have an issue with my project when run through cmd, scenario get executed but shows 0 test 0 fail. Could you please help in troubleshooting.

amitmalik
Автор

​ @Automation Step by Step - Raghav Pal
I am running mvn test It is showing BUILD success, but not showing any test results, like your video showing. Could u please le me know, why?

mushfiquazaman
Автор

Hey Raghav,
I really appreciate this session its as simple as you explain it !

Can you tell me when will the hooks session be available ?

mostafanader
Автор

Thanks, @Raghav for taking this topic into consideration & making a video on this. Its really helpful 😊👍👍

SarangHoley
Автор

Hi Raghav, thank you very much for the informative video.
At 8:04 i observed couple of packages like "steps for background" and "steps for hooks"
and multiple test runner files as well. In which video did you explain that? Please let us know

I saw the hooks video but these packages were not present in that one.

saikiranpalugula
Автор

Is the 'T' always in capital for runner file ? or 't' in smaller case also fine ?

ChiragVermaVlogs
Автор

hey i am getting an error in console that is MojoFailureException what should i do

mayurigawali
Автор

Hi Raghav,
Hope all are well, This is amazing video but I have one doubt. I.e, here we are using the multiple -Dcucumber.options but it runs the only one option(35:18 to 36:05), is it correct. Then what is the difference between multiple options and a single option?

Please clarify the same. Thanks in advance.

sappanimuthubalasubramania