草庐IT

2Fixture

全部标签

python - 如何使用外部 fixture 跳过 pytest?

背景我正在运行py.test与fixture在conftestfile.你可以看到下面的代码(这一切都很好):example_test.pyimportpytest@pytest.fixturedefplatform():return"ios"@pytest.mark.skipif("platform=='ios'")deftest_ios(platform):ifplatform!='ios':raiseException('notios')deftest_android_external(platform_external):ifplatform_external!='androi

python - 如何使用外部 fixture 跳过 pytest?

背景我正在运行py.test与fixture在conftestfile.你可以看到下面的代码(这一切都很好):example_test.pyimportpytest@pytest.fixturedefplatform():return"ios"@pytest.mark.skipif("platform=='ios'")deftest_ios(platform):ifplatform!='ios':raiseException('notios')deftest_android_external(platform_external):ifplatform_external!='androi

python - 如何参数化 Pytest fixture

考虑以下Pytest:importpytestclassTimeLine(object):instances=[0,1,2]@pytest.fixturedeftimeline():returnTimeLine()deftest_timeline(timeline):forinstanceintimeline.instances:assertinstance%2==0if__name__=="__main__":pytest.main([__file__])测试test_timeline使用Pytestfixturetimeline,它本身具有属性instances。该属性在测试中被迭

python - 如何参数化 Pytest fixture

考虑以下Pytest:importpytestclassTimeLine(object):instances=[0,1,2]@pytest.fixturedeftimeline():returnTimeLine()deftest_timeline(timeline):forinstanceintimeline.instances:assertinstance%2==0if__name__=="__main__":pytest.main([__file__])测试test_timeline使用Pytestfixturetimeline,它本身具有属性instances。该属性在测试中被迭

ruby-on-rails - Rails fixture 中的更改不会传播到关联

在Rails4.2.1中,我有一个Book模型。我还有BookAclbelongs_to到Book的模型。在我的测试中,我通过tests/fixtures中定义的fixture加载了这两个。在我的测试中,在setup中,我根据fixture数据实例化了两个对象。到目前为止,一切正常。在我的测试中,我修改了BookAcl对象,并希望在通过Book对象访问同一个BookAcl时反射(reflect)这些更改。然而,这并没有发生。事实上,当我(通过Pry)查看BookAcl对象时,其属性与Book.BookAcl对象不同,即使该对象的其余部分相同。我做错了什么?我如何强制这些更改通过对象图传

php - 如何在没有 fixture 的情况下在 Yii PHPUnit 测试中创建模型对象?

我正在为我的Yii应用程序编写PHPUnit测试。我读了here:Tip:Havingtoomanyfixturefilescouldincreasethetesttimedramatically.Forthisreason,youshouldonlyprovidefixturefilesforthosetableswhosecontentmaychangeduringthetest.Tablesthatserveaslook-upsdonotchangeandthusdonotneedfixturefiles.我确实有一个大型固定装置(180条记录,加载时间>20秒),仅用作查找。但

java - 任何基于 YAML 的 Java fixture 加载器?

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。关闭5年前。Improvethisquestion我用过DbUnit但是在玩了PlayFramework之后最近我发现它是Fixtures.load(StringyamlFilename)真的很有用。有人知道可用于任何Java项目的类似工具吗?

php - 是否可以在 setUp fixture 中获取当前测试?

我找不到任何这样的东西,我猜它不存在..classTestextendsPHPUnit_Framework_TestCase{publicfunctionsetUp(){echo$current_test;//Outputastring"testOne"}publicfunctiontestOne(){//Thisisthefirsttest;beforethistestisransetUp()iscalled.//Thequestionis,isthereanywaytoknowwithinsetUp()whatthe//currenttestis?}}

php - 如何处理 doctrine2 数据 fixture (平面文件)

我正在研究doctrine2以及如何处理数据固定装置。我对从平面文件(csv、yaml、xls)中读取它们特别感兴趣。在doctrine1.2中,数据固定装置是这样处理的:http://www.doctrine-project.org/projects/orm/1.2/docs/manual/data-fixtures/en#data-fixtures关于如何在doctrine2中处理这个问题有什么建议吗? 最佳答案 正如Steven已经提到的,fixture-feature作为一个单独的repo提供。我花了一些时间来弄清楚如何在S

php - 如何在 symfony WebTestCase 中通过测试中的 fixture 类型获取学说 fixture 引用?

我正在使用doctrinefixtures在我的symfony应用程序中加载测试数据。$this->fixtureLoader=$this->loadFixtures(["My\DemonBundle\DataFixtures\ORM\LoadEntity1Data","My\DemonBundle\DataFixtures\ORM\LoadEntity2Data","My\DemonBundle\DataFixtures\ORM\LoadEntity3Data","My\DemonBundle\DataFixtures\ORM\LoadEntity4Data","My\DemonBu