Need .yml file of Gitlab-CI for selenium java test run

153 views
Skip to first unread message

Ajay Singh

unread,
Apr 17, 2021, 4:11:53 PM4/17/21
to Selenium Users
Hi Friends,

Can someone please give me code for .YML file to run  selenium java test in GITLAB

Thanks 
Ajay Singh

Arvind Sah

unread,
Apr 18, 2021, 12:07:41 AM4/18/21
to seleniu...@googlegroups.com
Hello Ajay,

.yml file is not something which can fit for all project. You have to define your .yml file based on your need.

I think if your spend 2-3 hours you will be able to create basic yaml file with atleast one test job. For reference you can refer Velentin Despa YouTube playlist for gitlab ci. 

Happy learning,
Arvind


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e89d1449-fd68-45c0-b482-2b0022f9bf61n%40googlegroups.com.

Ajay Singh

unread,
Apr 18, 2021, 12:51:06 PM4/18/21
to seleniu...@googlegroups.com
Thank you Arvind for your suggestion.
I know it will not fit for all project , i just wanted one sample if you have then please provide me. I will definitely look for Velentin Despa paylist.

Thanks & Regards,
Ajay Singh

Virus-free. www.avast.com

Arvind Sah

unread,
Apr 18, 2021, 2:46:30 PM4/18/21
to seleniu...@googlegroups.com
Here is the reference which is available on gitlab docs.

Steps to follow- 
1. Add execution machine as gitlab runner. You can google on how to add machine( vm/EC2 instance) as gitlab runner.
2. Post adding the mahine as gitlab runner 
Register the same machine over gitlab account.

3. Add below .gitlab-ci.yml file into base directory of your project. Make sure your yaml file has atleast one test stage which to can see in below example.

4. over gitlab, go to ci/cd pipelines, click on new pipeline ->declare variable as ENV and provide the environment name for which you wanna run the build. After saving it you will see option to run the pipeline. You are all set to run the pipeline.


Link to gitlab docs- https://docs.gitlab.com/ee/ci/yaml/gitlab_ci_yaml.html

When you add a .gitlab-ci.yml file to your repository, GitLab detects it and an application called GitLab Runner runs the scripts defined in the jobs.

.gitlab-ci.yml file might contain:

Tags: <tag name used while registering gitlab runner>test-code-job1:
  stage: test
  script:
    - echo "If the files are built successfully, test some files with one command:"
    - mvn clean install -Denv=$ENV



Arvind Sah

unread,
Apr 19, 2021, 3:11:55 AM4/19/21
to seleniu...@googlegroups.com
another sample yml file which I have used - 

File name - .gitlab-ci.yml

file content- 
Regression_Suite:
     stage: test
     tags:
       - selenium
     script:
       - echo "Env = $env",  "Suite = $suite" , "Browser = $browser"
       - mvn clean install -Denv="$env" -Dsuite="$suite"

Ajay Singh

unread,
Apr 19, 2021, 6:45:57 AM4/19/21
to seleniu...@googlegroups.com
Thanks Arvind for your help. I will check the same.

Thanks & Regards,
Ajay Singh

Virus-free. www.avast.com

Reply all
Reply to author
Forward
0 new messages