-
Notifications
You must be signed in to change notification settings - Fork 3
/
section_24_notes.txt
78 lines (60 loc) · 5.2 KB
/
section_24_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Jenkins Introduction
Jenkins is a tool that can automate your project. If you wanted to schedule test to execute at different
times, you can. Jenkin creates builds and automates those builds when scheduled. Jenkins allows you to
execute our framework on its own.
Go to jenkins.io and download 'generic java war file'. Save it in an acessible location and open gitbash
from that location. Once open run 'java -jar jenkins.war --httpPort=5555'
***Note - --httpPort=xxxx is used to specify a port because by default jkenkins uses port 8080 ***
Installation will be complete when you see 'jenkins is fully up and running', after the installation, open
your browser and naviagte to http://localhost:5555.
When you navigate to the page, it will ask you for a password and give you a location tp find the password.
Copy and paste the password from that location, E.g: C:\Users\Pierre\.jenkins\secrets\initialAdminPassword
Once in the installation page click 'installed suggested plug-ins'. Once files are installed it will take you
to 'Create First Admin User'. Fill in the info accordingly. Click 'save and continue; and then confirm the
url and port. The next time you run Jenkins after a shutdown, run 'java -jar jenkins.war' as you do not a port
because that was setup om the installation. Upon startup, type inthe user name and pasword that you created.
Once logged into jenkins homepage, go to 'manage jenkins' then 'manage plugins' and finally click on the
'available' tab, install nodejs, html publisher & post build-task without restart.
Once files are installed, click 'manage jenkins' then 'global tool configuration'. Click add nodejs, give it a name and in
'Global npm packages to install' type 'bower@~1.8.0 grunt-cli@~1.2.0'. Click apply and save.
Finally we will click 'configure system'. go to 'global properties' and click 'enviromental variables'. Then click add, in the
Name box type in 'PATH" and Value '$PATH:C:/Program Files/nodejs/node_modules/npm/bin'. Click apply and save.
Form the Jenkins Homepage, click create new job. From that page click 'Freestyle Project' and for the name 'Webdriver
Univeristy'. Remain on the general tab, then click advanced and click 'use custom workspace'. In the 'directory' space,
you will get the path for you '.bin' folder in your projects folder,
E.g: C:\Users\pgoldstein\Desktop\Projects\Selenium-WebDriver---JavaScript-nodeJS-webdriver-IO-more-\node_modules\.bin
***Replace backslashes with forward slashes***
Display name will be called 'Webdriverio Framework'.
Then click 'This prohect is parameterised' and choose 'String value'. For name type in 'baseURL', default value will be
'http://www.webdriveruniversity.com/', you can leave the description blank.
Go to the 'Build' section and choose 'execute shell script' Then type in 'npm install ↵' then type 'npm test -- --baseURL="$baseURL"'
From the homepage click 'Build with Parameters' and click 'build'.
After expermenting with running a build, lets click the 'configure' link on the homepage. Lets add another String paramter so we can
run single test. name it 'automationTest' and give it a value of 'contactUsTest.js'. Then add to the already created shell script
'--spec="$automationTest", it should look something like this when you're done:
npm install
npm test -- --baseURL="$baseURL" --spec="$automationTest"
Run build form the homepage like the previous excercise. Now we will do a little code clean up and comment out so items in our
'wdio.conf.js' file. Comment out the 'after object', and comment out junit and json objects from 'reporters' and 'reportersOptions'.
We will only be using allure for reporting purposes moving forward.
Go back to the homepage and click build, but instead of running contactUsTest.js, lets rewrite it with ajaxclicktest.js. This will execute
the ajax test from previous excercises.
To add logging to our test, we can add another string parameter to our jenkins build. Navigate to 'https://webdriver.io/docs/options.html'
and look fo rthe 'logLevel' section.
*****************************************************************************************************************************************
logLevel
Level of logging verbosity.
Type: String
Default: info
Options: verbose | silent | command
outputDir
Directory to store all testrunner log files including reporter logs and wdio logs. If not set all logs are streamed to stdout. Since most
reporters are made to log to stdout it is recommended to only use this option for specific reporters where it makes more sense to push report
into a file (e.g. junit reporter). When running in standalone mode the only log generated by webdriverio will be the wdio log.
*****************************************************************************************************************************************
Experiment with the different log options.
Setup:
Click on configure from the Jenkins homepage.
In The general section click 'add parameter' then choose 'string parameter'.
For name put in 'logType' and default value you can use any of the values from the webdriverio page from earlier, this one will choose 'verbose'.
In the 'build' section we can add more to the last script with 'npm test -- --baseURL="$baseURL" --spec="$automationTest" --logLevel="$logType"'