Selenium Framework for Beginners 38 | How to run Selenium TestNG tests with Maven Command Line

  Рет қаралды 45,323

Automation Step by Step

Automation Step by Step

Күн бұрын

Пікірлер: 190
@akshaybhatia7977
@akshaybhatia7977 3 жыл бұрын
I wish I should have watch this video before attending my interview today 😊 Very important confirm I must say. Thanks for sharing.
@RaghavPal
@RaghavPal 3 жыл бұрын
Glad it was helpful Akshay
@svetlanamazhaykina6918
@svetlanamazhaykina6918 4 ай бұрын
Thank you for your work, Raghav! Well done!
@RaghavPal
@RaghavPal 4 ай бұрын
Most welcome
@kosta2177
@kosta2177 4 жыл бұрын
That was exactly what I needed on my task. I had to set up two separate Jenkins jobs to run different tests from the same project repository. Thank you so much.
@RaghavPal
@RaghavPal 4 жыл бұрын
Glad it helped!
@toxicjtv2466
@toxicjtv2466 2 жыл бұрын
Thank you so much - was stuck on this problem all day and you've helped me solve it. Keep up the good work, you are an amazing teacher.
@RaghavPal
@RaghavPal 2 жыл бұрын
So happy & humbled to know this
@miketysonschwarzeneggerpra9215
@miketysonschwarzeneggerpra9215 4 жыл бұрын
Thank very much, your channel is the better channel about automation. Clear explanation
@RaghavPal
@RaghavPal 4 жыл бұрын
Glad to hear that Mike
@AC-vt1nq
@AC-vt1nq 3 жыл бұрын
I was very impressed with clarity and simplicity of presentation. Excellent !!!!
@RaghavPal
@RaghavPal 3 жыл бұрын
Thanks a lot
@mzamomahaeng268
@mzamomahaeng268 3 жыл бұрын
You are making me look so good at work :-) Thank you for the videos again sir.
@RaghavPal
@RaghavPal 3 жыл бұрын
So nice of you Mzamo
@tonyatonya4805
@tonyatonya4805 6 жыл бұрын
Looks really nice your tutorial. One thing: You can also use Ubuntu for win 10 - is sort of an Os inside a OS and is really helpful . Is working perfectly. Cuz my Local laptop has some issues with git account sync , one day i thought - why not trying Ubuntu Win10. Tnx again for uploading this video and Keep going!!!!
@RaghavPal
@RaghavPal 6 жыл бұрын
Thanks for the info Tonyka
@abuqadeer7833
@abuqadeer7833 5 жыл бұрын
Short and very clear explanation, thx!
@RaghavPal
@RaghavPal 5 жыл бұрын
You're welcome Abu
@revathyrao8776
@revathyrao8776 4 жыл бұрын
Thanks much for making a such a detailed video. Very useful one. I am now referring ur videos to my friends.
@RaghavPal
@RaghavPal 4 жыл бұрын
Awesome Revathy, you will find all here - automationstepbystep.com/
@shubhammalunjkar4552
@shubhammalunjkar4552 Жыл бұрын
Thank you its very helpful
@RaghavPal
@RaghavPal Жыл бұрын
You're welcome!
@samikshyamishra5964
@samikshyamishra5964 4 жыл бұрын
Short and crystal clear explanation.. Thank you
@RaghavPal
@RaghavPal 4 жыл бұрын
Most welcome Samikshya
@siddarajus7166
@siddarajus7166 2 жыл бұрын
Nice teaching sir
@RaghavPal
@RaghavPal 2 жыл бұрын
Thanks and welcome
@gopichandan9809
@gopichandan9809 5 ай бұрын
Thank you so much Sir
@RaghavPal
@RaghavPal 5 ай бұрын
Most welcome
@louisaguo2744
@louisaguo2744 5 жыл бұрын
Thank you Raghav, you are very nice and share the thing you learn free for everyone, and reply most every comment...amazing...I just wondering if you can share the way how you learn new things? since there are so much to learn and it seems impossible to remember all the things at one time, but you really did a very good job and you learned so many tools and explained so clear.
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Louisa, thanks a lot for your message. I got exposure to a lot of things during my career and now as a teacher I keep learning and teaching.
@bhaskartimothy3146
@bhaskartimothy3146 3 жыл бұрын
Thank you sir.
@RaghavPal
@RaghavPal 3 жыл бұрын
Most welcome Bhaskar
@Fury-qq3px
@Fury-qq3px 4 жыл бұрын
Much detailed and informative..
@RaghavPal
@RaghavPal 4 жыл бұрын
Thanks Sai
@kiranshinde8205
@kiranshinde8205 5 жыл бұрын
Nice explanation
@RaghavPal
@RaghavPal 5 жыл бұрын
Thanks for watching Kiran
@aswathym.r8667
@aswathym.r8667 3 жыл бұрын
Hi Raghav Videos are crisp and clear 👏. An interview question: what is the maven command to execute multiple tests ( For example: 100 tests) at a time
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Aswathy, actually you can use mvn test and it will run all the tests or files in src/test/java folder
@yuvali3152
@yuvali3152 3 жыл бұрын
Clear explanation. tnx!
@RaghavPal
@RaghavPal 3 жыл бұрын
Glad it was helpful Yuval
@dheerajsingh6568
@dheerajsingh6568 6 жыл бұрын
Best of best Raghav ji....
@RaghavPal
@RaghavPal 6 жыл бұрын
Glad it helped Dheeraj
@ShivaKumar-xx8do
@ShivaKumar-xx8do 4 жыл бұрын
Excellent explanation, Thank you :)
@RaghavPal
@RaghavPal 4 жыл бұрын
You're welcome Shiva
@mudaseer21
@mudaseer21 3 жыл бұрын
thanks i am able to run from cmd line
@RaghavPal
@RaghavPal 3 жыл бұрын
Most welcome Mudaseer
@prasadreddy9579
@prasadreddy9579 2 жыл бұрын
Hi Raghav - Can you please put a video to show how to bundle this project as a jar and with executable capability so that I can take this bundle and run it on other VMs. Not just only the local machine where the project is created. For same the TestNG selenium one built from Maven.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Prasad, you can check this video - kzbin.info/www/bejne/h3OUaoqnntKep5Y, however running through jar may not be the most efficient way, you can create a maven project, add it to a cloud repo like GitHub and have commands to clone and run the project from anywhere
@sym-john7795
@sym-john7795 4 жыл бұрын
How do I add OpenCV in an executable jar with maven? Would you please make a tutorial on this or any suggestion could help. BTW you are doing great brother.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi, I will check and if possible will create a session
@siddarajus7166
@siddarajus7166 2 жыл бұрын
Sir could you make a video on maven cmd parameters
@RaghavPal
@RaghavPal 2 жыл бұрын
I will do, can find some existing videos here automationstepbystep.com/
@UdayKiran-tc9ku
@UdayKiran-tc9ku 5 жыл бұрын
awesome raghav
@RaghavPal
@RaghavPal 5 жыл бұрын
Thanks Uday
@DucNguyen-xn5bd
@DucNguyen-xn5bd 5 жыл бұрын
Hi Raghav, can I run selenium by command line but without TestNG. example, I just write very basic class with open google page, no TestNG framework inside.
@RaghavPal
@RaghavPal 5 жыл бұрын
You can, like you run any java class from command line. Can check this - kzbin.info/www/bejne/hZCqkGlsg7ajirs
@quadriyusuf8431
@quadriyusuf8431 2 жыл бұрын
Thanks Raghav for your effort and contribution to the community. I have a situation at work making my tests to fail on Jenkins; something that was not happening until recently. How can I disable/close/skip browser alerts in command line for a Selenium test? Command line does not support it.
@RaghavPal
@RaghavPal 2 жыл бұрын
I will need to see the details on why CLI does not support
@quadriyusuf8431
@quadriyusuf8431 2 жыл бұрын
@@RaghavPal sorry for the late response. It looks like it's not a CLI issue but I'm yet to find a fix for the issue. Jenkins build for my Maven POM tests still fails due to timeout after 10minutes even though everything runs fine locally. Error on Jenkins is "Build Aborted. Not looking for any TestNG results"
@deepakMCA2009knit
@deepakMCA2009knit 4 жыл бұрын
Hi Raghav, Can you please help me to get a help/tutorial video to run testng.xml from command line. I gone through many links and have only idea that it is something like java -cp ---- - - bin;---- lib;- - - - org.testng.TestNG testng.xml and I tried many ways to use this but test cases not ran.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Deepak, check here - stackoverflow.com/questions/11896791/how-to-run-testng-from-command-line
@dnya4512
@dnya4512 4 жыл бұрын
Thank you Raghav ..!! This was really helpful. After executing from command line I am running a test manually which basically email me emailable-report created in surefire folder. But the problem is it is mailing the earlier executed report and not the latest one. So I am first executing all test from Maven and then run that email-sending test from testng command. This solves the problem. However could you please guide me if there could be better way to achieve this ?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi, I will have to see the setup, you can put a code to get the latest file from a folder.
@jegarapiag6965
@jegarapiag6965 2 жыл бұрын
Hello Raghav, how do you run a TestNg Selenium project using the methods you listed here. I want at least to see that a Selenium project with ChromeDriver is executing..please advise. Thank you.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Jegar, this is a complete series, and it should be convered in some videos, Pls check - automationstepbystep.com/
@gayatritankar7856
@gayatritankar7856 5 ай бұрын
Hello Sir, How do I Set Global Parameters using Maven commands and Update tests at run time? Do you have any video regarding this, I am getting errors repeatedly. D:\Eclipse Workspace_Selenium_Udemy\SeleniumFramework>mvn test -PPurchase -Dbrowser=edge #Raghavpal
@RaghavPal
@RaghavPal 5 ай бұрын
Gayatri Setting global parameters and updating tests at runtime in Selenium Java using Maven can be done by configuring your `pom.xml` file and using Maven profiles and properties. Here's a step-by-step guide to help you: 1. Define Maven Profiles: - In your `pom.xml`, define profiles for different test configurations. Each profile can specify different properties. ```xml Purchase edge ``` 2. Use Properties in Tests: - In your Java test code, you can access these properties using System.getProperty(). ```java String browser = System.getProperty("browser"); // Use the 'browser' variable to set up your WebDriver accordingly ``` 3. Run Tests with Maven Command: - Use the Maven command to run tests with the specified profile and properties. ```shell mvn test -PProfileName -Dproperty=value ``` - For example, to run tests with the "Purchase" profile and set the browser to Edge, you would use: ```shell mvn test -PPurchase -Dbrowser=edge ``` 4. Update Tests at Runtime: - To update tests at runtime, you can pass additional parameters via the command line or modify the properties in the profile before running the tests. 5. Troubleshooting Errors: - If you're getting errors, make sure that the profile and property names used in the Maven command match those defined in your `pom.xml`. - Ensure that your test code correctly handles the properties passed from Maven. - Check the Maven output for error messages that can provide clues about the issue. for tutorials, you can search for tutorials on platforms like KZbin using keywords like "Selenium Java Maven tutorial" to find comprehensive guides and walkthroughs. Remember to always keep your `pom.xml` and test code synchronized with the parameters you intend to use. This will help you avoid errors and ensure that your tests run as expected with the desired configurations ..
@scaratlas3347
@scaratlas3347 2 жыл бұрын
I have a complation error where it says No compiler is provided in this environment. Perhaps you are running on a JRE rather a JDK? The problem is I have a JDK installed. I tried solutions from stackexchnage but they didn't work
@RaghavPal
@RaghavPal 2 жыл бұрын
what output do you get when your run command javac -version
@PoojaGupta-oq4vv
@PoojaGupta-oq4vv 4 жыл бұрын
How can generate a Runnable jar file for these test cases and run that jar file from command prompt.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Pooja, Although I will not suggest running through JAR but still if you need to can watch this - kzbin.info/www/bejne/h3OUaoqnntKep5Y
@ManishKumar-vu1nc
@ManishKumar-vu1nc 2 ай бұрын
While adding testng file at <a href="#" class="seekto" data-time="611">10:11</a> is it necessary to add the same in properties tag?
@RaghavPal
@RaghavPal 2 ай бұрын
Manish In general, when you add a TestNG file (e.g., `testng.xml`) to a Selenium Java project, you don't necessarily need to update a `properties` tag with the same information. The `testng.xml` file is used to configure TestNG tests, including specifying test classes, methods, and suites. The file is typically used to define the test execution sequence, and TestNG will automatically pick up the tests defined in this file. On the other hand, a `properties` tag is usually used to configure project-specific properties, such as environment variables, database connections, or other settings that are not directly related to TestNG. Unless you have a specific requirement to configure a property related to the TestNG file, it's not necessary to update a `properties` tag when adding a TestNG file to your project. -
@mahikarnati3630
@mahikarnati3630 3 жыл бұрын
I'm getting compilation failure on command prompt ,when I enter mvn clean test. Can you please resolve it?
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Mahi, what is the error, pls check the logs and setup
@ngavu2066
@ngavu2066 2 жыл бұрын
Thank you so much for clearly explanation. But i was BUILD ERROR after run mvn clean test due to 2 errors: Source option 5 is no longer supported. Use 7 or later / Target option 5 is no longer supported. Use 7 or later. Please help me
@PRINCERAJ-yf6ey
@PRINCERAJ-yf6ey 2 жыл бұрын
you can paste here the complete error logs here so that can find the issue
@RaghavPal
@RaghavPal 2 жыл бұрын
pls check if this helps you Right Click on Project. Click on Build path. Click on Configure Build path. It opens a Java Build path window. Click on Java Compiler in the Left side. It navigates to Java Compiler window in that to set the Compiler compliance level is set as according to your jre version(ex if java version is 1.8 then choose 1.8) as select. Click on [Apply] button. Click on [OK] button. Right click on Project > Maven > Update the project. Right click on Project > Run As > Maven install -- The pom.xml file is running and java jars are download and installed to project. Right click on Project > Run As > Maven Test -- The pom.xml file is running and java jars are download and installed to project. stackoverflow.com/questions/53034953/error-source-option-5-is-no-longer-supported-use-6-or-later-on-maven-compile
@shubhambhoskar6014
@shubhambhoskar6014 3 жыл бұрын
I have various test cases and used to run smoothly using tesng.xml But after implementing this as shown in the video the cmd shows complier error And also my smooth running testng.xml is showing error as “Cannot find class in classpath : testfilename “ Please help me out here
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Shubham, pls check this stackoverflow.com/questions/7600898/testng-error-cannot-find-class-in-classpath
@aneeshnair467
@aneeshnair467 3 жыл бұрын
Hi Raghav, Thank you so much for the videos you create. I have a quick question, How do you stop the execution triggered through mvn test? I tried Ctrl+C to stop, I see the maven gets stopped in command prompt but the execution still continues in the browser? How can I kill the whole execution?
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Aneesh, ideally if you stop the process from cmd it should stop. May be it has buffered some steps
@sumanthbs2555
@sumanthbs2555 3 жыл бұрын
Sir, How to re-run failed test cases by maven command?
@RaghavPal
@RaghavPal 3 жыл бұрын
You can use testng features for this and run the command with mvn
@ankitshrivastava1772
@ankitshrivastava1772 Жыл бұрын
Hello Raghav, when i run as maven then it shows build success but my selenium script doesn't execute, what can be the cause? Using ubuntu machine.
@RaghavPal
@RaghavPal Жыл бұрын
Hi Ankit, I will need more details and logs to check the root cause, Here are some possible reasons: Incorrect dependencies: Make sure you have included all the required dependencies for Selenium and WebDriver in your project's pom.xml file. Incorrect script location: Make sure your Selenium script is located in the correct directory in your project and is being picked up by Maven during the build. Incorrect test configuration: If you are using TestNG or JUnit, make sure that your test configuration is correct and your test class is being executed by Maven during the build. WebDriver initialization issues: Make sure that the WebDriver is being initialized correctly in your script and that it is able to connect to the correct browser. Browser compatibility issues: Make sure that the browser version you are using is compatible with the version of WebDriver you have installed. Incorrect element locators: Make sure that the locators you are using in your script are correct and that they can locate the elements in the page.
@HimanshuKumar-rf8kj
@HimanshuKumar-rf8kj 2 жыл бұрын
How did you autocomplete the XML file while editing , if you can tell that would be a great help :)
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Himanshu, I can check if you provide the exact time, but in general if you are using any tool or platform with support for xml , you can do autocomplete using TAB
@HimanshuKumar-rf8kj
@HimanshuKumar-rf8kj 2 жыл бұрын
@@RaghavPal Hi sir thanks for the reply , the time for the vidoe is "kzbin.info/www/bejne/ooKmqomvYsxkm5o" . I have tried using TAB for autocomplete the XML but it did not work for me in the Eclipse, Is there any plugin that i need to donwload for it ?Also can you please suggest any plugin in eclipse via which i can read the JAR files ( to check its methods/classes)??
@PRINCERAJ-yf6ey
@PRINCERAJ-yf6ey 2 жыл бұрын
hi Raghav i was using maven sure-fire with system properties so i used ${url} in pom while running from CMD how i will provide the url like for suite file we give -Dsuite=suitefileName.xml
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Prince, what issue you get when you pass url, show me the setup and logs
@barryismaila1723
@barryismaila1723 4 жыл бұрын
Hello, I did every step but the test are not runing with maven. It works in eclipse but it says that org.junit doesn't exists. Help please
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Barry, just check your pom.xml. Does it have dependency for junit? If not add and if already present check the junit junit 4.12 test If the scope is test, it will work for classes/scripts present only in test folder i.e. src/test/java. May be your file/class you are running is in src/main/java. Pls check. You can remove scope node.
@barryismaila1723
@barryismaila1723 4 жыл бұрын
@@RaghavPal thank u for the answer. I'm using junit5 and yes my class test is in src/test/java
@RaghavPal
@RaghavPal 4 жыл бұрын
Okay, try checking with junit 4 stable ver.
@karventhanrangasamy6126
@karventhanrangasamy6126 4 жыл бұрын
Hi Gaurav, excellent one. thanks a lot. I am getting "The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:3.0.0-M4 is missing, no dependency information available" error all time. I tried changing the version also. But the same error with the mentioned version number. Kindly do me the needful.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Karventhan, try to add the library from here maven.apache.org/surefire/maven-surefire-plugin/dependencies.html
@nehashukla3685
@nehashukla3685 4 жыл бұрын
Hi Raghav,When i am try to run Selenium TestNg test with Maven command line i am getting this errror: [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ learnmaven --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Neha\Selenium\SeleniumJavaProject\learnmaven\src\main esources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ learnmaven --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Project\Selenium\SeleniumJavaProject\learnmaven\target\classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.803 s [INFO] Finished at: 2020-04-03T<a href="#" class="seekto" data-time="979">16:19</a>:52-<a href="#" class="seekto" data-time="240">04:00</a> [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project learnmaven: Compilation failure -> [Help 1]
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Neha, you can try to add the following in the properties section of pom.xml 1.8 1.8 Version can be updated as per your java ver stackoverflow.com/questions/42525139/maven-build-compilation-error-failed-to-execute-goal-org-apache-maven-plugins
@tantaatoyvlogs2425
@tantaatoyvlogs2425 4 жыл бұрын
when run the tests through maven command line the emailable-report.html is not updating
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Chandra, it can be due to location issue, Pls check this - stackoverflow.com/questions/44176482/testng-emailable-report-is-not-updating
@NEHAGUPTA-qw9hp
@NEHAGUPTA-qw9hp 4 жыл бұрын
Hi Raghav I am running the sikuli code for file upload to a site but I get the error maven surefire plugin failed to 2.19.1 : fork VM terminated without saying goodbye. Command was cmd /X /C sort of error I tried using surfirr plugin 2.19.1 ,2.22.0 and 2.18.1 but same error ..Can u help
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Neha, although you have not given the complete details and cause, pls check This can help - stackoverflow.com/questions/31221182/failed-to-execute-goal-org-apache-maven-pluginsmaven-surefire-plugin2-18-1tes
@Emfar
@Emfar 2 жыл бұрын
In a gradle selenium project how to run test from testng?
@RaghavPal
@RaghavPal 2 жыл бұрын
I have not done session with gradle, but you can find testng related videos in this playlist
@shivam1427
@shivam1427 4 жыл бұрын
Great tutorial as always. However I have 2 questions: 1. Is it possible to have a framework where in your selenium test framework (TestNg + Maven) and run in a docker container and then have the nodes spinup in another docker container. I think this can be achieved using docker compose. But I am not able to figure the exact solution for this. 2. How to run testNG xmls files or the jars from terminal using the java -cp command. I always get the below error for both: ``` java testng.xml java Demo-test.jar ``` Error: Could not find or load main class target.Demo-test.jar Caused by: java.lang.ClassNotFoundException: target.Demo-test.jar
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Shivam, 1. Yes you can run using Docker containers. I have not yet created videos on this and for now you can take some online help 2. If you are using testng, then your classes may not be having main method. In that case you can run testng.xml files from command line. You will find tutorials on that later in this series
@hazimabdoh6303
@hazimabdoh6303 2 жыл бұрын
Thank you so much , i have one question pls , when i execute the command : mvn clean test from my project location nothing happend the curser return back to the command line without showing any error or result , note that before executing the command , i copied the mvn from C:\Program Files\apache-maven-3.8.6-bin\apache-maven-3.8.6\bin to my project loation, please i am waiting your reply .special thanks.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Hazim, hope you are running the command from project folder, Can try on a new cmd
@hazimabdoh6303
@hazimabdoh6303 2 жыл бұрын
@@RaghavPal dear sir , now its working fine after i provide the full path of mvn location in the environment variable : C:\Program Files\apache-maven-3.8.6-bin\apache-maven-3.8.6\bin , but after executing the command it shows me thats the BUILD FAILURE : ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:14 min [INFO] Finished at: 2022-07-07T01:57:45+03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project seleniumjavaframework: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoFailureException are there any solution ? note : when executing the command : mvn clean , it shows me BUILD success. thanks in advance
@RaghavPal
@RaghavPal 2 жыл бұрын
pls check if this helps you Right Click on Project. Click on Build path. Click on Configure Build path. It opens a Java Build path window. Click on Java Compiler in the Left side. It navigates to Java Compiler window in that to set the Compiler compliance level is set as according to your jre version(ex if java version is 1.8 then choose 1.8) as select. Click on [Apply] button. Click on [OK] button. Right click on Project > Maven > Update the project. Right click on Project > Run As > Maven install -- The pom.xml file is running and java jars are download and installed to project. Right click on Project > Run As > Maven Test -- The pom.xml file is running and java jars are download and installed to project. stackoverflow.com/questions/53034953/error-source-option-5-is-no-longer-supported-use-6-or-later-on-maven-compile
@ramanwalia007
@ramanwalia007 4 жыл бұрын
Hi Raghav, I am Harmeet..I want to ask you , can we add more than one testng.xml files under the tag suitexmlfile..then all my testng.xml file can run one after another. Thanks
@RaghavPal
@RaghavPal 4 жыл бұрын
You can, also check if it goes into a loop
@shalinirakesh3455
@shalinirakesh3455 4 жыл бұрын
Good Explanation. I want to execute my selenium tests from command line in a linux machine.How can i do that?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Shalini, you will have to have your project there and then you can use the same commands. You will need headless browsers. I will plan for a session, Meanwhile pls take online help
@shalinirakesh3455
@shalinirakesh3455 4 жыл бұрын
@@RaghavPal Thanks a lot. I will try that
@shalinirakesh3455
@shalinirakesh3455 4 жыл бұрын
Hi Raghav, How do i send the build number as parameter while running tests from command line?Also i want to use the build number entered in command line as a reference for my test cases. Like if i create a account in google it should have the build number in the account name so that anyone can understand the record was created by automation for a particular build. Is it possible?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Shalini, are you can do with testng parameters - stackoverflow.com/questions/37696990/how-to-pass-parameter-to-testng-in-command-line
@shalinirakesh3455
@shalinirakesh3455 4 жыл бұрын
Thank you Raghav. I will try and let you know
@asifuzzamanbappy1297
@asifuzzamanbappy1297 4 жыл бұрын
Hello Again, Is There Any Better Alternative Than Downgrading Java JDK To (JDK1.8) From (JDK 12.0.1) To Compile Maven Tests From Command Line?? Command : mvn clean Works Just Fine, But For Running Tests It Throws [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. Any Comments Are Appreciated...
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Asif, I will have to check on this. Meanwhile see if this helps you - stackoverflow.com/questions/52232681/compile-and-execute-a-jdk-preview-feature-with-maven
@ankitathakur1930
@ankitathakur1930 4 жыл бұрын
Hi Raghav.....when I am giving mvn clean install command..... it says mvn is not recognised as an internal or external command.
@RaghavPal
@RaghavPal 4 жыл бұрын
That means maven is not setup on your system. Check how to install maven under Maven section here automationstepbystep.com/
@ankitathakur1930
@ankitathakur1930 4 жыл бұрын
@@RaghavPal Thank u so much
@venkateshbathina3220
@venkateshbathina3220 4 жыл бұрын
Hi Raghav , if I am running testng.xml from maven ,test-output folder is not creating in project . Can you please help me here
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Venkatesh, what is the error, pls check all the steps again
@venkateshbathina3220
@venkateshbathina3220 4 жыл бұрын
@@RaghavPal There is no error in command prompt ,but test-output is not getting created in eclipse folder structure (i tried refreshing the folder)
@harinat
@harinat 5 жыл бұрын
Thank you Raghav. It helped. I want to run my test on different machine without installing Eclipse. How can i copy these test dlls and run test. I am a .net guy not Java. Can you help. I just need to run the tests using command line and i dont want to expose my test code.
@RaghavPal
@RaghavPal 5 жыл бұрын
In java, we can create jar files. I have not yet covered .net, dll etc. Will try to cover these soon
@thellamaswinkumar50
@thellamaswinkumar50 4 жыл бұрын
@@RaghavPal hi how can we run pom.xml from a jar fule
@chandrasekharnasaka4973
@chandrasekharnasaka4973 4 жыл бұрын
When I run a testng.xml with 4 classes in it..the methods in those classes are not running..only login/ logout is happening.when run 1 class through XML file the test in those are running.what would be the error
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Chandra, I will need to see the setup
@shilupg
@shilupg 4 жыл бұрын
Hi Raghav, whether we can use cucumber along with TestNG, if yes how we can run the test suite from command line
@RaghavPal
@RaghavPal 4 жыл бұрын
Yes we can Shilu. I will create a video on that
@shilupg
@shilupg 4 жыл бұрын
@@RaghavPal thanks . Because I got a confusion, if cucumber is there the test will be driven based on the feature file, and results also generate based on that, so my confusion is ,what the significance of adding TestNg also, if you can clarify that it will be great
@RaghavPal
@RaghavPal 4 жыл бұрын
Okay for now you can refer these links www.lambdatest.com/blog/automation-testing-with-selenium-cucumber-testng/
@pborse386
@pborse386 4 жыл бұрын
Hi Raghav, I want to pass the as value Parameters from properties file using command line, like username and password, could you please give me the some solution for this
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Popat, this can help you - stackoverflow.com/questions/13245411/how-to-pass-java-code-a-parameter-from-maven-for-testing
@sudeepsharma6917
@sudeepsharma6917 3 жыл бұрын
Hi Raghav, I have tried to run from command line but it is giving build failure error every time- :\Users\sudee\git\Seleniumjavaframework11\Seleniumjavaframework>mvn clean test [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for Seleniumjavaframework:Seleniumjavaframework:jar:0.0.1-SNAPSHOT [WARNING] 'dependencies.dependency.version' for com.applitools:eyes-selenium-java3:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 46, column 14 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------< Seleniumjavaframework:Seleniumjavaframework >------------- [INFO] Building Seleniumjavaframework 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Seleniumjavaframework --- [INFO] Deleting C:\Users\sudee\git\Seleniumjavaframework11\Seleniumjavaframework\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Seleniumjavaframework --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Seleniumjavaframework --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! [INFO] Compiling 2 source files to C:\Users\sudee\git\Seleniumjavaframework11\Seleniumjavaframework\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Seleniumjavaframework --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Seleniumjavaframework --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! [INFO] Compiling 25 source files to C:\Users\sudee\git\Seleniumjavaframework11\Seleniumjavaframework\target\test-classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Test/Extendsreportbasicdemo.java:[37,15] ';' expected [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Utils/Excelutilitiesdemo.java:[8,23] expected [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Utils/Excelutilitiesdemo.java:[8,22] not a statement [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Utils/Excelutilitiesdemo.java:[11,2] reached end of file while parsing [INFO] 4 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.448 s [INFO] Finished at: 2021-01-10T<a href="#" class="seekto" data-time="1348">22:28</a>:11-<a href="#" class="seekto" data-time="300">05:00</a> [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project Seleniumjavaframework: Compilation failure: Compilation failure: [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Test/Extendsreportbasicdemo.java:[37,15] ';' expected [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Utils/Excelutilitiesdemo.java:[8,23] expected [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Utils/Excelutilitiesdemo.java:[8,22] not a statement [ERROR] /C:/Users/sudee/git/Seleniumjavaframework11/Seleniumjavaframework/src/test/java/Utils/Excelutilitiesdemo.java:[11,2] reached end of file while parsing [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Can u please help me what is the issue here, so that i can fix that?
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Sudeep, loos like some syntax issue in Excelutilitiesdemo.java Pls check
@sanjanasr1404
@sanjanasr1404 4 жыл бұрын
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project cu-auto-test: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: testSuiteXmlFiles0 has null value -> [Help 1] i am getting this error, can anyone help me ?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Sanjana, This can help - stackoverflow.com/questions/31221182/failed-to-execute-goal-org-apache-maven-pluginsmaven-surefire-plugin2-18-1tes
@prakratiagarwal8237
@prakratiagarwal8237 4 жыл бұрын
I have a requirement where I want to run my tests using only .exe or a batch file without having the source code as client needs to run it .Is it possible to do ?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Prakrati, you can compress it in a jar, but not sure if that will be efficient, We always have the option of storing the project on cloud repo like github and on any system get it from there and run.
@kiranshinde8205
@kiranshinde8205 5 жыл бұрын
Sir how to create batch file for xml..I have created..but when I run this file execution start in cmd but exit after completing run..how to pause to cmd
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Kiran, pls explain in detail and the steps you have tried
@rajeshdevan6051
@rajeshdevan6051 5 жыл бұрын
Hi Raghav, could you please explain little bit slowly?
@RaghavPal
@RaghavPal 5 жыл бұрын
Okay Rajesh, in case you are also doing hands-on along with the video, you can pause and resume
@rajeshdevan6051
@rajeshdevan6051 5 жыл бұрын
@@RaghavPal ya tried like you said but its taking more time to understand that's y its k raghav if you can do otherwise I manage that and thank you
@RaghavPal
@RaghavPal 5 жыл бұрын
Sure, I will take care. Just that few people want it to be fast, as the option to pause is always there, But i will go step by step
@anubhagupta1871
@anubhagupta1871 4 жыл бұрын
Hi I am getting compilation error after running mvn clean test but mvn clean works fine
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Anubha, will need to see the error details/logs to troubleshoot. Just check what's the reason you get on failure
@ankitshrivastava1772
@ankitshrivastava1772 4 жыл бұрын
Hi, Raghav i am facing "MAVEN/MojoFailureException" .
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Ankit, Can you try to run cmd as administrator and try the command again
@Cainprime
@Cainprime 5 жыл бұрын
Thank you very much for the tutorial Raghav! I went through this and ran into an odd error and i'm not sure eactly is wrong. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project SeleniumFramework: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 7 or later. [ERROR] Target option 5 is no longer supported. Use 7 or later. Can you or anyone help me figure this one out?
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Michael, what is your java version. You can goto cmd and run command java -version You may be using JDK9 or later Your project uses maven-compiler-plugin with an old version which defaults to Java 5. You can also try to add following in pom.xml in the project tag 1.7 1.7 References github.com/jflex-de/jflex/issues/400 stackoverflow.com/questions/49028810/error-source-option-1-5-is-no-longer-supported-use-1-6-or-later
@Cainprime
@Cainprime 5 жыл бұрын
@@RaghavPal Thank you! This works fine now after adding the target version!
@usmankarim5236
@usmankarim5236 4 жыл бұрын
Hi Raghav i am trying to add only one class through include TAG but it still running my whole xml can you help me to solve this problem?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Usman, will have to see your setup
@usmankarim5236
@usmankarim5236 4 жыл бұрын
@@RaghavPal how i can show you??
@usmankarim5236
@usmankarim5236 4 жыл бұрын
@@RaghavPal is there any way i can contact you?
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Usman you can email me raghav.qna@gmail.com
@yuvraj4870
@yuvraj4870 5 жыл бұрын
how do we do all this without using IDE at all.
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Yuvraj, do you mean creating framework and all w/o IDE, It will be difficult.
@yuvraj4870
@yuvraj4870 5 жыл бұрын
@@RaghavPal Yes all the process you demonstrated but using command prompt only.
@suchetavyavahare1743
@suchetavyavahare1743 2 жыл бұрын
Hi Raghav please check the below errors. I have tried to fix it but was unable to resolve it. Please reply to me asap[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.788 s [INFO] Finished at: 2021-11-26T<a href="#" class="seekto" data-time="855">14:15</a>:22+<a href="#" class="seekto" data-time="330">05:30</a> [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project FinalDemo: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
@RaghavPal
@RaghavPal 2 жыл бұрын
add this in pom.xml file 1.8 1.8 Can update the ver as per the java ver on your system
@A.B.00007
@A.B.00007 5 жыл бұрын
"mvn clean" runs fine but "mvn clean test - with function attribute or without" shows Build Error!!!!!
@RaghavPal
@RaghavPal 5 жыл бұрын
hi Asif, will have to check the setup and logs
@A.B.00007
@A.B.00007 5 жыл бұрын
​@@RaghavPal Thanks again for your prompt response Raghab (I hope I spelled it right! :)) matter of the fact is when I check mvn -version it shows my JAVA RUNTIME ENVIRONMENT C:\Program Files\Java\jre1.8.0_201 not the JDK / JRE. I think that's what the problem is, what if I change the runtime environment from JAVA control panel directly? would that be alright? What do I do to bring this change!!
@A.B.00007
@A.B.00007 5 жыл бұрын
Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? that message is shown from running running the command mvn clean test which tells you that I need that change of bringing in JDK / JRE to the environment. How do I do that??
@A.B.00007
@A.B.00007 5 жыл бұрын
I fixed it just had to add a dependency in pom.xml build section. Thanks bro.
@smithap3879
@smithap3879 5 жыл бұрын
@@A.B.00007 what dependency did you add? I have a similar issue. when i run from testng.xml, it worked fine.but after running from cmd, i had compilation eroors
@rajeshdevan6051
@rajeshdevan6051 5 жыл бұрын
Please Say slowly Sir you are explaining very fast
@RaghavPal
@RaghavPal 5 жыл бұрын
Sure Rajesh, I will take care in future videos
@FazSaber
@FazSaber 5 жыл бұрын
You can slow down the play speed youtube videos so it's easier to follow. :)
@allenromyn6323
@allenromyn6323 Жыл бұрын
Getting the following C:\Users\**********\eclipse-workspace\automationsmartentry-bitbucket\auotmationsmartentry\testng.xml is not a valid file
@RaghavPal
@RaghavPal Жыл бұрын
Hi Allen, The error message suggests that the testng.xml file specified in the given file path is not a valid file. This could be due to various reasons such as incorrect file name, file path, or file format. To resolve the issue, you can try the following: Verify that the file path is correct and the file exists at the specified location. Ensure that the file name is spelled correctly and has the correct file extension (.xml). Check the file format to ensure it follows the TestNG XML format. Try running the TestNG tests with a different testng.xml file or create a new one from scratch. Make sure you have necessary read/write permissions to the file.
@sachnkn.official
@sachnkn.official Жыл бұрын
Hi sir, when i execute "mvn clean test", im getting some error, im not able to find the solution, can u please help me. this is the error.. [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.415 s [INFO] Finished at: 2022-11-30T<a href="#" class="seekto" data-time="719">11:59</a>:00+<a href="#" class="seekto" data-time="330">05:30</a> [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project QAfox_framework: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoFailureException D:\Work\Git\Eclipse_Workspace\Automation_framework>
@RaghavPal
@RaghavPal Жыл бұрын
pls check if this helps you Right Click on Project. Click on Build path. Click on Configure Build path. It opens a Java Build path window. Click on Java Compiler in the Left side. It navigates to Java Compiler window in that to set the Compiler compliance level is set as according to your jre version(ex if java version is 1.8 then choose 1.8) as select. Click on [Apply] button. Click on [OK] button. Right click on Project > Maven > Update the project. Right click on Project > Run As > Maven install -- The pom.xml file is running and java jars are download and installed to project. Right click on Project > Run As > Maven Test -- The pom.xml file is running and java jars are download and installed to project. stackoverflow.com/questions/53034953/error-source-option-5-is-no-longer-supported-use-6-or-later-on-maven-compile
Selenium Framework for Beginners 39 | How to run Selenium tests on Jenkins
10:33
Automation Step by Step
Рет қаралды 80 М.
Learn Maven (Build Automation Tool) with TestNg and Selenium
47:10
Naveen AutomationLabs
Рет қаралды 202 М.
МАИНКРАФТ В РЕАЛЬНОЙ ЖИЗНИ!🌍 @Mikecrab
00:31
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 36 МЛН
Selenium Cucumber Java BDD Framework 11 | How to run from CommandLine
36:27
Automation Step by Step
Рет қаралды 55 М.