我想在我的Cucumber ExtentReports中编写自定义失败消息.
工具使用:
黄瓜
Java的
硒
JUnit的
ExtentReports
现在发生了什么:
我有一个黄瓜场景.
Given something
When I do something
Then this step fails
Run Code Online (Sandbox Code Playgroud)
失败的步骤失败:
Assert.assertTrue("CUSTOM_FAIL_MSG", some_condition);
Run Code Online (Sandbox Code Playgroud)
我想要实现的目标:
到目前为止我研究过的内容:
有一个scenario.write("")功能,但这会在报告中创建一个新的信息日志(但我正在查找CustomFailure消息而不是新的日志条目)
scenario.stepResults具有在报告中显示的String.但是,我无法找到一种方法来设置相同的值.
有什么想法吗?
我在制作范围略有不同的光栅堆栈时遇到了麻烦。这里给出的答案(第一个)很有用,但对我的情况没有帮助。例如,我想使用bio2 raster for Australia 和this Australian raster制作光栅堆栈。第二个栅格仅适用于澳大利亚,第一个栅格是全球栅格。因此,我使用crop()function将 global bio2 栅格裁剪为与澳大利亚栅格相同的范围,但生成的栅格范围(即bio2.au)略有不同(因此,我无法使用裁剪后的栅格和澳大利亚栅格制作栅格,awc)。示例代码如下:
library(raster)
awc <- raster("path to Australian raster")
bio2.g <- raster("path to Bio2 global raster")
# crop bio2.g to the same extent of awc
bio2.au <- crop(bio2.g, extent(awc))
# make a raster stack
st <- stack(awc, bio2.au)
Error in compareRaster(x) : different extent
Run Code Online (Sandbox Code Playgroud)
我也试过quick=TRUE在stack()函数内使用。但在这种情况下,单元格值awc丢失了。注意:awc光栅大小为 4GB。
# first make a list of rasters …Run Code Online (Sandbox Code Playgroud) 如果我想获取我可以使用的数组的大小(元素数),sizeof(a) / sizeof(a[0])但新标准可以使用类型特征来做到这一点:
int main(){
int a[]{5, 7, 2, 3, 6, 7};
std::cout << std::extent<decltype(a)>::value << '\n'; // 6
auto& refA = a;
std::cout << std::extent<decltype(refA)>::value << '\n'; // 0
std::cout << sizeof(refA) / sizeof(refA[0]) << '\n'; // 6
std::cout << std::extent<std::remove_reference<decltype(refA)>::type>::value << '\n'; // 6
std::cout << "\ndone!\n";
}
Run Code Online (Sandbox Code Playgroud)
一切正常,但为什么不能std::extent像sizeof()运算符那样处理对数组的引用?我必须删除上一个示例中的引用才能获得实际的数组类型。
我目前正在尝试使用PowerShell 3.0中引入的AST功能来修改ScriptBlock.我的要求是ScriptBlock的参数块中的所有参数都获得一个[Parameter(Mandatory)]属性.
基本上代码应该修改这个:
Param([string]$x)
Write-Host $x
Run Code Online (Sandbox Code Playgroud)
对此:
Param([Parameter(Mandatory)][string]$x)
Write-Host $x
Run Code Online (Sandbox Code Playgroud)
但是,我在添加新属性时遇到了一个问题,因为它需要一个IScriptExtent,我不知道应该如何创建一个新属性IScriptExtent.
如何创建新的脚本范围?我可以使用什么价值的头寸?我是否必须更改所有后续范围的位置?
我尝试重用我正在修改的每个参数的范围,但不幸的是,这似乎没有产生它应该的结果(例如,当我调用ToString修改后ScriptBlock我没有看到任何变化).
到目前为止,我的实现基于此处的ICustomAstVisitor发现.
最重要的方法如下:
public object VisitParameter(ParameterAst parameterAst)
{
var newName = VisitElement(parameterAst.Name);
var extent = // What to do here?
var mandatoryArg = new AttributeAst(extent, new ReflectionTypeName(typeof (ParameterAttribute)),
new ExpressionAst[0],
new[] {new NamedAttributeArgumentAst(extent, "Mandatory", new ConstantExpressionAst(extent, true), true)});
var newAttributes = new[] {mandatoryArg}.Concat(VisitElements(parameterAst.Attributes));
var newDefaultValue = VisitElement(parameterAst.DefaultValue);
return new ParameterAst(parameterAst.Extent, newName, newAttributes, newDefaultValue);
}
Run Code Online (Sandbox Code Playgroud) 鉴于EPSG预测(例如,这个阿拉巴马州的预测:[ http://spatialreference.org/ref/epsg/26729/] [1 ])
如何以可以在D3.js投影中使用它们的方式获取给定的WGS84投影边界.
例如,您如何知道用于显示地图的投影,旋转度或边界框?
在 openlayers 3 应用程序中,我能够检索边界范围并适合视图。不过,我现在想通过使用边界范围来创建要素/多边形。
let boundingExtent = ol.extent.boundingExtent([[left, bottom], [right, top]]);
//??/let polygon = ol.geom.Polygon.fromExtent(boundingExtent);
var view = this.map.getView();
view.fit(boundingExtent, null);
//let source = this.vectorSource.getSource();
//source.clear();
//feature.setStyle(this.VectorAltStyles);
//source.addFeatures(feature);
Run Code Online (Sandbox Code Playgroud)
使用 ol.geom.Polygon.fromExtent 并将结果添加到矢量源似乎不起作用。请问有人可以阐明如何实现这一目标吗?
Linux 程序员的手册手册页Fallocate(2)指出:
\n\n\n\n\n如果在模式
\nFALLOC_FL_UNSHARE中指定了标志,则共享文件数据区将成为文件私有,以保证后续写入不会因空间不足而失败。通常,这将通过对文件中的所有共享数据执行写时复制操作来完成。并非所有文件系统都支持此标志。
很酷,但是\xe2\x80\xa6首先如何创建共享文件数据范围?
\nCartopy 0.17.0:当我设置central_longitude时,我不知道如何准确设置提供的范围:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
projection = ccrs.PlateCarree(central_longitude=180)
ax = plt.axes(projection=projection)
ax.coastlines()
ax.set_extent((-120, 120, -45, 45), crs=ccrs.PlateCarree())
ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree())
Run Code Online (Sandbox Code Playgroud)
这正确地划分了纬度子集:
这正确地划分了经度子集,但有额外的标签:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
projection = ccrs.PlateCarree(central_longitude=180)
ax = plt.axes(projection=projection)
ax.coastlines()
ax.set_extent((-120, 120, -45, 45))
ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree())
Run Code Online (Sandbox Code Playgroud)
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
projection = ccrs.PlateCarree(central_longitude=180)
ax = plt.axes(projection=projection)
ax.coastlines()
ax.set_extent((-120, 120, -45, 45), crs=projection)
ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree())
Run Code Online (Sandbox Code Playgroud)
extent ×9
selenium ×2
angular ×1
arrays ×1
c ×1
c++ ×1
cartopy ×1
d3.js ×1
dictionary ×1
filesystems ×1
gis ×1
javascript ×1
junit4 ×1
linux ×1
matplotlib ×1
openlayers ×1
powershell ×1
projection ×1
python ×1
r ×1
raster ×1
spatial ×1
stack ×1