testing

Using an ASP.NET repeater with an array?

房东的猫 提交于 2019-12-21 07:53:03
问题 This may be a silly question but I was writing a quick test page and realised that I didn't know how to bind an array or ArrayList of strings, for example, to an ASP.NET Repeater. I experimented a bit. <asp:Repeater ID="rptImages" runat="server"> <HeaderTemplate> <h3>Items</h3> </HeaderTemplate> <ItemTemplate> <p style="background-color:Black;color:White"><%#Eval(Container.DataItem.ToString())%></p> </ItemTemplate> <FooterTemplate> <h4>End of Items</h4> </FooterTemplate> </asp:Repeater> Am I

Using an ASP.NET repeater with an array?

牧云@^-^@ 提交于 2019-12-21 07:52:51
问题 This may be a silly question but I was writing a quick test page and realised that I didn't know how to bind an array or ArrayList of strings, for example, to an ASP.NET Repeater. I experimented a bit. <asp:Repeater ID="rptImages" runat="server"> <HeaderTemplate> <h3>Items</h3> </HeaderTemplate> <ItemTemplate> <p style="background-color:Black;color:White"><%#Eval(Container.DataItem.ToString())%></p> </ItemTemplate> <FooterTemplate> <h4>End of Items</h4> </FooterTemplate> </asp:Repeater> Am I

Best way to test command line tools? [closed]

只谈情不闲聊 提交于 2019-12-21 06:58:10
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 9 months ago . I have a large collection of command line utilities that are we write ourselves and use frequently. At the moment testing them is very cumbersome and consequently we don't do as much testing as we aught to. I am wondering if anyone can suggest good techniques or tools for

How do you test a Rails controller method exposed as a helper_method?

。_饼干妹妹 提交于 2019-12-21 06:58:01
问题 They don't seem to be accessible from ActionView::TestCase 回答1: That's right, helper methods are not exposed in the view tests - but they can be tested in your functional tests. And since they are defined in the controller, this is the right place to test them. Your helper method is probably defined as private , so you'll have to use Ruby metaprogramming to call the method. app/controllers/posts_controller.rb: class PostsController < ApplicationController private def format_something "abc"

Hadoop Mini Cluster Mock (MiniDFSCluster)

﹥>﹥吖頭↗ 提交于 2019-12-21 06:57:59
问题 I need your help about hadoop-minicluster I'm working with scala (with sbt) and I try to Mock calls of HDFS. I sow hadoop-minicluster for deploying a little cluster and test on it. However, when I add the sbt dependency : libraryDependencies += "org.apache.hadoop" % "hadoop-minicluster" % "3.1.0" % Test The sources are not added and I can't import the package org.apache.hadoop.hdfs.MiniDFSCluster Do you know how I can solve the problem ? Thank you for yours answers 回答1: Surprisingly, it's not

Is there a way to undo Mocha stubbing of any_instance in Test::Unit

时光总嘲笑我的痴心妄想 提交于 2019-12-21 06:49:27
问题 Much like this question, I too am using Ryan Bates's nifty_scaffold. It has the desirable aspect of using Mocha's any_instance method to force an "invalid" state in model objects buried behind the controller. Unlike the question I linked to, I'm not using RSpec, but Test::Unit. That means that the two RSpec-centric solutions there won't work for me. Is there a general (ie: works with Test::Unit) way to remove the any_instance stubbing? I believe that it's causing a bug in my tests, and I'd

Gradle execute task after test phase even if test has failed

有些话、适合烂在心里 提交于 2019-12-21 06:48:14
问题 I am using gradle as my builder. After running all of my test I want to execute additional task. If there are no test failures test.doLast { /*my task*/ } works fine. But if there is at least one test failure my task does not execute. Is there a way to execute my task even if some of my test failed. 回答1: test.doLast doesn't add a new task, but adds another task action to the test task. What you can do instead is to declare a finalizer task : task foo(type: ...) { ... } // regular task

PHPUnit assert no method is called

旧街凉风 提交于 2019-12-21 06:47:30
问题 I have a ClassA that uses a ServiceB. In a certain case, ClassA should end up not invoking any methods of ServiceB. I now want to test this and verity no methods are indeed called. This can be done as follows: $classA->expects( $this->never() )->method( 'first_method' ); $classA->expects( $this->never() )->method( 'second_method' ); ... Is there a way to simply state "no method should be called on this object" rather then having to specify a restriction for each method? 回答1: Yes, it's quite

preventing python coverage from including virtual environment site packages

北城以北 提交于 2019-12-21 06:47:08
问题 I am new to coverage and ran into a strange problem. My coverage is taking my virtual environment site packages into account. Here is the output of the coverage run: coverage run test.py .................... ---------------------------------------------------------------------- Ran 20 tests in 0.060s OK (atcatalog)- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -jmfrank63@fullstack-audio-text-catalog:~/workspace (git master) [19:58:45] $ coverage report Name Stmts Miss

How to sort unittest TestCases properly?

别来无恙 提交于 2019-12-21 06:29:26
问题 For instance, I want these to run in the order they appear in the file. import unittest class Test_MyTests(unittest.TestCase): def test_run_me_first(self): pass def test_2nd_run_me(self): pass def test_and_me_last(self): pass class Test_AnotherClass(unittest.TestCase): def test_first(self): pass def test_after_first(self): pass def test_de_last_ding(self): pass if __name__ == "__main__": unittest.main(verbosity=2) Running this gives test_after_first (__main__.Test_AnotherClass) ... ok test_de