In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of how to use PhoenixAutotest, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to use PhoenixAutotest. Let's take a look at it.
PhoenixAutoTest is an automatic testing framework for Web based on Selenium. Through this framework, the learning difficulty of testers can be simplified. As long as a small amount of Java code is written, most of the work is to write the description files of page elements and the corresponding data sources.
Introduction
The WebUI automated testing framework phoenix.webui.framework has released version 20170610.
Added annotations to configure PageObject (page object). The unit test code is as follows:
/ * 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 "ASIS" 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 / * * example Page class using annotations * @ author suren* @ date afternoon 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 =" real name dynamic ") private Button toLoginBut @ AutoLocator (locator = LocatorType.BY_XPATH, value = "/ / input [@ placeholder=' Please enter the mobile phone number / pulse number']) 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;}}
The test code is as follows:
/ * 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 "ASIS" 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 / * Test the use of annotated configurations * @ author suren* @ date 7:10:12*/@Configuration@ComponentScan (basePackages = "org.suren.autotest.web.webframework.page") public class AutoAnnotationTest {private SettingUtil util;@Beforepublic void setUp () {util = new SettingUtil ();} @ Testpublic 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);} @ Afterpublic void tearDown () throws IOException {util.close ();} this is the end of the article on "how to use PhoenixAutotest". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use PhoenixAutotest". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.