How to prepare for placements in analytics or coding profiles

I have been asked regarding placement preparation for analytics/coding roles multiple times now. I suppose it is a good idea to pen down the path I followed. Before that, a short introduction of…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Run your Selenium Script pushed to GIT repository using Jenkins Job

In the previous article, we saw how to create your first Jenkins job to execute the a selenium script through Jenkins. You can read that article Here

Creating out First project to Run Selenium script in Jenkins

Please go through above article as we will be using same Job in this article to re-use configuration like reporting.

In this project we are picking up a code present on local machine by providing Custom path. In general practice that might not be the case. If there are multiple people are there in the team code usually be on some version control be it SVN or GIT.

In this article I will be showing how to run our script if it is pushed to git.

Pre-requisite

2. You must have complete path of you code.

Now configure the Jenkins Job.

10. As you are doing it for first time, you will have to add credentials over here

3. Fill the form for Add credential

11. You will have to provide branch name on which your code base or Script present. By default this edit field is pre-filled with value */master. You have to provide exact branch name over here. As my code is present on Master branch only I will keep this field as it is

12. Go to Build

13. Add build step

14. Add Execute Shell where you have to provide command to execute gradle task

15. Make sure you have created task in build.gradle. You can check previous article which will help you to create a task

16. I am adding below command

Here smoketest is task name in build.gradle

17. If you are triggering test from windows instead of going for Execute Shell, Select “Invoke Gradle script

18. Select Use Gradle wrapper

19. Provide Task name

20. Save the Configuration

21. Click on Build now.

22. Observe the execution

23. Your execution might fail with error

24. In this case you will have to change the access and Try to set the execution flag on your gradlew file. We will take help from command chmod.

25. We will send one more command in Add Execute Shell as

26. Your Execute Shell command will look like this

27. Apply and Save the changes

28. Again click on Build Now

29. Your test execution will start

30. Click on triggered job and check console logs

31. Check the job status. Now it will run without any failure

While executing, Jenkins job will checkout recent changes from repository. Make some changes in your code/script and push it to github repository. After that, whenever Jenkins job gets triggered these changes will get reflected in execution report

See the screenshot below Jenkins console logs. It will checkout code up to the latest/recent commit

Try this out and let me know if you are facing any problems.

Happy Learning…!!

Add a comment

Related posts:

Security of Insecurity

When we discussing insecurity, what does come to mind? Your downside? your disgrace? your fear? Let me conclude all that comes up in your mind are about negativity. I see insecurity as me looking at…

Connecting the dots

The fact that it is August 1st is perhaps a good time to think about time. Jan 1st 2020 is now closer than Jan 1st 2019 was — when the year felt so new, hopes abound, resolutions to do more of good…

Liberation

What are you willing to sacrifice to be free?. “Liberation” is published by Rodney Gainous Jr. in CodeSigned.