Software testing lab2 -- Selenuim testing

  1. Install the selenium plugin on Firefox

   First,entre the official website http://www.seleniumhq.org/download/

      

       Click this link.

      

     And click the installation button.

      

      Finally, in the add-on, add selenium ide to the menu bar.

  2. Learn to use SeleniumIDE to record scripts and export scripts

  Click on the little label to open selenium ide.

Base url Fill in with the URL to test. When we use it, we should click the red button to recording firstly.

It can export scripts in various formats . We usually choose the Junit 4/WebDrive。

  3. Write Selenium Java WebDriver program

  The code in github URL is https://github.com/zjwjerome/lab2

  The first method does not store data. Each cycle tests a use case. But the results can be seen at the end, and it is not easy to see which case is wrong.

  The operation results shown in Figure:

We can only see a result in the end.

  The second method first stores the data and then uses a parametric test.

Parametric test preparation process is as follows:

A. Specifying a special runtime for the parameterized test class with @RunWith annotation: Parameterized.class;

B. Declare several variables in the test class, which are used to store the expected values and test data and create a constructor for several parameters of the user;

C. Create a static test data feed (feed) method, the return type is Collection, and use @Parameter annotation to modify;

D. Write the test method (with @Test annotation).

The operation results shown in Figure:

It can test each pair of data. The wrong will prompt, and it will not stop running.

 

转载于:https://www.cnblogs.com/zjwjerome/p/6612502.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值