我需要编写一个黄瓜场景来测试项目列表是否按顺序排序(按名称).我有类似的东西:
Scenario: Sort projects by name
Given there is a project called "Project B"
And there is a project called "Project A"
And there is a project called "Project C"
Given I am on the projects page
When I follow "Sort by name"
Then I should see in this order ["Project A", "Project B", "Project C"]
Run Code Online (Sandbox Code Playgroud)
我添加了一个步骤,看起来像:
Given /^I should see in this order (\[.*\])$/ do |array|
end
Run Code Online (Sandbox Code Playgroud)
测试页面上列出的项目是否显示正确顺序的最佳方法是什么?我试图通过jQuery获取所有项目名称:
$(function() {
var arrjs = new Array();
$("div.project-main-info").find("a:first").each(function(){
arrjs.push($(this).text());
})
}); …Run Code Online (Sandbox Code Playgroud) 这对我来说很奇怪,但是当我启动程序时,我遇到了意想不到的随机分段错误.有时它会工作,有时会崩溃.. Dev-C++的调试器指向我的文件行:stl_construct.h
/**
* @if maint
* Constructs an object in existing memory by invoking an allocated
* object's constructor with an initializer.
* @endif
*/
template<typename _T1, typename _T2>
inline void
_Construct(_T1* __p, const _T2& __value)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_]allocator::construct
-> ::new(static_cast<void*>(__p)) _T1(__value);
}
Run Code Online (Sandbox Code Playgroud)
顺便说一句,我正在广泛使用STL ..如何检测段错误的起源?有没有可以提供帮助的工具?导致这样的随机崩溃的原因是什么?
我的程序大约有5000行代码.我不知道为了得到一些帮助我必须显示哪些代码,因为我不知道问题的根源,我从调试器得到的只是它与STL有关.
我搬到了Code::Blocks现在,这里是调用堆栈:
#0 00464635 std::_Construct<std::pair<double const, int>, std::pair<double const, int> >(__p=0xb543e8, __value=@0x10) (C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_construct.h:81)
#1 00462306 std::_Rb_tree<double, std::pair<double const, int>, std::_Select1st<std::pair<double const, int> …Run Code Online (Sandbox Code Playgroud) 我正在从一个类的实例中填充C#中的ComboBox.如何通过检索对相应对象的引用来获取所选项?我已经使用了SelectedValue,SelectedItem,SelectedIndex,但它们都返回了我的对象的字符串表示.
谢谢
[编辑]
一段代码,以显示我正在尝试做的事情:
填充部分:
foreach (Business.IAuteur auteur in _livreManager.GetAuthors())
{
comboAuthor.Items.Add(auteur);
}
Run Code Online (Sandbox Code Playgroud)
单击保存按钮时激活的检索部分:
private void btnSave_Click(object sender, EventArgs e)
{
Business.IAuteur auteur = new Business.Auteur();
auteur = (Business.IAuteur)comboAuthor.SelectedValue;
// A short verification that my item has been correctly
// retrieved
toolStripStatusLabel1.Text = auteur.Nom;
}
Run Code Online (Sandbox Code Playgroud)
错误消息,指向此处:toolStripStatusLabel1.Text = auteur.Nom;
你调用的对象是空的.
我正在解析项目的App.config文件.此配置文件已从调用者项目加载.在被调用的项目中,我有类似的东西:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("app.config");
// Some parsing...
Run Code Online (Sandbox Code Playgroud)
不幸的是,app.config文件找不到正确的位置.显然,Load方法正在浏览调用者项目的〜/ bin/Release目录,但app.config文件位于〜目录中.
有没有办法可以正确加载这个App.config文件?
谢谢
我需要从配置文件中解析实际的日期值.所以我需要知道是否有任何字符串表示,DateTime.Now()?所以我可以解析它DateTime.Parse(..)?
谢谢
编辑
对不起,我没有很好地解释自己.我重新解释了我的问题.我的配置文件包含以下部分:
<Parameters>
<Parameter Name="StartTime" Value="**I Want to put a string here that will be parsed as DateTime.Now()**"/>
</Parameters>
Run Code Online (Sandbox Code Playgroud)
注意Value属性中指定的内容!
我想知道在ASP .NET中点击导航器的后退按钮后是否有任何方法可以检测页面何时被重新加载?
谢谢
我要做的是迭代转发器并读取一些控件值:
foreach (RepeaterItem iter in TablePanier.Items)
{
string guid = ((HiddenField)iter.FindControl("guid")).Value.ToString();
// nombre exemplaires du livre
int nbExemplaires = int.Parse(((System.Web.UI.WebControls.TextBox)iter.FindControl("txtNbExemplaires")).Text.ToString());
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我有一个HiddenValue和一个TextBox.不幸的是,这不起作用,值无法正确读取.
怎么了?
谢谢!
编辑: 这是表格的完整代码:
public partial class Panier : System.Web.UI.Page
{
Bussiness.Manager _manager = new Bussiness.Manager("MSSQLSERVER");
IEnumerable<Bussiness.iPanier> _paniers;
CurrencyConvertor _currencyConvertor = new CurrencyConvertor();
Bussiness.iCommande _commande;
int idPanier;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["login"] != null)
{
Security security = new Security();
_paniers = _manager.chargerPannierUtilisateur(Session["login"].ToString());
foreach (Bussiness.iPanier p in _paniers)
{
idPanier = p.id;
TablePanier.DataSource = …Run Code Online (Sandbox Code Playgroud) 无论如何,我可以想象一个Android应用程序的调用堆栈?我在Eclipse中找到的只是运行线程:

我想要的是看看我的子程序是如何被调用的,以便调试与堆栈活动相关的问题.
谢谢!