我想为我的应用程序进行集成测试和系统测试,但是产生良好的集成和系统测试通常需要我付出很多努力,而我并没有费心.我尝试了几次,我编写了定制的,特定于应用的测试线束,这种感觉就像每次重新发明轮子一样.我想知道这是不是错误的做法.是否存在集成和完整系统测试的"标准"方法?
编辑:澄清,它是桌面和Web应用程序的自动化测试.理想情况下,它是一个完整的测试套件,可以运行应用程序的全部功
我有一个使用Selenium创建的测试方法,类似于:
[TestFixture]
public class Test_Google
{
IWebDriver driver;
[SetUp]
public void Setup()
{
driver = new InternetExplorerDriver();
}
[TearDown]
public void Teardown()
{
driver.Quit();
}
[Test]
public void TestSearchGoogleForTheAutomatedTester()
{
//Navigate to the site
driver.Navigate().GoToUrl("http://www.google.co.uk");
//Find the Element and create an object so we can use it
IWebElement queryBox = driver.FindElement(By.Name("q"));
//Work with the Element that's on the page
queryBox.SendKeys("The Automated Tester");
queryBox.SendKeys(Keys.ArrowDown);
queryBox.Submit();
//Check that the Title is what we are expecting
Assert.True(driver.Title.IndexOf("The Automated Tester") > -1);
}
} …Run Code Online (Sandbox Code Playgroud) testing selenium windows-services webbrowser-control system-testing
我正在使用nose一些系统测试,其中一个是测试(配置)文件是否存在.如果这个文件存在,我想对它运行一些额外的测试.如果没有,我想跳过一堆测试.
nose如果主要测试通过,最好的方法包括额外的测试?
我被要求对已经完成的项目进行测试,问题是这样的:
测试(测试用例设计应分别包含在单元测试,集成测试,系统测试中;单元测试,集成测试,系统测试的结果报告应单独包含在内。此外,调试和代码改进的细节也应包括在内包括在内。)
问题是我应该如何进行单元测试以及如何在项目报告中显示它。
vb.net integration integration-testing unit-testing system-testing
为了更好地验证数据库脚本的部署,我想使用生产数据库的镜像预初始化我的Staging数据库,这是我的Octopus部署的第一步.我正在使用SQL Azure和DACFX.我很好奇是否有其他人试过这个......
Start-AzureSqlDatabaseCopy正确的PS cmdlet用于此操作?更新
我开发了下面的脚本,似乎有效.但是,在数据库完成复制之前,我无法阻止脚本的完成.在某些时候Get-AzureSqlDatabaseCopy会抛出错误(也许Azure无法处理负载?).
Import-Module 'C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\ServiceManagement\Azure\Azure.psd1'
$serverName = "..."
$sourceDbName = "..."
$targetDbName = "..."
$testdb = Get-AzureSqlDatabase -ServerName $serverName -DatabaseName $targetDbName -ErrorAction SilentlyContinue
IF (!$testdb)
{
Write-Host "TestDB Not Found"
}
ELSE
{
Remove-AzureSqlDatabase -ServerName $serverName -Database $testdb -Force
}
$dbCopy = Start-AzureSqlDatabaseCopy -ServerName $serverName -DatabaseName $sourceDbName -PartnerDatabase $targetDbName
WHILE ($dbCopy)
{
Write-Progress -Activity "Copying Database" -PercentComplete [int]$dbCopy.PercentComplete
$dbCopy = Get-AzureSqlDatabaseCopy -ServerName $serverName -DatabaseCopy $dbCopy
# Sleep …Run Code Online (Sandbox Code Playgroud) powershell continuous-integration system-testing octopus-deploy azure-sql-database
我有一个测试方法,使用NUnit和Selenium,它在我们的网站上打开浏览器,该浏览器位于Production Server上并注册用户并验证注册是否成功.
(我知道理想情况下系统测试应该在单独的测试服务器而不是生产上运行,但在这里他们想测试prod系统是否有效!)
问题是如何通过此测试回滚数据库更改?例如,运行状态之前和之后我的数据库的状态应该是相同的.
我想到了3种可能的选择,但没有一种是实用的:
1)在开始测试(Setup)之前和运行测试之后(TearDown)编写SQL查询以从实际表中删除; 这是我当前的方法但是这种方法的问题在于我必须确切地知道每个运行的系统测试涉及哪些表,这可能很快变得非常复杂,因为测试可能会影响多个表.
2)编写事务代码这不是一个选项,因为代码更改是由网站完成的,而不是由编写的单元测试完成的.
3)在每次测试开始之前获取现有数据库(SQL Server 2008 R2)的快照,然后在测试完成后,将快照还原到原始快照.如果我们只能在Staging环境中运行测试,这个想法对我来说听起来不错,但问题是测试必须在生产上运行并且可能需要5分钟才能完全滚动并恢复它,这将是一个愚蠢的想法,因为在那5分钟内完成的更改将会丢失!
请告知解决此问题的最佳方法是什么方法?可能有第四种选择?
谢谢,
希望有人可以帮助我。我确实进行了搜索,但没有找到任何有效的解决方案。
我已经开始为应用编写测试。我的集成测试运行正常,但后来我决定,那么多的TDD的驱动,因为我没有,因为我没有那么多时间,现在要进行广泛的测试应用程序的所有层,我应该使用的,而不是integration检验system测试,因为它们使我可以像在浏览器中一样测试整个流程。
Rails 5.1.2
Gemfile
(尝试了不同的变化,只是水豚,然后结合了其他两个)
gem 'minitest-rails'
gem 'minitest-rails-capybara'
gem 'capybara'
Run Code Online (Sandbox Code Playgroud)
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
EMPTY_NEW_USER = {
email: '',
first_name: '',
last_name: '',
username: '',
password: ''
}
EXISTING_USER = {
email: '****',
first_name: 'John',
last_name: 'Doe',
username: '',
password: 'testingpass',
password_confirmation: 'testingpass'
}
# Add more helper methods to be used by …Run Code Online (Sandbox Code Playgroud) selenium ×2
unit-testing ×2
capybara ×1
integration ×1
java ×1
minitest ×1
nose ×1
nunit ×1
powershell ×1
python ×1
sql-server ×1
testing ×1
vb.net ×1