Linux web自动化测试框架,WebUI发布自动化测试框架PhoenixAutotest

Phoenix.WebUI自动化测试框架发布了20170610版本,修复了bug并引入了注解配置PageObject的功能。测试人员现在可以通过注解更方便地定义页面对象,简化了单元测试代码。示例代码展示了如何使用注解来创建和操作页面元素。
摘要由CSDN通过智能技术生成

介绍

WebUI自动化测试框架phoenix.webui.framework发布20170610版本。

本次发布修正了一些bug,更多Isseus信息请访问Github。添加的主要功能如下:

增加了通过注解的方式来配置PageObject(页面对象),单元测试代码如下(本文所有的代码都可以在Github项目中获取):

/*

*

* * Copyright 2002-2007 the original author or authors.

* *

* * Licensed under the Apache License, Version 2.0 (the "License");

* * you may not use this file except in compliance with the License.

* * You may obtain a copy of the License at

* *

* * http://www.apache.org/licenses/LICENSE-2.0

* *

* * Unless required by applicable law or agreed to in writing, software

* * distributed under the License is distributed on an "AS IS" BASIS,

* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* * See the License for the specific language governing permissions and

* * limitations under the License.

*

*/

package org.suren.autotest.web.framework.page;

import org.suren.autotest.web.framework.annotation.AutoDataSource;

import org.suren.autotest.web.framework.annotation.AutoLocator;

import org.suren.autotest.web.framework.annotation.AutoPage;

import org.suren.autotest.web.framework.annotation.AutoStrategy;

import org.suren.autotest.web.framework.core.LocatorType;

import org.suren.autotest.web.framework.core.StrategyType;

import org.suren.autotest.web.framework.core.ui.Button;

import org.suren.autotest.web.framework.core.ui.Text;

/**

* 使用注解的示例Page类

* @author suren

* @date 2017年6月7日 下午7:10:40

*/

@AutoPage(url = "http://maimai.cn/")

@AutoDataSource(name = "data", resource = "dataSource/xml/user_data_anno.xml")

public class AnnotationPage extends Page

{

@AutoStrategy(type = StrategyType.PRIORITY)

@AutoLocator(locator = LocatorType.BY_PARTIAL_LINK_TEXT, value = "实名动态")

private Button toLoginBut;

@AutoLocator(locator = LocatorType.BY_XPATH, value = "//input[@placeholder='请输入手机号码/脉脉号']")

private Text phoneText;

public Button getToLoginBut() {

return toLoginBut;

}

public void setToLoginBut(Button toLoginBut) {

this.toLoginBut = toLoginBut;

}

public Text getPhoneText() {

return phoneText;

}

public void setPhoneText(Text phoneText) {

this.phoneText = phoneText;

}

}

测试代码如下:

/*

*

* * Copyright 2002-2007 the original author or authors.

* *

* * Licensed under the Apache License, Version 2.0 (the "License");

* * you may not use this file except in compliance with the License.

* * You may obtain a copy of the License at

* *

* * http://www.apache.org/licenses/LICENSE-2.0

* *

* * Unless required by applicable law or agreed to in writing, software

* * distributed under the License is distributed on an "AS IS" BASIS,

* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* * See the License for the specific language governing permissions and

* * limitations under the License.

*

*/

package org.suren.autotest.web.framework.util;

import org.junit.*;

import org.springframework.context.annotation.ComponentScan;

import org.springframework.context.annotation.Configuration;

import org.suren.autotest.web.framework.IgnoreReasonConstants;

import org.suren.autotest.web.framework.page.AnnotationPage;

import org.suren.autotest.web.framework.settings.DriverConstants;

import org.suren.autotest.web.framework.settings.SettingUtil;

import java.io.IOException;

/**

* 测试使用注解配置的方式

* @author suren

* @date 2017年6月7日 下午7:10:12

*/

@Configuration

@ComponentScan(basePackages = "org.suren.autotest.web.webframework.page")

public class AutoAnnotationTest

