我正在從事硒自動化。 我的團隊使用xml文件進行測試數據。 xml文件中的測試數據將作爲bean和屬性。有沒有辦法在xml文件中獲取Bean ID
每個bean將是一個測試用例的數據。現在
,我們正在與類似下面的每個bean創建每個@Test方法:
ApplicationContext ctx = new ClassPathXmlApplicationContext("/PostPaidRegistration.xml");
RegistrationBean user = (RegistrationBean)ctx.getBean("postpaidTC1");
現在的測試用例,我們將使用「postpaidTC1」 bean的數據。
另一個測試用例我們寫成
ApplicationContext ctx = new ClassPathXmlApplicationContext("/PostPaidRegistration.xml");
RegistrationBean user = (RegistrationBean)ctx.getBean("postpaidTC2");
我想知道另一@Test方法,而不是在XML豆類創造了許多@Test方法,任何方式來運行所有的豆類(測試數據)在帶有單個@Test方法的xml中,通過獲取BeanID作爲循環。
我的XML是象下面這樣:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/data/repository
http://www.springframework.org/schema/data/repository/spring-repository-1.0.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd">
<bean id="postpaidTC1" class="com.tecnotree.CLM.beans.RegistrationBean">
<property name="service" value="GSM SERVICE" />
<property name="subService" value="Voice"/>
<property name="technology" value="gsm"/>
<property name="plan" value="POSTPAID ADV REN"/>
<property name="mCategory" value="POSTPAID NORMAL 2"/>
<property name="mSelection" value="Automatic"/>
<property name="firstName" value="Sarada"/>
<property name="middleName" value="M" />
<property name="lastName" value="Akurathi"/>
<property name ="dob" value="19/02/1989"/>
<property name ="prefLang" value="ENGLISH"/>
<property name ="prefMedium" value="Email"/>
<property name ="prefMediumValue" value="[email protected]"/>
<property name ="streetName" value="Gandhi Nagar"/>
<property name ="buildingNumber" value="12"/>
<property name ="docPurpose" value="Proof Identity"/>
<property name ="docType" value="PANCARD"/>
<property name ="docId" value="VETY3D343"/>
<property name ="docPlaceOfIssue" value="Chennai"/>
<property name ="billCycle" value="5th TO 4th MONTHLY BILL CYCLE"/>
</bean>
<bean id="postpaidTC2" class="com.tecnotree.CLM.beans.RegistrationBean">
<property name="firstName" value="Suneetha"/>
<property name="lastName" value="ss"/>
<property name ="dob" value="19/02/1989"/>
<property name ="prefLang" value="ENGLISH"/>
<property name ="prefMedium" value="Email"/>
<property name ="prefMediumValue" value="[email protected]"/>
<property name="plan" value="POSTPAID ADV REN"/>
</bean>
</beans>
迭代什麼是硒在這裏的作用??? –
在Selenium腳本中,我們使用xml和beans作爲測試數據提供者。 –
但是這不是硒問題,所以從這個問題中刪除硒標籤 –