1 Software Validation and Evolution Assignment 2; Test Automation To be submitted before: Sunday 6th May, 11.55 p.m. 1. Objective In this assignment, you will need to demonstrate the skills that you...

see attached


1 Software Validation and Evolution Assignment 2; Test Automation To be submitted before: Sunday 6th May, 11.55 p.m. 1. Objective In this assignment, you will need to demonstrate the skills that you have acquired throughout the last labs by performing a series of tests on a web page, serving as a form, using QUnit, in addition to tests completed with Selenium (see next sections for more details). 2. Scope of the Activities The tests are to be performed using QUnit and, for additional marks in the range 90 to 100, using Selenium, which will be discussed on your return. Features to be included on the page The page to be tested should consist of an online plane ticket booking page that calculates the final ticket price based on: the base price, added tax, number of passengers, and a possible coupon; it can include: • A field for the base price (1000) • A field for the tax (0.20 i.e. 20%) • A field for the number of passengers • A field for a coupon code • A field that displays the price including the tax per passenger • A field that displays the previous price multiplied by the number of passengers • A field that displays the final price (previous price minus discount based on coupon code • A button labelled “update price” Note 1: The tax rate used for this exercise will be 0.20 (i.e. 20%) and the base price for the ticket will be 1000. Note 2: The field for the base price will be filled-out from JavaScript as the page loads. Note 3: the coupon codes wit30 and wit40 will apply a discount of 30% and 40% respectively. The layout could be something like the following, or better. Base price (in euro) 1000 Tax 0.20 Number of Passengers Coupon code Prince per passenger (including tax) Price for all passengers (including tax) Final price (including tax and discount) Update Price (a button) 2 Error Handling: • If the user leaves the field labelled Number of Passengers (i.e. presses tab or clicks on another field) and the value within is incorrect, the value should be corrected automatically to 1. • If the user leaves the field Coupon code (i.e. presses tab or clicks on another field) and the value within is incorrect (i.e. not blank, but neither wit30 nor wit40), an error message should be displayed. Functions to be added/created (give them good useful names prefixed with fn1_, fn2_ etc): • function 1, a function that adds tax to a particular price: this function takes one parameter (the price), and returns the price inclusive of tax. • function 2, a function that calculates the price based on the number of passengers: this function takes two parameters (the unit price and the number of passengers), and returns the price multiplied by the number of passengers. If the number of passengers entered is less than 1 or more than 100, then this function should return -1. • function3, a function that calculates the price after applying a discount based on the coupon code: this function takes two parameters (the coupon code, which is a string, and a price), and returns the price minus a specific percentage; for example: o if the coupon code is wit30, then the discount applied should be 30% (newprice = price * 0.7); o if the coupon code is wit40, then the discount applied should be 40% (newprice = price * 0.6); o if the coupon code is empty then the function will return the original price (newprice = price); o if the coupon code is not recognised (neither wit30 nor wit40, but not empty) then the function will return the original price (newprice = price) and a message saying “Please Enter Correct CODE” should be displayed in the “coupon code” field. • function4, a function called when the Update Price button is clicked; this function will call the other functions in order to perform the different calculations. 3 Tests to be performed: • TC1: to test function1: using a price of 1000; it should return the number 1200 (i.e. price + added tax = 1200). • TC2: to test function2: using a unit price of 1000 and a number of passengers of 3; it should return the number 3000. • TC3: to test function2: using a price of 1000 and a number of passengers equal to -1; the function should return -1. • TC4: to test function3: using a unit price of 1000 and the coupon code wit30; the function should return the number 700. • TC5: to test function3: using a unit price of 1000 and the coupon code wit40; the function should return the number 600. • TC6: to test function3: using a unit price of 1000 and an empty string for the code; the function should return the number 1000. • TC7: to test function3 using a unit price of 1000 and the coupon code TEST; the function should return the number 1000. Usability tests For this test, the base price used will be 1000 and the tax rate 20%. Using JQuery (i.e. using the ability to simulate clicks on blur events - see W3schools) simulate the following scenarios/actions: Scenario 1 (TC8) User performs the following actions • Enter the value 1000 in the field Base Price. • Enter the value 1 in the field Number of passengers. • Leave field Coupon Code empty. • Click on the button labelled Update Price. The test is successful if the value in the field Final Price is 700 Scenario 2 (TC9) User performs the following actions: • Enter Base Price 1000 • Enter Number of passengers: 1 • Enter Coupon Code: Test • Click on the button “Update Price”. The test is successful if the coupon code field displays the error message “Please enter correct code” 4 Scenario3 (TC10) User performs the following actions: • Enter base Price: 1000. • Enter Number of passengers: -1. • Leave Coupon Code: empty. • Click on the button “Update Price”. The test is successful if the value of the field “Number of passengers” has automatically been corrected to 1. Scenario4 (TC11) User performs the following actions: • Enter base Price: 1000. • Enter Number of passengers: 1. • Enter Coupon Code: Test. • Leaves the field (i.e. blur – see W3 schools). The test is successful if the coupon code field displays the error message “Please Enter Correct CODE”. Presentation of the tests in QUnit * Please use QUnit to display the results of your tests * You may use the function assert.equals. * Create two modules: o A module called Unit Tests that includes all tests from TC1 to TC7 o A module called ALAC Tests that includes all tests from TC8 to TC11 * Use the console window (i.e. console.log) to display the following for each module: o The name of the module that has started o The name of the module that has been completed o The number of tests that passed for a particular module o The number of tests that failed for a particular module Organisation of your files: * Create a test page that displays the results (and the interface) with relevant links to both QUnit.css and JavaScript libraries. * Group all functions to be tested in one JavaScript file and link this file to the main HTML document (i.e. the test page). 5 3. Selenium There are marks for tests also performed with Selenium. You can use any website of your choice to perform the tests with Selenium. The following features may be covered: • Opening a page. • Checking the title of a page • Typing text in fields (for example: login). • Clicking on a button. 4. Delivery You will need to submit the following for your assignment: • For QUnit: A folder that includes all necessary code (HTML and JavaScript) to perform the tests including a JavaScript file with all scripts, the main HTML page, and both the .css and .js library files for QUnit. • For Selenium: a folder where the Selenium test cases have been saved. • A small (500 words maximum) implementation document that lists the features that you implemented and where these are located (for example: name of the file). All these documents are to be submitted via the moodle submission box by the due date. 6 5. Indicative Marking Scheme: - <40% (fail): no tests appear on the test page. the test cases can’t be executed properly due to errors in the test scripts (i.e. in qunit) - 40 - 49%: the candidate can display some tests with qunit; the tests are displayed properly on the page with corresponding labels; at least a third of the unit tests were completed (e.g. some of the tests amongst tc1, tc2, tc3, tc4, tc5, tc6 or tc7). - 50-70%: all unit tests were completed (i.e., tc1 to tc7), grouped, and displayed appropriately using qunit, along with messages in the console window. all functions to be tested are saved in a separate .js file. - 71-79%: in addition to the previous features, at least half of the usability tests were completed (i.e., tc8 to tc11), grouped, and displayed appropriately using qunit, along with messages in the console window. - 80-85%: in addition to the previous features, all usability tests were completed (tc8 to tc11), grouped, and displayed appropriately using qunit, along with messages in the console window. - 86-95%: in addition to the previous features, basic selenium tests were performed using features such as opening a page, typing text in a field, (fail):="" no="" tests="" appear="" on="" the="" test="" page.="" the="" test="" cases="" can’t="" be="" executed="" properly="" due="" to="" errors="" in="" the="" test="" scripts="" (i.e.="" in="" qunit)="" -="" 40="" -="" 49%:="" the="" candidate="" can="" display="" some="" tests="" with="" qunit;="" the="" tests="" are="" displayed="" properly="" on="" the="" page="" with="" corresponding="" labels;="" at="" least="" a="" third="" of="" the="" unit="" tests="" were="" completed="" (e.g.="" some="" of="" the="" tests="" amongst="" tc1,="" tc2,="" tc3,="" tc4,="" tc5,="" tc6="" or="" tc7).="" -="" 50-70%:="" all="" unit="" tests="" were="" completed="" (i.e.,="" tc1="" to="" tc7),="" grouped,="" and="" displayed="" appropriately="" using="" qunit,="" along="" with="" messages="" in="" the="" console="" window.="" all="" functions="" to="" be="" tested="" are="" saved="" in="" a="" separate="" .js="" file.="" -="" 71-79%:="" in="" addition="" to="" the="" previous="" features,="" at="" least="" half="" of="" the="" usability="" tests="" were="" completed="" (i.e.,="" tc8="" to="" tc11),="" grouped,="" and="" displayed="" appropriately="" using="" qunit,="" along="" with="" messages="" in="" the="" console="" window.="" -="" 80-85%:="" in="" addition="" to="" the="" previous="" features,="" all="" usability="" tests="" were="" completed="" (tc8="" to="" tc11),="" grouped,="" and="" displayed="" appropriately="" using="" qunit,="" along="" with="" messages="" in="" the="" console="" window.="" -="" 86-95%:="" in="" addition="" to="" the="" previous="" features,="" basic="" selenium="" tests="" were="" performed="" using="" features="" such="" as="" opening="" a="" page,="" typing="" text="" in="" a="">
Mar 31, 2020
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here