Search Results

Search found 10010 results on 401 pages for 'a b testing'.

Page 58/401 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • Android AsyncTask testing problem with Android Test Framework

    - by Vlad
    I have a very simple AsyncTask implementation example and have problem to test it using Android JUnit framework. It works just fine when I instantiate and execute it in normal application. However when it's executed from any of Android Testing framework classes (i.e. AndroidTestCase, ActivityUnitTestCase, ActivityInstrumentationTestCase2 etc) it behaves sarngely: - It executes doInBackground() method correctly - However it doesn't invokes any of its notification methods (onPostExecute(), onProgressUpdate(), etc) -- just silently ignores them whitout showing any errors. This is very simple AsyncTask example package kroz.andcookbook.threads.asynctask; import android.os.AsyncTask; import android.util.Log; import android.widget.ProgressBar; import android.widget.Toast; public class AsyncTaskDemo extends AsyncTask<Integer, Integer, String> { AsyncTaskDemoActivity _parentActivity; int _counter; int _maxCount; public AsyncTaskDemo(AsyncTaskDemoActivity asyncTaskDemoActivity) { _parentActivity = asyncTaskDemoActivity; } @Override protected void onPreExecute() { super.onPreExecute(); _parentActivity._progressBar.setVisibility(ProgressBar.VISIBLE); _parentActivity._progressBar.invalidate(); } @Override protected String doInBackground(Integer... params) { _maxCount = params[0]; for (_counter = 0; _counter <= _maxCount; _counter++) { try { Thread.sleep(1000); publishProgress(_counter); } catch (InterruptedException e) { // Ignore } } } @Override protected void onProgressUpdate(Integer... values) { super.onProgressUpdate(values); int progress = values[0]; String progressStr = "Counting " + progress + " out of " + _maxCount; _parentActivity._textView.setText(progressStr); _parentActivity._textView.invalidate(); } @Override protected void onPostExecute(String result) { super.onPostExecute(result); _parentActivity._progressBar.setVisibility(ProgressBar.INVISIBLE); _parentActivity._progressBar.invalidate(); } @Override protected void onCancelled() { super.onCancelled(); _parentActivity._textView.setText("Request to cancel AsyncTask"); } } This is a test case. Here AsyncTaskDemoActivity is a very simple Activity providing UI for testing AsyncTask in mode: package kroz.andcookbook.test.threads.asynctask; import java.util.concurrent.ExecutionException; import kroz.andcookbook.R; import kroz.andcookbook.threads.asynctask.AsyncTaskDemo; import kroz.andcookbook.threads.asynctask.AsyncTaskDemoActivity; import android.content.Intent; import android.test.ActivityUnitTestCase; import android.widget.Button; public class AsyncTaskDemoTest2 extends ActivityUnitTestCase<AsyncTaskDemoActivity> { AsyncTaskDemo _atask; private Intent _startIntent; public AsyncTaskDemoTest2() { super(AsyncTaskDemoActivity.class); } protected void setUp() throws Exception { super.setUp(); _startIntent = new Intent(Intent.ACTION_MAIN); } protected void tearDown() throws Exception { super.tearDown(); } public final void testExecute() { startActivity(_startIntent, null, null); Button btnStart = (Button) getActivity().findViewById(R.id.Button01); btnStart.performClick(); assertNotNull(getActivity()); } } All this code is working just fine, except the fact that AsynTask doesn't invoke it's notification methods when executed by whithin Android Testing Framework. Any ideas?

    Read the article

  • Unit Testing in Entity Framework 4 - using CreateSourceQuery

    - by Adam
    There are many great tutorials on abstracting your EF4 context so that it can be tested against (without involving a DB). Two great (and similar) examples are here: http://blogs.msdn.com/b/adonet/archive/2009/12/17/walkthrough-test-driven-development-with-the-entity-framework-4-0.aspx (oops, not enough rep. points to post second URL) basically you wind up querying your repository using linq-to-objects while testing, and linq-to-entities while running, and usually they behave the same, but when you start hitting more advanced functionality, problems arise. Here's the question. When using linq-to-objects against IObjectSet (ie, unit testing), CreateSourceQuery returns null, which will probably cause your entire query to crash and burn. ie O = db.Orders.First(); O.OrderItems.CreateSourceQuery().ToList(); Is there a way to get CreateSourceQuery to just return the underlying collection, rather than null when working with collections? Unfortunately EntityCollection is sealed, and so cannot be mocked. This isn't really the end or the world if EF4 won't let you abstract things to this level, I just wanted to make sure there wasn't something I was missing.

    Read the article

  • NServiceBus Testing Framework and NAnt Issue?

    - by user344775
    Hi Guys, This is my first post here, and I'm new to NService Bus world. After play around for a couple days, and found that it's really powerful framework to creat service and easy to use. :) Now, I came across a small question. I created a project which uses NServiceBus, it got normal message handlers and Saga handlers. And also I created a couple tests around these with NServiceBus.Testing framework. It all works fine when I run the tests via ReSharper Test Runner works and NUnit console, they all works fine, but when I include them into NAnt build script, it throw the following exception: System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark) at System.Reflection.Assembly.GetTypes() at NServiceBus.Configure.<c_DisplayClass1.b__0(Assembly a) at System.Array.ForEach[T](T[] array, Action`1 action) at NServiceBus.Configure.With(Assembly[] assemblies) at NServiceBus.Configure.With(String probeDirectory) at NServiceBus.Configure.With() at NServiceBus.Testing.Test.Initialize() Any ideas? Thanks a lot.

    Read the article

  • REST tools support for development and testing

    - by nzpcmad
    There is a similar question here but it only covers some of the issues below. We have a client who requires web services using REST. We have tons of experience using SOAP and over time have gathered together a really good set of tools for SOAP development and testing e.g. soapUI Eclipse plugins wsdl2java WSStudio By "tools" I mean a product "out of the box" that we can start using. I'm not talking about cutting code to "roll our own" using Ajax or whatever. The tool set for REST doesn't seem to be nearly as mature? What tools are out there (we use C# and Java mainly) ? Do the tools handle GET, POST, PUT, and DELETE? Is there a decent Eclipse plugin? Is there a decent client testing application like WSStudio where you point the tool to the WSDL and it generates a proxy on the fly with the appropriate methods and inputs and you simple type the data in? Are there any good package monitoring tools that allow you to look at the data? (I'm not thinking about sniffers like Wireshark here but rather things like soapUI that allow you to see the request / response) ?

    Read the article

  • QUnit Unit Testing: Test Mouse Click

    - by Ngu Soon Hui
    I have the following HTML code: <div id="main"> <form Id="search-form" action="/ViewRecord/AllRecord" method="post"> <div> <fieldset> <legend>Search</legend> <p> <label for="username">Staff name</label> <input id="username" name="username" type="text" value="" /> <label for="softype"> software type</label> <input type="submit" value="Search" /> </p> </fieldset> </div> </form> </div> And the following Javascript code ( with JQuery as the library): $(function() { $("#username").click(function() { $.getJSON("ViewRecord/GetSoftwareChoice", {}, function(data) { // use data to manipulate other controls }); }); }); Now, how to test $("#username").click so that for a given input, it calls the correct url ( in this case, its ViewRecord/GetSoftwareChoice) And, the output is expected (in this case, function(data)) behaves correctly? Any idea how to do this with QUnit? Edit: I read the QUnit examples, but they seem to be dealing with a simple scenario with no AJAX interaction. And although there are ASP.NET MVC examples, but I think they are really testing the output of the server to an AJAX call, i.e., it's still testing the server response, not the AJAX response. What I want is how to test the client side response.

    Read the article

  • Testing In-App-Billing with not published App

    - by Janusz
    I have an Android App that uses In-App-Billing to sell Account Managed Items. I tested the App with the static respons ids and everything seems to work. I now want to test the App with real product Ids. I created the App in the Google Play Store and uploaded a draft Version of the App with the correct Permissions. I know created an In-App-Billing item and published the item. At the moment the App is unpublished, the item is created and published and I have a test account that is registered in the Profile of the developer account and is the only account on the device that I use for testing. The App is signed with the same key as the uploaded draft. Edit:I'm testing with Android 4.1 && 4.03 at the moment If I try to buy the item the Google Play Store pops up but shows a dialog with the following method: The item you requested is not available for purchase. How can I test buying the item without publishing the App?

    Read the article

  • PHPUnit: Testing if a protected method was called

    - by Luiz Damim
    I´m trying to test if a protected method is called in a public interface. <?php abstract class SomeClassAbstract { abstract public foo(); public function doStuff() { $this->_protectedMethod(); } protected function _protectedMethod(); { // implementation is irrelevant } } <?php class MyTest extends PHPUnit_Framework_TestCase { public function testCalled() { $mock = $this->getMockForAbstractClass('SomeClass'); $mock->expects($this->once()) ->method('_protectedMethod'); $mock->doStuff(); } } I know it is called correctly, but PHPUnit says its never called. The same happens when I test the other way, when a method is never called: <?php abstract class AnotherClassAbstract { abstract public foo(); public function doAnotherStuff() { $this->_loadCache(); } protected function _loadCache(); { // implementation is irrelevant } } <?php class MyTest extends PHPUnit_Framework_TestCase { public function testCalled() { $mock = $this->getMockForAbstractClass('AnotherClass'); $mock->expects($this->once()) ->method('_loadCache'); $mock->doAnotherStuff(); } } The method is called but PHPUnit says that it is not. What I´m doing wrong? Edit I wasn´t declaring my methods with double colons, it was just for denoting that it was a public method (interface). Updated to full class/methods declarations. Edit 2 I should have said that I´m testing some method implementations in an abstract class (edited the code to reflect this). Since I can not instantiate the class, how can I test this? I´m thinking in creating an SomeClassSimple extending SomeClassAbstract and testing this one instead. Is it the right approach?

    Read the article

  • Testing ASP.NET webservice using NUnit and transferring session state

    - by herbertyeung
    I have a NUnit test class that starts an ASP.NET web service (using Microsoft.VisualStudio.WebHost.Server) which runs on http://localhost:1070 The problem I am having is that I want to create a session state within the NUnit test that is accessible by the ASP.NET web service on localhost:1070. I have done the following, and the session state can be created successfully inside the NUnit Test, but is lost when the web service is invoked: //Create a new HttpContext for NUnit Testing based on: //http://blogs.imeta.co.uk/jallderidge/archive/2008/10/19/456.aspx HttpContext.Current = new HttpContext( new HttpRequest("", "http://localhost:1070/", ""), new HttpResponse( new System.IO.StringWriter())); //Create a new HttpContext.Current for NUnit Testing System.Web.SessionState.SessionStateUtility.AddHttpSessionStateToContext( HttpContext.Current, new HttpSessionStateContainer("", new SessionStateItemCollection(), new HttpStaticObjectsCollection(), 20000, true, HttpCookieMode.UseCookies, SessionStateMode.Off, false)); HttpContext.Current.Session["UserName"] = "testUserName"; testwebService.testMethod(); I want to be able to get the session state created in the NUnit test for Session["UserName"] in the ASP.NET web service: [WebMethod(EnableSession=true)] public int testMethod() { string user; if(Session["UserName"] != null) { user = (string)Session["UserName"]; //Do some processing of the user return 1; } else return 0; } The web.config file has the following configuration for the session state configuration and would like to remain using InProc than rather StateServer Or SQLServer: <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" timeout="20"/>

    Read the article

  • NullPointerException on Activity Testing Tutorial

    - by Bendik
    Hello, I am currently trying the activity testing tutorial (Found here), and have a problem. It seems that whenever I try to call something inside the UIThread, I get a java.lang.NullPointerException. public void testSpinnerUI() { mActivity.runOnUiThread( new Runnable() { public void run() { mSpinner.requestFocus(); } }); } This gives me: Incomplete: java.lang.NullPointerException and nothing else. I have tried this on two different samples now, with the same result. I tried with a try/catch clause around the mSpinner.requestFocus() call, and it seems that mSpinner is null inside the thread. I have set it properly up with the setUp() function found in the same sample, and a quick assertNotNull( mSpinner ) shows me that mSpinner is in fact not null after the setUp() function. What can be the cause of this? EDIT; ok, some more testing has been done. It seems that the application that is being tested resets between each test. This essentially makes me have to reinstantiate all variables between each test. Is this normal?

    Read the article

  • Rails 4 testing bug?

    - by Jamato
    Situation: if we add two identic line items into a cart, we update line item quantity instead of adding a duplicate.In browser everything works fine but in unit testing section something fails because of an empty cycle in code. Which I wanted to use to update all prices. Why? Is that a unit test engine bug? LineItem.all and cart.line_items in process of testing produce two DIFFERENT structures. #<LineItem id: 980190964, product_id: 1, cart_id: 999, created_at: "2014-06-01 00:21:28", updated_at: "2014-06-01 00:21:28", quantity: 2, price: #<BigDecimal:ba0fb544,'0.4E1',9(27)>> #<LineItem id: 980190964, product_id: 1, cart_id: 999, created_at: "2014-06-01 00:21:28", updated_at: "2014-06-01 00:21:28", quantity: 1, price: #<BigDecimal:ba0d1b04,'0.4E1',9(27)>> cart.line_items guy did not update quantity Code itself (produces LineItem which is then saved in line_item_controller which calls this method) class Cart < ActiveRecord::Base has_many :line_items, dependent: :destroy def add_product(product_id) # LOOK THIS CYCLE BREAKS UNIT TEST, SRSLY, I MEAN IT line_items.each do |item| end current_item = line_items.find_by(product_id: product_id) fresh_price = Product.find_by(id: product_id).price if current_item current_item.quantity += 1 else current_item = line_items.build(product_id: product_id, price: fresh_price) end return current_item end ... Unit test code test "non-unique item added" do cart = Cart.new(:id => 999) line_item0 = cart.add_product(2) line_item0.save line_item1 = cart.add_product(1) line_item1.save assert_equal 2, cart.line_items.size #success line_item2 = cart.add_product(1) line_item2.save assert_equal 2, cart.line_items.size, "what?" assert cart.total_price > 15 #fail, prices are not enough, quantity of product1 = 1 #we get total price from quantity, it's a simple method in model end And once again: IT DOES WORK in browser as it should. Even with cycle. I feel so dumb right now...

    Read the article

  • EF4 - possible to mock ObjectContext for unit testing?

    - by steve.macdonald
    Can it be done without using TypeMock Islolator? I've found a few suggestions online such as passing in a metadata only connection string, however nothing I've come across besides TypeMock seems to truly allow for a mock ObjectContext that can be injected into services for unit testing. Do I plunk down the $$ for TypeMock, or are there alternatives? Has nobody managed to create anything comparable to TypeMock that is open source?

    Read the article

  • actionscript - testing actionscript via command line

    - by ludicco
    Hello, I would like to know if is there any easy way to test actionscript by using some kind of application like ruby's irb or javasctip spidermonkey where you can just open up your terminal and type the code straight away. This would be a good time saver when speaking of actionscript, since to test some syntaxes, classes, etc. you would need to compile it via fsch. but still not a good option just for quick testing, etc... Cheers

    Read the article

  • .NET 3.0 Unit Testing getting System.MethodAccessException calling .NET 2.0

    - by NealWalters
    Is there any way to get around this exception? Can I not call a .NET 2.0 from 3.5? I have to write .NET 2.0 to maintain capability with BizTalk 2006/R2. But I would like to test with VS2008 Unit Tests to be consistent to other non-BizTalk code that we are testing. Test method ABC.UnitTest.UnitTest1.TestReferenceCode1 threw exception: System.MethodAccessException: ABC.EasyRegEx.extractUsingRegEx(System.String, System.String).

    Read the article

  • dUnit Testing in Delphi (how to test private methods)

    - by Charles Faiga
    I have a class that I am unit testing into with dUnit It has a number of methods some public Methods & Private Methods type TAuth = class(TDataModule) private procedure PrivateMethod; public procedure PublicMethod; end; In order to write a unit test for this class I have to make all the methods public. Is there a differt way to declare the PrivateMethods so that I can still unit test them but they are not Public ?

    Read the article

  • Phpunit Testing with Codeignitor and Doctrine

    - by Bhavin Rana
    I M Currently using Phpunit PHP Testing Framework. But i have problems in using combination of Doctrine ORM and Codeignitor PHP Framework. PHPUnit not working with the Combine Codeignitor and Doctrine so much errors there.. what should do? any body can solve this problem? Code ignitor and PHPUnit User plz contact. well i ve used the foo stack for codeignitor //Bhavin A Rana

    Read the article

  • How can I assign more than one ValueProvider to ModelBindingContext when testing a custom model bind

    - by Byron Sommardahl
    I have a custom model binder that uses data from session, tempdata, and form collection (hypothetically, of course!). When testing my model binder, need to create a ModelBindingContext with a ValueProvider. Trouble is, I can't see how I can have one ValueProvider that serves multiple value provider types. Any words of wisdom? ValidModelBindingContext = new ModelBindingContext { ModelName = "SomeModel", ValueProvider = ValidFormValueCollection };

    Read the article

  • Penetration testing tools

    - by Shoban
    We have 100s of websites which were developed in asp, .net and java... and we are paying lot of money for an external agency to do a penetration testing for our sites to check for security loop holes. Are there any (good) software (paid or free) to do this? or.. are there any tehnical articles which can help me develop this tool.

    Read the article

  • Testing Paypal error messages using ActiveMerchant

    - by vrish88
    Hello, Is there a way to test your application's processing and handling of Paypal generated credit card errors? I'd like to verify that my application can handle a declined credit card or something like that. So is there a way to have Paypal send an error message? Or would it be better to generate a stub and use it in the testing environment? If this is the better way, how would one generate a stub? Thanks!

    Read the article

  • Testing drag-and-drop with Watir

    - by Marcel J.
    I'm evaluating Watir right now. While Selenium has a dragAndDropToObject command (which seems to be broken) Watir seems not to have such a command. I couldn't find a script/tutorial with an example of how to test DnD with Watir. Did anybody try/succeed in testing drag-and-drop with Watir? Btw.: I am using jQuery for the DnD implementation.

    Read the article

  • Testing for undefined and null child objects in ActionsScript/Flex

    - by dbasch
    Hi Everyone, I use this pattern to test for undefined and null values in ActionScript/Flex : if(obj) { execute() } Unfortunately, a ReferenceError is always thrown when I use the pattern to test for child objects : if(obj.child) { execute() } ReferenceError: Error #1069: Property child not found on obj and there is no default value. Why does testing for child objects with if statements throw a ReferenceError? Thanks!

    Read the article

  • VS2010 Load Testing - Restricting ports

    - by marks-s
    As per the trouble shooting guide for VS2010 Load Testing (http://social.msdn.microsoft.com/Forums/en/vststest/thread/df043823-ffcf-46a4-9e47-1c4b8854ca13), I'm trying to restrict the range of ports used for client-controller communication. HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\VisualStudio\10.0\EnterpriseTools\QualityTools\ListenPortRange\PortRangeStart HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\VisualStudio\10.0\EnterpriseTools\QualityTools\ListenPortRange\PortRangeEnd I've set these keys on the client as described but according to netstat the client is still listening on random ports. The controller is attempting to communicate on the same random ports as the client. Anyone experienced the same?

    Read the article

  • A/B testing on App Engine?

    - by Silver Dragon
    What would be the simplest implementation of an A/B testing system running on App engine? I'm especially keen towards performance implications of using Datastore for back-end (with looong query times), and database design.

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >