Groovy Beginner Tutorial 21 | How to read files in groovy

  Рет қаралды 28,314

Automation Step by Step

Automation Step by Step

Күн бұрын

FREE Courses - automationstep...
Take Groovy Quiz - automationstep...
Udemy - www.udemy.com/...
Invite for training at your venue - raghav.qna@gmail.com
Training schedule - automationstep...
File IO | How to read Files
1. How to read file as String
2. How to read file as List
3. How to read file as Array
4. How to read file line by line
5. How to delete file
References
docs.groovy-lan...
----------- UI TESTING -----------
Selenium Beginners - bit.ly/2MGRS8K
Selenium Java Framework from Scratch - bit.ly/2N9xvR6
Selenium Python - bit.ly/2oyMp5x
Selenium Tips - bit.ly/2owxc50
Selenium Builder - bit.ly/2MKNtlq
Katalon Studio - bit.ly/2wARFdi
Robot Framework with RIDE- bit.ly/2Px6Ue9
Robot Framework with Eclipse - bit.ly/2N8DZxb
----------- API TESTING -----------
Web Services (API) - bit.ly/2MGafL7
SoapUI - bit.ly/2MGahmd
Postman - bit.ly/2wz8LrW
General - bit.ly/2PYdwmV
Katalon Studio API Testing - bit.ly/2BwuCTN
----------- MOBILE TESTING -----------
Mobile Playlist - bit.ly/2PxpeUv
----------- CI | CD | DEVOPS -----------
Jenkins Beginner - bit.ly/2MIn8EC
Jenkins Tips & Trick - bit.ly/2LRt6xC
Docker - bit.ly/2MInnzx
----------- VERSION CONTROL SYSTEM -----------
Git & GitHub - bit.ly/2Q1pagY
----------- PERFORMANCE TESTING -----------
JMeter Beginner - bit.ly/2oBbtIU
JMeter Intermediate - bit.ly/2oziNVB
JMeter Advanced - bit.ly/2Q22Y6a
JMeter Tips & Tricks - bit.ly/2NOfWD2
Performance Testing - bit.ly/2wEXbLS
----------- JAVA -----------
Java Beginners - bit.ly/2PVUcXs
Java Tips & Tricks - bit.ly/2CdcDnJ
----------- MAVEN -----------
Maven - bit.ly/2NJdDRS
----------- OTHERS -----------
Redis- bit.ly/2N9jyCG
Misc - bit.ly/2Q2q5xQ
Tools & Tips - bit.ly/2oBfwoR
QnA Friday- bit.ly/2NgwGpw
Sunday Special - bit.ly/2wB23BO
Ask Raghav - bit.ly/2CoJGWf
Interviews - bit.ly/2NIPPxk
All Playlists - bit.ly/2LSiezA
Keep Learning,
Raghav
Website - automationstep...
LifeCharger -
Udemy Courses - www.udemy.com/...
Facebook - / automationstepbystep
Twitter - / automationsbs
KZbin - / automationstepbystep
You can support my mission for education by sharing this knowledge and helping as many people as you can.

