我正在学习nodejs,我有一个mongodb数据库,我必须与之交互.我目前正在考虑使用mocha作为单元测试框架,使用zombie.js作为验收测试框架.我想知道怎样才能进行全面的验收测试,这些测试打到了mongodb数据库.是否有框架/模块可以帮助用测试数据库替换数据库,或者mocha或zombie.js具有可以轻松用于替换数据库的功能.
还有一个框架类似于工厂(而不是夹具)创建数据库对象的想法.
我在rails世界中遇到的类似概念是在rspec中,有一个spec_helper.rb文件在运行测试之前运行,该文件设置项目配置以决定在运行测试时要命中哪个数据库.它在运行测试之前使用database_cleaner清理测试数据库.对于工厂,我使用Factory girl在rails世界中再次从数据库模式创建工厂对象.
谢谢
嗨,
我有一个非常简单的集成测试
require 'integration_test_helper'
Capybara.current_driver = :rack_test
class AdminSignsInTest < ActionDispatch::IntegrationTest
test 'can sign in' do
email = 'bob@example.com'
password = 'secret_password'
Admin.create email: email, password: password
visit new_admin_session_path
fill_in 'admin_email', with: email
fill_in 'admin_password', with: password
click_button I18n.t('devise.views.sign_in')
assert_equal I18n.t('devise.sessions.signed_in'), find('p.notice').text
end
end
Run Code Online (Sandbox Code Playgroud)
当我将Capybara驱动程序设置为rack_test测试通行证时,但是当我将其设置为时selenium,它会因"电子邮件或密码无效"而失败.在登录页面上(我正在使用Devise).我究竟做错了什么?
我正在使用spring 3.2.0和junit 4
这是我需要测试的控制器方法
@RequestMapping(value="Home")
public ModelAndView returnHome(){
return new ModelAndView("Home");
}
Run Code Online (Sandbox Code Playgroud)
spring-servlet配置是:
<context:annotation-config/>
<context:component-scan base-package="com.spring.poc" />
<mvc:annotation-driven />
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
Run Code Online (Sandbox Code Playgroud)
这是我的测试类:
public class TestController {
private MockMvc mockMvc;
@Before
public void setup() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/");
viewResolver.setSuffix(".jsp");
this.mockMvc = standaloneSetup(new CController()).setViewResolvers(
viewResolver).build();
}
@Test
public void CControllerTest() throws Exception {
......
......
}
Run Code Online (Sandbox Code Playgroud)
}
如何使用MockMvc测试此方法?
我正在使用TestRestTemplate我们产品的集成测试.
我有一个看起来像这样的测试:
@Test
public void testDeviceQuery() {
ResponseEntity<Page> deviceInfoPage = template.getForEntity(base, Page.class);
// validation code here
}
Run Code Online (Sandbox Code Playgroud)
此特定请求需要Header值.有人可以告诉我如何在TestRestTemplate电话中添加标题吗?
这个问题提到了两个库,这两个库都没有维护,一个已经断开了源和文档的链接.
SSISUnit最后一次更新于2008年,SSIStester在文档中断开了链接,自2013年以来一直没有更新.
social.msdn.microsoft.com上的答案通常也指向这两个库中的一个,或某种自定义解决方案.
还有其他选择吗?
是否有任何与较新版本的SSIS(2015+)相关的更新?
我已经检查了类似的问题:
对于我的Rails Web应用程序的集成测试,我使用Steak(类似Cucumber).Steak的规格位于名为spec/acceptance的文件夹中.Steak/Cucumber现在用于集成或验收测试吗?我一直认为这是不同的东西.
integration-testing rspec ruby-on-rails acceptance-testing cucumber
Visual Studio基于一种方法为我创建了一个单元测试项目(右键单击添加测试).当我尝试访问数据库时,我得到一个例外.抛出此代码以查看我的连接是什么:
ConnectionStringSettings connStringSettings = ConfigurationManager.
ConnectionStrings["myConnectionString"];
Run Code Online (Sandbox Code Playgroud)
但是,connStringSettings是空的.经过检查,ConnectionStrings集合只有一个.它似乎不是从我的web.config读取.
我的DAL是隔离的,不能通过代码设置其连接字符串.它的连接字符串在代码中设置如下:
set
{
value = System.Configuration.ConfigurationManager.
ConnectionStrings["myConnectionString"].ConnectionString;
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
c# integration-testing connection-string web-config visual-studio-2010
我想写一些集成测试,验证用户是否收到注册确认电子邮件.
理想情况下,为此我想:
是否有任何一次性电子邮件帐户提供简单的API?我找不到任何,但现有的很容易解析/提出请求(例如http://10minutemail.com/).
这听起来像个好主意吗?另一种方法是使用一些gmail帐户并为此目的使用标签.但是,处理垃圾邮件文件夹,其他文件夹等中的msgs听起来有点复杂.
我有简单的页面用javascript验证输入中写的电子邮件:
email.html:
<!DOCTYPE html>
<html>
<head>
<title>Email validation</title>
<script src="email.js"></script>
</head>
<body>
<span style="padding: 5px;">
<input type="text" id="email-input" placeholder="Email..."></input>
</span>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
email.js:
var checkEmail = function() {
var regexp = /BIG_REGEX/;
var email = document.getElementById('email-input').value;
if (email === '')
removeFrame();
else if (regexp.test(email))
drawFrame('green');
else
drawFrame('red');
};
var removeFrame = function() {
var input = document.getElementById('email-input');
input.parentNode.style.backgroundColor = input.parentNode.parentNode.style.backgroundColor;
};
var drawFrame = function(color) {
var input = document.getElementById('email-input');
input.parentNode.style.backgroundColor = color;
};
window.onload = function() {
document.getElementById('email-input').onkeyup = …Run Code Online (Sandbox Code Playgroud) 我的spring-data-rest集成测试因简单的json请求而失败.考虑下面的jpa模型
Order.java
public class Order {
@Id @GeneratedValue//
private Long id;
@ManyToOne(fetch = FetchType.LAZY)//
private Person creator;
private String type;
public Order(Person creator) {
this.creator = creator;
}
// getters and setters
}
Run Code Online (Sandbox Code Playgroud)
Person.java
ic class Person {
@Id @GeneratedValue private Long id;
@Description("A person's first name") //
private String firstName;
@Description("A person's last name") //
private String lastName;
@Description("A person's siblings") //
@ManyToMany //
private List<Person> siblings = new ArrayList<Person>();
@ManyToOne //
private Person father;
@Description("Timestamp this person object …Run Code Online (Sandbox Code Playgroud) java integration-testing spring-data-jpa spring-data-rest spring-boot
java ×2
spring ×2
spring-boot ×2
c# ×1
casperjs ×1
cucumber ×1
email ×1
etl ×1
javascript ×1
junit ×1
mocha.js ×1
mongodb ×1
node.js ×1
phantomjs ×1
rspec ×1
selenium ×1
sql-server ×1
ssis ×1
testing ×1
unit-testing ×1
web-config ×1
zombie.js ×1