Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.

Similar presentations


Presentation on theme: "Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel."— Presentation transcript:

1 Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel

2 2 Day 9 Managing Tests and Testing Resources

3 3 Save to your workspace/project/src folder Select ‘Save Link As’ Right-click the link

4 4 Double-click Move ‘Environment.java’ to package … Click the [x] icon Open the file in Eclipse The com.auto.common package will be created for you in the project

5 5 Replace all occurrences of “30000” with Environment.TS_WAIT_FOR_PAGE_TO_LOAD Press CTRL + F Open TestCase in Eclipse Add import com.auto.common.*; statement

6  File used to store all common values utilized in test scripts.  Improves maintainability  Edit the file to specify global variables such as: ◦ URL ◦ PORT ◦ HOST ◦ BROWSER_TYPE  Declare additional global variables as needed. 6

7 7 Select ‘Save Link As’ Right-click the link Save to your workspace/project/src folder

8 8 Double-click Move ‘GPH.java’ to package … Click the [x] icon Open the file in Eclipse The com.auto.utils package will be created for you in the project

9  File used to store all common actions utilized in test scripts: ◦ doLogin(username, password) ◦ doLogout()  Improves maintainability and scripting time  Edit the file to include additional global behaviors occurring in multiple TestCases. 9

10 10 Replace with GPH.doLogin(selenium, "admin", "password"); Replace with GPH.doLogin(selenium, "admin", "password"); Select the seven lines which execute the login Open TestCase in Eclipse Add import com.auto.utils.*; statement to the top of the script!

11 11 Select ‘Save Link As’ Right-click the link Save to your workspace/project/src folder

12 12 Double-click Move ‘QAutoTestSuite.java’ to package … Click the [x] icon Open the file in Eclipse The com.auto package will be created for you in the project

13  File serves as the middle layer between JUnit TestSuite class and our TestSuite(s)  QAutoTestSuite.java inherits all the functionality of the JUnit TestSuite class but specifies a new behavior for its run method which will now start and stop the selenium server, as well as open and close the browser as part of setUp and tearDown.  Improves maintainability and scripting time by centralizing operations common to all tests. (One common fixture) 13

14  Modify all TestCases to extend the JUnit TestCase class: ◦ Replace SeleneseTestCase with TestCase  Create a TestSuite by extending QAutoTestSuite class: ◦ public class LoginRegressionTestSuite extends QAutoTestSuite{ … code …}  Add whole TestCases or select test methods to the TestSuite.  Remove all setUp and tearDown methods from all TestCase classes  Add the following two line to the beginning and end of each test method: ◦ Selenium selenium = Environment.getBrowser(); ◦ Environment.killBrowser();  You may need to add import statements for common and utils packages 14 Should be added to the com.auto package

15  Your test suite should now automatically start and stop the Selenium Server!  Run and debug the project as needed.  HOMEWORK:  Look back at the past homework assignment which utilize javaScript.  Modify the code to use java instead, to perform the same operation.  To convert from String to number use: ◦ Number_Type1 = Type1.valueOf(String);  To convert from number to a different type of number" use: ◦ num_type1 = (Type1) num_type2; 15 Double num = Double.valueOf(“24”); int num2 = (int) num;


Download ppt "Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel."

Similar presentations


Ads by Google