With Apple making changes to section 3.3.1 on the iPhone dev agreement can one stillness libraries like boost in their apps?
I want to use Boost in my iPad app...
If I want to check for the existance of a single file, I can test for it using test -e filename or [ -e filename ].
Supposing I have a glob and I want to know whether any files exist whose names match the glob. The glob can match 0 files (in which case I need to do nothing), or it can match 1 or more files (in which case I need to do something). How can I test whether a glob has any matches.?
(test -f glob* fails if the glob matches more than one file.)
Hi,
this might be rather unspecific, but I'm trying to do 'rake test' on a new rails app, and end up with
(in /Users/myname/dev/railstest/RailsApplication1)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
No other output.
System is Leopard 10.5, Rails 2.3.5, Ruby 1.86
Any ideas ?
Hi there,
From the Jobeet tutorial provided in Symfony website, I found out that I can load fixtures data each time I run unit test by using this script:
Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
However, I want to delete and reload all records from database each time I run a unit test. Currently, I'm doing this manually (Run symfony doctrine:build --all before each test). Can someone provided me a correct way to do this?
I have this test case
def test_loginin_student_control_panel(self):
c = Client()
c.login(username="tauri", password="gaul")
response = c.get('/student/')
self.assertEqual(response.status_code, 200)
the view associated with the test case is this
@login_required
def student(request):
return render_to_response('student/controlpanel.html')
so my question is why the above test case redirects user to login
page? should not c.login suppose to take care authenticating user?
I have a fairly simple file-system website consisting of one aspx page and several classes in separate .cs files. Everything is on my own HD. The web app itself builds and runs fine. Out of curiosity I decided to try out Visual Studio's nifty, easy-to-use unit test feature. So I opened each class file and clicked Create Unit Tests. VS generated a test project containing a set of test classes and some other files. Easy! But when I try to build or run the test project it throws a series of build errors, one for every class:
The type or namespace name 'class-name' could not be found (are you missing a using directive or an assembly reference?).
Somebody asked if my test project has a reference to the original project. Well no, because the original project is a file-system website. It has no bin folder and no DLL, so there's nothing to reference as far as I can tell. I would think that since VS generated these unit tests it would generate whatever references it needs, but apparently not. Is generating unit tests for file-system web apps an undocumented no-no, or is there a magic trick to getting it to work?
I have a Fitnesse test that I want to run twice. Once in firefox and once in ie. The test is below. The problem I am having is that only the second test is being executed by fitnesse
!define COMMAND_PATTERN {%m %p}
!define TEST_RUNNER {dotnet2\FitServer.exe}
!****>Global Variables
!define testUrl {http://localhost:1516/Web.App/Login.aspx}
*****!
!define browserToUse (IE)
!include -c -seamless .FrontPage.LoginTests
!define browserToUse (FireFox)
!include -c -seamless .FrontPage.LoginTests
I previously asked this question under another name but deleted it because I didn't explain it very well.
Let's say I have a class which manages a file. Let's say that this class treats the file as having a specific file format, and contains methods to perform operations on this file:
class Foo {
std::wstring fileName_;
public:
Foo(const std::wstring& fileName) : fileName_(fileName)
{
//Construct a Foo here.
};
int getChecksum()
{
//Open the file and read some part of it
//Long method to figure out what checksum it is.
//Return the checksum.
}
};
Let's say I'd like to be able to unit test the part of this class that calculates the checksum. Unit testing the parts of the class that load in the file and such is impractical, because to test every part of the getChecksum() method I might need to construct 40 or 50 files!
Now lets say I'd like to reuse the checksum method elsewhere in the class. I extract the method so that it now looks like this:
class Foo {
std::wstring fileName_;
static int calculateChecksum(const std::vector<unsigned char> &fileBytes)
{
//Long method to figure out what checksum it is.
}
public:
Foo(const std::wstring& fileName) : fileName_(fileName)
{
//Construct a Foo here.
};
int getChecksum()
{
//Open the file and read some part of it
return calculateChecksum( something );
}
void modifyThisFileSomehow()
{
//Perform modification
int newChecksum = calculateChecksum( something );
//Apply the newChecksum to the file
}
};
Now I'd like to unit test the calculateChecksum() method because it's easy to test and complicated, and I don't care about unit testing getChecksum() because it's simple and very difficult to test. But I can't test calculateChecksum() directly because it is private.
Does anyone know of a solution to this problem?
I'm trying to write a test for this class its called Receiver :
public void get(People person) {
if(null != person) {
LOG.info("Person with ID " + person.getId() + " received");
processor.process(person);
}else{
LOG.info("Person not received abort!");
}
}
Here is the test :
@Test
public void testReceivePerson(){
context.checking(new Expectations() {{
receiver.get(person);
atLeast(1).of(person).getId();
will(returnValue(String.class));
}});
}
Note: receiver is the instance of Receiver class(real not mock), processor is the instance of Processor class(real not mock) which processes the person(mock object of People class). GetId is a String not int method that is not mistake.
Test fails : unexpected invocation of
person.getId()
I'm using jMock any help would be appreciated. As I understood when I call this get method to execute it properly I need to mock person.getId() , and I've been sniping around in circles for a while now any help would be appreciated.
I have a php mail script sitting on a LAMP vps server. The script grabs about 1000 emails and sends them each an html email.
I tested the script with about half a dozen of my own test email accounts and things worked fine. But I am concerned something may go wrong when I actually use this script for 1000 emails. Some things I would like to test for are
1) Confirm all 1000 emails were sent and received
2) Test to make sure emails did not end up in people's spam folders
3) Detect any other general failures
Does anyone have suggestions on how I can test for the above cases? I would like to read about your experiences building batch email scripts.
I want to use selenium test to cover my rails project ! but i just find little documents on selenium test . I want someone to give me some documents for selenium test of all types !like website ,pdf ,text etc. you can sent them to my gmail [email protected] Thank you ,and best regards!
SQLite claim to have 679 times more test code than production one.
http://www.sqlite.org/testing.html
Does anyone knows how it is possible? Do they generate any test code automatically? What are the major parts of these "45678.3 KSLOC" of test code?
I would like to do some performance testing of a Rails app.
I want to test the app with real world data, which is 100 MB in size.
The problem is, Rails' test environment always rebuilds the database from fixtures, which always overwrites the real world data.
So how should I do the performance test?
In testing singleton classes we need the single instance to "go away" after each test. Is there a way to configure nunit to recreate the test app domain after each test, or at least after each fixture?
I am working on a Netbeans Platform RCP application.
I use jmock in my unit tests and I have created a Library Wrapper Module to import the necessary libraries.
The Module has an section named 'Libraries' and another section named 'Unit Test Libraries'.
I hoped that I could add the JMock Library Wrapper to the 'Unit Test Libraries', however when I run the unit tests I get the error 'package org.jmock does not exist'.
If I import the JMock Library Wrapper in to the main 'Libraries' element then it works, but this feels wrong.
Maven allows me to specify unit-test only dependencies, and I assumed that NetBeans Platform did the same. Should this be possible? Am I doing something wrong? Should I resign myself to a run-time dependency on the unit-test libraries (ugh).
Hello,
I recently created a big portal site. It's time for putting it to test.
How do you guys test a site rigorously?
What are the ways and tools for that?
Can we sort of mimic hundreds of virtual users visiting the site to see its load handling?
The test should be for both security and speed
Thanks in advance.
In a Rails application I have a Test::Unit functional test that's failing, but the output on the console isn't telling me much.
How can I view the request, the response, the flash, the session, the variables set, and so on?
Is there something like...
rake test specific_test_file --verbose
Im toying around with the idea to use python as an embedded scripting language for a project im working on and have got most things working. However i cant seem to be able to convert a python extended object back into a native c++ pointer.
So this is my class:
class CGEGameModeBase
{
public:
virtual void FunctionCall()=0;
virtual const char* StringReturn()=0;
};
class CGEPYGameMode : public CGEGameModeBase, public boost::python::wrapper<CGEPYGameMode>
{
public:
virtual void FunctionCall()
{
if (override f = this->get_override("FunctionCall"))
f();
}
virtual const char* StringReturn()
{
if (override f = this->get_override("StringReturn"))
return f();
return "FAILED TO CALL";
}
};
Boost wrapping:
BOOST_PYTHON_MODULE(GEGameMode)
{
class_<CGEGameModeBase, boost::noncopyable>("CGEGameModeBase", no_init);
class_<CGEPYGameMode, bases<CGEGameModeBase> >("CGEPYGameMode", no_init)
.def("FunctionCall", &CGEPYGameMode::FunctionCall)
.def("StringReturn", &CGEPYGameMode::StringReturn);
}
and the python code:
import GEGameMode
def Ident():
return "Alpha"
def NewGamePlay():
return "NewAlpha"
def NewAlpha():
import GEGameMode
import GEUtil
class Alpha(GEGameMode.CGEPYGameMode):
def __init__(self):
print "Made new Alpha!"
def FunctionCall(self):
GEUtil.Msg("This is function test Alpha!")
def StringReturn(self):
return "This is return test Alpha!"
return Alpha()
Now i can call the first to functions fine by doing this:
const char* ident = extract< const char* >( GetLocalDict()["Ident"]() );
const char* newgameplay = extract< const char* >( GetLocalDict()["NewGamePlay"]() );
printf("Loading Script: %s\n", ident);
CGEPYGameMode* m_pGameMode = extract< CGEPYGameMode* >( GetLocalDict()[newgameplay]() );
However when i try and convert the Alpha class back to its base class (last line above) i get an boost error:
TypeError: No registered converter was able to extract a C++ pointer to type class CGEPYGameMode from this Python object of type Alpha
I have done alot of searching on the net but cant work out how to convert the Alpha object into its base class pointer. I could leave it as an object but rather have it as a pointer so some non python aware code can use it. Any ideas?
I have the following directory layout:
runner.py
lib/
tests/
testsuite1/
testsuite1.py
testsuite2/
testsuite2.py
testsuite3/
testsuite3.py
testsuite4/
testsuite4.py
The format of testsuite*.py modules is as follows:
import pytest
class testsomething:
def setup_class(self):
''' do some setup '''
# Do some setup stuff here
def teardown_class(self):
'''' do some teardown'''
# Do some teardown stuff here
def test1(self):
# Do some test1 related stuff
def test2(self):
# Do some test2 related stuff
....
....
....
def test40(self):
# Do some test40 related stuff
if __name__=='__main()__'
pytest.main(args=[os.path.abspath(__file__)])
The problem I have is that I would like to execute the 'testsuites' in parallel i.e. I want testsuite1, testsuite2, testsuite3 and testsuite4 to start execution in parallel but individual tests within the testsuites need to be executed serially.
When I use the 'xdist' plugin from py.test and kick off the tests using 'py.test -n 4', py.test is gathering all the tests and randomly load balancing the tests among 4 workers. This leads to the 'setup_class' method to be executed every time of each test within a 'testsuitex.py' module (which defeats my purpose. I want setup_class to be executed only once per class and tests executed serially there after).
Essentially what I want the execution to look like is:
worker1: executes all tests in testsuite1.py serially
worker2: executes all tests in testsuite2.py serially
worker3: executes all tests in testsuite3.py serially
worker4: executes all tests in testsuite4.py serially
while worker1, worker2, worker3 and worker4 are all executed in parallel.
Is there a way to achieve this in 'pytest-xidst' framework?
The only option that I can think of is to kick off different processes to execute each test suite individually within runner.py:
def test_execute_func(testsuite_path):
subprocess.process('py.test %s' % testsuite_path)
if __name__=='__main__':
#Gather all the testsuite names
for each testsuite:
multiprocessing.Process(test_execute_func,(testsuite_path,))
i created in app purchases in my application.But still my test account doesn’t work fine. When i test my application using test account the sandbox environment asks me to buy the product and after buying it asks me to buy the product again straightaway. Is it some problem while using test accounts or is there a problem in my coding?? this is my first application and figuring out in app purchases for your application can be really hard at times. i have 4 products and this happens only with 1 or 2 products and rest work fine. So i am sure the in app purchases is fine but cant figure out what could be wrong??
I am trying to unit test a simple factory - but it keeps telling me that I am trying to use a method like a type?
My unit test
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Home;
namespace HomeTest
{
[TestClass]
public class TestFactory
{
[TestMethod]
public void DoTestFactory()
{
InventoryType.InventorySelect select = new InventoryType.InventorySelect();
select.inventoryTypes.Add("cds");
Home.Services.Factory.CreateInventory get = new Home.Services.Factory.CreateInventory();
get.InventoryImpl();
if (select.Validate() == true)
Console.WriteLine("Test Passed");
else
if (select.Validate() == false)
Console.WriteLine("Test Returned False");
else
Console.WriteLine("Test Failed To Run");
Console.ReadLine();
}
}
}
My facotry
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Home.Services
{
public class Factory
{
public InventorySvc CreateInventory()
{
return new InventoryImpl();
}
}
}
Hi, I have classes which prviously had massive methods so i subdivided the work of this method into 'helper' methods. These helper methods are declared private to enforce encapsulation - however I want to unit test the big public methods, is it good to unit test the helper methods too as if one of them fail the public method that calls it will also fail - but this way we can identify why it failed. Also in order to test these using a mock object I would need to change their visibility from private to protected, is this desirable?
I write my handler for server errors and define it at root urls.py:
handler500 = 'myhandler'
And I want to write unittest for testing how it works. For testing I write view with error and define it in test URLs configuration, when I make request to this view in browser I see my handler and receive status code 500, but when I launch test that make request to this view I see stack trace and my test failed. Have you some ideas for testing handler500 by unittests?
A group of us (.NET developers) are talking unit testing. Not any one framework (we've hit on MSpec, NUint, MSTest, RhinoMocks, TypeMock, etc) -- we're just talking generally.
We see lots of syntax that forces a distinct unit test per scenario, but we don't see an avenue to re-using one unit test with various inputs or scenarios. Also, we don't see an avenue to multiple asserts in a given test without an early assert's failure threatening the testing of later asserts (in the same test).
Is there anything like that happening in .NET unit testing (state- or behavior-based) today?