testing

Promise is not being handled

佐手、 提交于 2019-12-25 02:58:14
问题 I am writing a unit test for my Angular application using Jasmine with a mock service. However, the promise I am trying to run is not working. Here's the service: CreateItemController = $controller('CreateItemController', { ItemService: { createItem: function(data) { console.log('Service running'); var defer = $q.defer(); defer.resolve('1'); return defer.promise; } The test: it('should create an item', function() { var created = false; $scope.createItem().then(function(response) { // This is

How can I test if this object returns the correct String?

馋奶兔 提交于 2019-12-25 02:53:06
问题 I have a Thing class that holds various Strings and a Collection of Stuff. I have to test whether the Message class can correctly return item as "found" in a MessageTest class. What is the most elegant/efficient way of testing this? What kind of fake object should I create, and how do I test with/against it? public class Thing { public String a; public String b; public String c; public String d; public String e; public Collection<Stuff> collection; } public class Message { private String item

How can I test if this object returns the correct String?

送分小仙女□ 提交于 2019-12-25 02:53:02
问题 I have a Thing class that holds various Strings and a Collection of Stuff. I have to test whether the Message class can correctly return item as "found" in a MessageTest class. What is the most elegant/efficient way of testing this? What kind of fake object should I create, and how do I test with/against it? public class Thing { public String a; public String b; public String c; public String d; public String e; public Collection<Stuff> collection; } public class Message { private String item

casperjs check that title exists and has any value so test not empty

穿精又带淫゛_ 提交于 2019-12-25 02:38:51
问题 This seems like an easy question but I am new to casperjs. I want to check that title exists and that it has a value e.g. not ="". Also same for meta tags that they exist and also have been populated with something. I don't want a specific value just test they exist and not empty e.g. not ="". I thought this would be simple in casperjs 1.1 test suite Site: <head> <title>UnoSpark</title> <link rel="stylesheet" href="stylesheets/foundation.css"> <meta name="description" content="Free Dating

Unable to locate using find element by link

南笙酒味 提交于 2019-12-25 02:22:55
问题 Newbie in testing. I generated a test case using Selenium, and then exported it as a Python script. Now, when I try to run that in terminal, I get following error: raise exception_class(message, screen, stacktrace) NoSuchElementException: Message: u'Unable to locate element: {"method":"link text","selector":"delete"}' I am using the command generated by Selenium i.e driver.find_element_by_link_text("delete").click() The reason for the error I believe is that the link "delete" in my web page

When running Stylecop in Sonar, how do I make it analyze projects identified as test projects?

可紊 提交于 2019-12-25 02:09:47
问题 Ok, so let's assume that I want to live according to the rule, treat your test code as carefully as your production code. How do I make Sonar and Stylecop analyze my test projects? I've basically written this in my sonar-project.properties file: #Core C# Settings sonar.dotnet.visualstudio.solution.file=SomeSolution.sln sonar.dotnet.excludeGeneratedCode=true sonar.dotnet.version=4.0 sonar.donet.visualstudio.testProjectPattern=*.Tests #StyleCop sonar.stylecop.mode= Reading the sonar build log I

Eclipse - Invalid classpath container: 'TestNG' in project and JUnit failed

馋奶兔 提交于 2019-12-25 01:44:58
问题 I'm using Eclipse 4.9, I tried to update new TestNG upgrade(7) It failed so I rollback to previous version and now I have an issue 'Invalid classpath container: 'TestNG' in project I can't fix it by clean project (maven can't be execute due to NullpointerException below errors) Reinstall TestNG Remove and add TestNG library I didn't find relevant answers for this issue Error log: java.lang.NullPointerException at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath

Integration Testing automation - checking DB values

孤者浪人 提交于 2019-12-25 01:38:36
问题 I'm dealing now with a problem during creating automation of integration test. I would like to: input data via selenium RC check if values are correct in DB after import. I've got problem with logic of those tests. Now I do it as it follows: in one test I generate random data (first name, last name, etc of the person). Then, by simple select from DB I obtain unique person_id key (I assumed that if first and last name are both 8 characters long, random generated strings I can treat them as

How to display a directory full of junit test result files

若如初见. 提交于 2019-12-25 01:17:43
问题 As part of testing in the cloud, I plan to copy my test results (I happen to be using gradle) as xml out of a short lived container to an s3 bucket. I am wondering what is the best approach for making use of the bucket full of test results and if anyone has ideas for how to get the most of these results with the least custom code, etc. In the past I have handled this with XSLT to make the XML into HTML but that approach feels like more work than I'd like to have to do. Has anyone solved this

Moq newbie test setup

限于喜欢 提交于 2019-12-25 01:09:57
问题 I'm coming up to speed with the Moq framework and I have a button on a form that launches another form. The client wants the form to launch whether the Click or DoubleClick event is fired off. My understanding of the Moq framework is that it is useful when you want to simulate certain types of actions: (For brevity, I'm only listing a few types of actions) Connect to a database Write to a file Determine network connectivity But I'm not 100% certain on how Moq can interact with Windows