Пікірлер: 65
@manvendrayadav2127
@manvendrayadav2127 2 жыл бұрын
Hi Raghav, Your way of presenting tutorial is very neat and clean and I used to follow all your jenkins/groovy tutorials from last 4-5 years. But I have a suggestion for you. Particularly in Groovy tutorials , when you explain the multiple examples it used to be very quick and you write so many combination of commands which you write very fast and run them, As a learner I think we have less time to consume that, Please request you to explain about the command in details before running them and also explain the output of each commands in details.
@manvendrayadav2127
@manvendrayadav2127 2 жыл бұрын
@Raghav
@RaghavPal
@RaghavPal 2 жыл бұрын
will take this feedback Manvendra, thanks
@mdashrafislam6413
@mdashrafislam6413 5 жыл бұрын
Sir my current project is groovy with moonshine framework, groovy part I get a lot of help from your video, I was experiences with java , c#, python before . Your video help me to learn groovy within a days. Thank you sir . I appreciate your help
@RaghavPal
@RaghavPal 5 жыл бұрын
Glad to know this Ashraf.
@TheJacobs150
@TheJacobs150 3 жыл бұрын
And that is what I was looking for :) Thanks for sharing your knowledge
@RaghavPal
@RaghavPal 3 жыл бұрын
You're welcome Jakub
@RomainDumoulin-xr6iq
@RomainDumoulin-xr6iq Жыл бұрын
Thanks for this tutorial
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome
@RakeshKumar-eb9re
@RakeshKumar-eb9re 2 жыл бұрын
Hey Rahav I want to read random log file in Jenkins workspace created with new name on each built like abc.log , then on next builtd names changes auto like kbc.log. How to read any file ending with .log using groovy
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Rakesh, will need to check on this, can try online help
@harshitamittal175
@harshitamittal175 2 жыл бұрын
Hi Raghav, i need to take array as a output, but that input will be provided by user only.. not like we are already providing.. how can we do that.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Harshita, you can get the input from user console stackoverflow.com/questions/10184091/groovy-console-read-input
@PiyushGhosh-l4k
@PiyushGhosh-l4k 4 ай бұрын
Bhai what is GroovyScriptingContext and GroovyUser in groovy ? please explain
@RaghavPal
@RaghavPal 3 ай бұрын
Piyush In Groovy, `GroovyScriptingContext` and `GroovyUser` are not standard classes or components provided by the language itself. However, I can provide some context based on what I know: 1. `GroovyScriptingContext`: - As of my last knowledge update (which was until 2021), there is no built-in class named `GroovyScriptingContext` in the Groovy programming language. - If you encounter this term in a specific context (such as a library or framework), it might be a custom class defined by a third-party library or application. - To understand its purpose and functionality, you would need to refer to the specific documentation or source code where it is used. 2. `GroovyUser`: - Similarly, there is no standard class called `GroovyUser` in Groovy. - If you come across this term, it could be related to a custom class or object created within a Groovy script or application. - Without additional context, it's challenging to provide a precise explanation for `GroovyUser`. --
@abhijeetsingh089
@abhijeetsingh089 Жыл бұрын
Raghav Bhai ek help Jaise hum property transfer se request response send receive kar sakte.. Vaise groovy se kaise kar sakte hai . please guide
@RaghavPal
@RaghavPal Жыл бұрын
Hi Abhijeet, In Groovy, you can use the setProperty() and getProperty() methods to perform property transfer between different objects.
@abhijeetsingh089
@abhijeetsingh089 Жыл бұрын
@@RaghavPal thanks Sir But do you have any video or any url with steps to do it.. This is be helpful please
@RaghavPal
@RaghavPal Жыл бұрын
I will check on this
@hemantmalvi1342
@hemantmalvi1342 4 жыл бұрын
How to read only first line of file, make some changes and return whole file
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Hemant, you will find examples in this video where you can read file line by line. You can use a closure (example shown) and store the first line in a list or can directly write to a file. For writing to file you can check the next video
@hemantmalvi1342
@hemantmalvi1342 4 жыл бұрын
@@RaghavPal Thanks for the tip, I used "find" closure to read first line and did some changes but not sure how to write whole file with first line change to target
@RaghavPal
@RaghavPal 4 жыл бұрын
Did you check the write files session.
@hemantmalvi1342
@hemantmalvi1342 4 жыл бұрын
@@RaghavPal Yes I checked it, Can you let me know how to read file from specific line till end of file.
@RaghavPal
@RaghavPal 4 жыл бұрын
Let me check, If possible will create a session. For now pls try online help.
@carlovandermeer1679
@carlovandermeer1679 2 жыл бұрын
Hi Raghav, I was playing with the "read with reader" example. And when I add a empty line in the file, it still prints the empty line. I would expect != null to igor the line. Why is this? Best regards
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Carlo, will need to check the code and logs
@Coorgie
@Coorgie 3 жыл бұрын
Hallo. A very nice tut. I wanted to read a csv file and search for the cell data which matches or the closesr value to my defined value. In looking to this tutorial can i use the Reader or what would you suggest. Thank you in advance :)
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi, you may use regex (regular expression) for this, Can find groovy regex examples online and if you wish to read a story of regex here - automationstepbystep.com/2020/05/05/a-story-of-regex/
@swapnilshrishrimal4520
@swapnilshrishrimal4520 2 жыл бұрын
Hi Raghav! Thanks for the tutorial. Can we use repository in place of filepath ? Or we need to use only local workspace ? I need to fetch .properties file from repo and then use it for choice parameter option.
@RaghavPal
@RaghavPal 2 жыл бұрын
You can try that, as long as it is accessible it should be okay
@sonigandhi3196
@sonigandhi3196 4 жыл бұрын
Can you please make a video of how to read data from excel file in Groovy
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Soni, I will plan
@nirmalavare9414
@nirmalavare9414 3 жыл бұрын
Hi raghav,I need to convert my csv file into list of maps..what will be syntax... your help will really appreciate..
@RaghavPal
@RaghavPal 3 жыл бұрын
will need to check online Nirmala
@bottletyre
@bottletyre 3 жыл бұрын
Hi Raghav, How to read a file content and load into jenkins as Dropdown values ? And on selection of 1st Dropdown, how to change the value of the second dropdown values dynamically ?
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Vivek, I will plan a session, can check some online examples also
@bottletyre
@bottletyre 3 жыл бұрын
@@RaghavPal yes Raghav, I found the solution using active choice plugin. Thanks.
@sagarpardeshi9002
@sagarpardeshi9002 4 жыл бұрын
Hello Sir, thank you for useful content. I want to read a csv file and create json from it with one for the key value to be a date and date value for each object within the array needs to be unique. I'm able to read csv file referring your video but unable to create json. Can you please create a video on JsonBuilder and/or jsongenerator using groovy.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Sagar, I will check and plan for this session
@madhusudandevaraju1207
@madhusudandevaraju1207 4 жыл бұрын
Hi Raghav, can you pls make a video on how to read write an excel file using the apache poi library in soapui tool using the groovy script test step.
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Madhu, I will plan for this
@madhusudandevaraju1207
@madhusudandevaraju1207 4 жыл бұрын
@@RaghavPal Please Raghav. I did a lot of RnD on this but none worked out for me. There is some light shed on this in the below link. smartbear-cc.force.com/portal/KbArticleViewer?name=Example-of-using-third-party-Java-libraries-in-Groovy-script-reading-from-Excel-file-using-Apache-POI&sp=all But I do get some error like MethodNotFound or ClassNotFound every time even after adding all the necessary jars in the ext folder of SoapUI.
@RaghavPal
@RaghavPal 4 жыл бұрын
ok I will check and plan
@MakkenaTejovardhan
@MakkenaTejovardhan 3 жыл бұрын
I have 10000 record in an excel , I need to fecth that data and run the soup script each time till 10000 . Could you please help
@RaghavPal
@RaghavPal 3 жыл бұрын
I will need to check on this
@safeerpasha1051
@safeerpasha1051 2 жыл бұрын
Hello Raghav, Am currently working on project (Jenkins and Groovy) where I have CSV File as an artifact and in the CSV file I have a tabular data which I want to upload it to confluence table. Could you please help with this or any suggestion.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Safeer, you can search for plugins on jenkins to do this
@safeerpasha1051
@safeerpasha1051 2 жыл бұрын
@@RaghavPal Am using Confluence publisher plugin to upload, Uploading is going fine but the problem here is I need to read a CSV file and print header and rows as a tabular format.
@RaghavPal
@RaghavPal 2 жыл бұрын
Hi Safeer, I am not too sure, will need to check online
@vishnuponduru2955
@vishnuponduru2955 5 жыл бұрын
here what is the difference between list and array output?
@RaghavPal
@RaghavPal 5 жыл бұрын
Hi Vishnu, in general array is a data structure consisting of sequential memory storing a collection of objects. List may have multiple implementations like ArrayList
@alim241081
@alim241081 4 жыл бұрын
Hi raghav,what about excel reading in groovy.
@RaghavPal
@RaghavPal 4 жыл бұрын
I will plan to add the session Alim
@alim241081
@alim241081 4 жыл бұрын
@@RaghavPal thanks sir
@rihamchowdhury4020
@rihamchowdhury4020 4 жыл бұрын
Sir how can i read only the json files of a given directory?
@RaghavPal
@RaghavPal 4 жыл бұрын
You can write a code to select the file with .json ext
@jaithadani3522
@jaithadani3522 3 жыл бұрын
Raghav where is the source code for all this groovy tutorial videos
@RaghavPal
@RaghavPal 3 жыл бұрын
Hi Jai, can check here github.com/Raghav-Pal/GroovyProject_Mar2020
@prashantaggarwal3723
@prashantaggarwal3723 4 жыл бұрын
sir how can we fetch metadata from imdb using groovy
@RaghavPal
@RaghavPal 4 жыл бұрын
Hi Prashant, may be I have not faced this scenario, Not able to get this. In case you can provide some example, I can check.
@prashantaggarwal3723
@prashantaggarwal3723 4 жыл бұрын
@@RaghavPal sure.. for example there is video file or an audio file and I want to know format , bitrate , codec etc.
@RaghavPal
@RaghavPal 4 жыл бұрын
Okay, honestly, I have not worked on such scenarios. I will have to check online.
@meoweric8045
@meoweric8045 11 ай бұрын
i think this video you teach is too fast
@RaghavPal
@RaghavPal 11 ай бұрын
I will improve
Groovy Beginner Tutorial 22 | How to write files in Groovy | File IO
10:04
Automation Step by Step
Рет қаралды 13 М.
Groovy Beginner Tutorial 17 | Lists
17:55
Automation Step by Step
Рет қаралды 20 М.
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,1 МЛН
Worst flight ever
00:55
Adam W
Рет қаралды 21 МЛН
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 985 М.
Шок. Никокадо Авокадо похудел на 110 кг
00:44
SoapUI Data Driven Testing Groovy
40:27
Learn Test Automation
Рет қаралды 10 М.
Java read CSV File 📰
9:12
Bro Code
Рет қаралды 93 М.
How to use groovy script in CPI | Access Groovy script from SAP CPI  | Groovy in SAP CPI
17:28
Anubhav Trainings (official channel)
Рет қаралды 5 М.
Using Resource Files From a Jenkins Shared Library
13:58
CloudBeesTV
Рет қаралды 30 М.
Groovy Beginner Tutorial 20 | Input & Output
10:52
Automation Step by Step
Рет қаралды 14 М.
10 Things You Can Do With Groovy Closures!
26:08
Szymon Stepniak
Рет қаралды 19 М.
PowerShell Tutorials : Reading PDF files
11:51
JackedProgrammer
Рет қаралды 12 М.
Groovy Beginner Tutorial 18 | Maps
13:58
Automation Step by Step
Рет қаралды 19 М.
Groovy Beginner Tutorial 19 | Ranges
9:35
Automation Step by Step
Рет қаралды 10 М.
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,1 МЛН