{

private SettingUtil util;

@Before

public void setUp()

{

util = new SettingUtil();

}

@Test

public void basicTest()

{

util.getEngine().setDriverStr(DriverConstants.DRIVER_HTML_UNIT);

util.getEngine().init();

AnnotationPage page = util.getPage(AnnotationPage.class);

Assert.assertNotNull(page);

Assert.assertNotNull(page.getUrl());

Assert.assertNotNull(page.getToLoginBut());

page.open();

page.getToLoginBut().click();

}

@Test

@Ignore(value = IgnoreReasonConstants.REAL_BROWSER)

public void realTest()

{

util.getEngine().setDriverStr(DriverConstants.DRIVER_CHROME);

util.getEngine().init();

util.initData();

AnnotationPage page = util.getPage(AnnotationPage.class);

page.open();

page.getToLoginBut().click();

page.getPhoneText().fillNotBlankValue();

ThreadUtil.silentSleep(3000);

}

@After

public void tearDown() throws IOException

{

util.close();

}

}

相关链接

PhoenixAutotest 的详细介绍:点击查看

PhoenixAutotest 的下载地址:点击下载

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Webadmin!是一个免费的开源框架,用于为Linux系统的快速搭建统一、稳定、易用的Web管理系统。 WebAdmin系统由三部分组成:WEB图形用户接口、WebAdmin守护进程和进程监视程序。Web图形用户接口(WebGUI)是WebAdmin系统的前端部分,为用户提供一个统一、易操作的图形界面WebAdmin守护进程 (WebAdmind)是WebAdmin系统的后台部分,实时监视WebGUI生成的配置文件,并根据配置文件的变化情况,启动或停止相应的服务进程,WebAdmin进程监视程序(DaemonWatcher)用于实时监视WebAdmind启动的服务进程的运行状况,一旦发现启动的服务进程异常中止,立即重启中止的服务进程,从而确保系统可靠稳定运行。 WebAdmin!提供了一个结构化的WebAdmin开发框架,它的前后台部分均采用插件式的程序开发方法,借助提供的插件开发模板,WebAdmin系统开发者不必关WebAdmin开发框架的具体实现,就可设计出界面统一、操作简单、安全稳定的WebGUI界面。与WebGUI相对应,Webadmind也是采用插件式的程序开发方法。WebAdmind插件与WebGUI插件一一对应完成对界面操作的响应。DaemonWatcher是一个独立的进程监视程序,是为确保WebAdmind启动的进程能够不可间断地提供服务,一旦发现被监视程序发生异常中止,DaemonWatcher将根据进程的启动脚本立即启动被中止进程。 WebAdmin是一个用C语言设计的易用的图形用户接口开发框架,C语言的高可移植性使得WebAdmin可以广泛应用于包括Linux、Unix、Windows及各种嵌入式操作系统中,编译WebAdmin系统除Libxml2库处不需要额外的C函数库支持。WebAdmin提供了丰富的API函数,开发者可以根据自己的需要定制个性化的WebAdmin系统。 WebAdmin系统的界面风格也可以自己定制,对于OEM厂商可以根据需要修改界面风格,满足定制要求。 WebAdmin的开放设计思想,为WebAdmin系统的不断发展普奠定了基础,无数开发者提供了开源插件模块,用户甚至不用写一行代码就可根据自己的需要设计WebAdmin系统。 【简单使用方法】:下载后将压缩文件上传到Linux系统中,用tar xvfz webadmin-devel-1.3.tar.gz解压,解压后进入webadmin-devel目录,执行./configure,make命令后将会在test/webui目录下生成一个webadmin.cgi文件,将此文件拷贝到apache下的WEB根目录下cgi-bin目录下即可,为测试webadmin.cgi,还需将htdocs目录下的文件拷贝到apache的WEB根目录下,将etc目录中的所有文件拷贝到根目录下的etc中,最后用浏览器访问你的apache Web服务器即可看到Linux系统的WEB管理界面。 【说明】:编译此源码需要libxml2库的支持 有技术问题可以访问官方网站:http://www.webadminc.com,联系电话:13311223928
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值