是否有可能以编程方式在java中将Selenium HTML文件转换为JUnit测试源代码?
我需要自己的程序,它只获取这些html文件的资源,将它们转换为java代码并自动运行JUnit测试.有没有办法做到这一点?
在Selenium IDE中,可以将测试用例导出到JUnit,我知道,但是我不想使用IDE,我需要像以前说过的那样以编程方式执行此操作.
我相信有人之前需要这个,有人可以帮助我......
我有一些域对象:
@Entity
public class Log {
}
@Entity
public class LogLetter extends Log {
}
@Entity
public class LogAction extends Log {
}
Run Code Online (Sandbox Code Playgroud)
我想只有一个存储库,它允许我获取Log的孩子.
我能从头到尾做这样的事吗?
public interface LogRepository extends CrudRepository<Log, Long> {
@Query("select from ?1)
public <T> List<T> getLog(Class<T> clazz);
}
Run Code Online (Sandbox Code Playgroud)
并调用此方法:
List<LogLetter> logLetters = getLog(LogLetters.class);
Run Code Online (Sandbox Code Playgroud)
是否存在任何其他方法来做我所描述的?
我的交易有点问题.我使用Spring 3.1.1.RELEASE,Spring Data 1.0.3.RELEASE JPA和Hibernate提供程序.当我开始一个junit测试时,一个用@Transactional它注释的方法似乎很好,但是当我启动一个完整的应用程序时,没有错误但是事务不起作用.这是我的配置和示例代码:
applicationContext.xml中
<context:annotation-config />
<context:component-scan base-package="com.sheedo.upload" />
<jpa:repositories base-package="com.sheedo.upload.repository" />
<tx:annotation-driven transaction-manager="transactionManager" />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:messages/*.properties</value>
<value>classpath*:*.properties</value>
</list>
</property>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="persistenceUnit" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
Run Code Online (Sandbox Code Playgroud)
persistence.xml中
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property …Run Code Online (Sandbox Code Playgroud) 我发现在每晚构建中LibGDX中有一个新组件 - TextArea这是该scene2d.ui软件包的一部分.拥有这样的组件很好,非常容易使用,但我缺少的是对多色文本的一些支持.
我想在一个不同颜色的文本中突出显示一些关键字,但我不知道如何使用当前的api.BitmapFontCache类中有一个方法:
public void setColors (Color tint, int start, int end)
Run Code Online (Sandbox Code Playgroud)
这种方法的Javadoc说如下:
设置指定字符的颜色.这可能只在setText(CharSequence,float,float)之后调用,并且每次调用setText时都会重置.
但我不知道如何通过TextArea对象使用它,或者甚至可以这样做.有人试图搞清楚吗?每个提示都将受到赞赏.
我下载了使用css和JavaScript的登录模板.当我以默认的html格式启动它时显示确定,但是当我将相同的代码放到我的Spring MVC 3应用程序并将格式更改为jsp时,javascript部分被禁用.我可以通过我的网络浏览器访问外部js文件,所以我不知道问题出在哪里.
这是正确的看法:

但这就是我得到的:

<script language="javascript" type="text/javascript" src="js/niceforms.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/niceforms-default.css" />
Run Code Online (Sandbox Code Playgroud)
我只改变了外部js和css资源的位置,但正如我所说,这些文件是可访问的.
这是我的结构:

在我的web.xml我有这些线:
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/root-context.xml,
/WEB-INF/spring/security-context.xml,
</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring Security -->
<filter> …Run Code Online (Sandbox Code Playgroud) java ×3
junit ×2
generics ×1
javascript ×1
jpa ×1
libgdx ×1
selenium ×1
spring ×1
spring-data ×1
spring-mvc ×1
tiles2 ×1
transactions ×1