WebUI 출시 자동화 테스트 프레임워크PhoenixAutotest

4799 단어 linuxprobe
소개하다.
WebUI 자동화 테스트 프레임워크phoenix.webui.framework 릴리즈 20170610
이번 발표는 일부 버그를 수정했으며 더 많은 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();
	}
}

관련 링크
Phoenix Autotest 상세 설명: 클릭하여 보기
Phoenix Autotest의 다운로드 주소: 다운로드를 클릭하십시오.
이 문서의 주소:http://www.linuxprobe.com/webui-phoenixautotest.html
편집: 오향평, 심사원: 증보보

좋은 웹페이지 즐겨찾기