w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why we are not writing test case which will produce unpredictable values?
I don't agree that such test cases are not being written. In general there may be value in just proving that a test scenario runs end-to-end without raising exceptions. More specifically we may need to write the test checks with some degree of "fuzziness". Simple example: A function returns a record containing a new record identifier, we don't care that it's any particular id, just that it conforms to some pattern and we check it with a regexp. Further example: many test harnesses grab data from one interaction and using it to check later interactions. Very common in UI testing.

Categories : Unit Testing

Obsolete test case (or test case of removed feature)
I suppose you are using a versioning system like git or svn. So if you have pushed your tests on the server, you can easily remove the obsolete tests now and if you need them in the future, you can get those tests back thanks to your versionning system. It permits to have a clean repository and a clean structure on your computer without losing some obsoletes code.

Categories : Misc

Clone TestStep from a Test Case to another Test Case using groovy
You can run TestCase2 from TestCase1 using test step "Run TestCase". Create properties that you need directly in TestCase2 so you can set them by "Property transfer" test step in TestCase1. More information about run test case here and about property transfer here. Another way is to set properties and run TestCase programmatically. Something like this: // get properties from testCase, testSuite or project if you need def testCaseProperty = testRunner.testCase.getPropertyValue( "MyProp" ) def testSuiteProperty = testRunner.testCase.testSuite.getPropertyValue( "MyProp" ) def projectProperty = testRunner.testCase.testSuite.project.getPropertyValue( "MyProp" ) def globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "MyProp" ) //get test case from other project or f

Categories : Groovy

Can protractor test a login that is not angular based
After placing the issue on github I received the answer I was looking for. This can be found HERE! Protractor requires that Angular be present on the page and the way around this is to use the driver directly. Following the link above should stear anyone stuck on the same issue in the right direction. Kudos to JulieMR and the others who helped out with this issue.

Categories : C#

Jenkins email configuration - Test email configuration succeeds but email is not recieved by user
In order to get this to work, a valid email must be entered into the "System Admin e-mail address" field. That field is on the same page but is located in another section higher up. Without doing so, I too received a message that the email was successfully sent but I never received it. Once I set it, the test emails started to be received properly.

Categories : Jenkins

Why nodejs test case with nodeunit keep loading in webstorm after successfully passed the test cases?
Are you calling done() at the end? For example exports.globalSetterTest = function(test){ var app = require('../helpers/globalsetter'); app.setData("abc"); var res = app.getData(); test.equal(res, "abc", "msg"); test.done(); }; I have the same setup as you and here are some sample tests I wrote. https://github.com/captainchung/webstormNodeUnitTests/blob/master/test/spec.js

Categories : Node Js

SoapUI: set a MockService Test Property in the middle of a Test Case
You can set a property in the mockservice context like that: testRunner.testCase.testSuite.project.mockServices["yourMockService"].getMockRunner().getMockContext().setProperty("yourProperty","yourPropertyValue")

Categories : Groovy

Add unit test case to test external webservice (.asmx) .NET
As far as I can see, there 2 different functionalists: WSDL provider - i.e. class which gets a valid wsdl from somewhere WSDL parser - the class which parses the wsdl and extracts the data Here is a pseudo-code implementation of these to make them easy to mock and unit test. public interface IWSDLProvider { string GetWsdlFromService(string url); } public class MyWsdlProvider : IWSDLProvider { private readonly IWebWrapper _webCLient; public MyWsdlProvider(IwebWrapper webClient) { _webClient = webCLient; } public string GetWsdlFromService(string url) { //do here whatever is needed with the webClient to get the wsdl } } public interface IWSDLParser { MyServiceData GetServiceDataFromUrl(string url); } public class MyWsdlParser : IWSDLParser {

Categories : C#

View Test Case summary in Microsoft Test Manager
You can not see the summary of the Test Case when you run it manually. But there are another possibilities to display preconditions for the tester: Using multi-line step(s) Store the preconditions in the "Action" part of a Test Case step and use this step as the first step in the test case. You can insert a line break using Alt+Enter Using Test Step attachment Store the preconditions in a document (called "Preconditions" so the testers know what it is) Attach this document to the first step so the tester can open it when running the test.

Categories : Visual Studio 2012

How to test JUnit test case for primefaces UploadedFile component
Did you try.. // Creating a Mock for UploadedFile UploadedFile mockFileUploadedFile = EasyMock.createMock(UploadedFile.class); // Injecting the Mock to FileUploadEvent FileUploadEvent fileUploadEvent = new instance... fileUploadEvent.setFileUploadedFile(mockFileUploadedFile)

Categories : Java

running a test suite and test case using groovy?
You haven't wrote the code which runs test case execution. Try to use this script: //get test case from other project or from the same one project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName(project_name) testSuite = project.getTestSuiteByName(suite_name); testCase = testSuite.getTestCaseByName(testcase_name); //set properties if you need testRunner.testCase.setPropertyValue(property_name, property_value); testRunner.testCase.setPropertyValue(another_property_name, another_property_value); // run test case runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false); Also there is a method to call soap ui tests using crontab. Running functional tests from the command-line is straightforward using the included in soa

Categories : Groovy

How to get current Test Case ID in the mtm for data driven test
You can't. All attributes need constant values and you cannot pass something that its value will not be known at compile time. So, you have to pre-define the value of the test case id when you code your test.

Categories : C#

Getting email body without fetching attachments using ruby mail gem
You have to parse and understand the actual structure of the returned BODYSTRUCTURE response, see RFC 3501, p. 56. Also remember to apply the relevant Content-Transfer-Encoding (like base64 or quoted-printable) and employ proper charset conversion (the charset parameter of the Content-Type header of each body part). All of that information is included in the BODYSTRUCTURE response; consult your library's documentation to see how to get access to that.

Categories : Ruby

How to test email in functional test (Symfony2)
The exception is being thrown because getProfile() returns false if the profiler is not enabled. see here. public function getProfile() { if (!$this->kernel->getContainer()->has('profiler')) { return false; } return $this->kernel->getContainer()->get('profiler')->loadProfileFromResponse($this->response); } Furthermore enableProfiler()only enables the profiler if it is registered with the service-container aka enabled. see here. public function enableProfiler() { if ($this->kernel->getContainer()->has('profiler')) { $this->profiler = true; } } Now you have to make sure the profiler is enabled in the test environment. ( should normally be the default setting ) config_test.yml framework: profiler: enab

Categories : Symfony2

Email: legitimate duplicate email header keys with mutually exclusive values
Ya there are other headers that can appear more than once and is clearly explained here in RFC 5322 Headers that can appear more then once comments keywords optional-field trace resent-date resent-from resent-sender resent-to resent-cc resent-bcc resent-msg-id Check the link above for more clarity.

Categories : Email

Fetching values from url and displaying them
Use either <?php echo htmlspecialchars($_GET["validationCode"]); ?> or <?= htmlspecialchars($_GET["validationCode"]) ?> And don't use <? echo htmlspecialchars($_GET["validationCode"]); ?> Also, you use vCode in the query string, so make sure you're using the same names to get it.

Categories : Jquery

Fetching the values from db before searching
When your page loads the keyword in the following line in your controller is going blank and its searching all the records as your query might be like %%. $keyword = $this->input->post('keyword'); First check if $keyword is not blank. If its not blank then search the data.

Categories : PHP

Cannot test payment via personal test paypal account created with paypal sandbox (also email appears not to be recognised at paypal.com public site)
Found the solution :) Happy to be answering my own question: the working solution is to use www.sandbox.paypal.com in the form action when testing, instead of www.paypal.com As per page 27 of: https://cms.paypal.com/cms_content/GB/en_GB/files/developer/PP_Sandbox_UserGuide.pdf It says: IMPORTANT: To execute test transactions on Sandbox you need to complete a purchase as a test buyer with your buyer test account. Typically, you go through your website purchase flow as a buyer. You must ensure that you execute your test on www.sandbox.paypal.com instead of www.paypal.com So, for example, the snippets of code for your paypal button would look something like: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> but still use just paypal.com f

Categories : Testing

fetching option values from mysql
You should use like below: [returns array] function catOption() { $query = mysql_query("SELECT * FROM mainCats ORDER BY id ") or die(mysql_error()); $arrCat = array(); while ($row = mysql_fetch_array($query)) { $arrCat[] = '<option value="'. $row['mainCatID'].'">'. $row['name'].'</option>'; } return $arrCat; } Or this one [returns string] function catOption() { $query = mysql_query("SELECT * FROM mainCats ORDER BY id ") or die(mysql_error()); $arrCat = ""; while ($row = mysql_fetch_array($query)) { $arrCat .= '<option value="'. $row['mainCatID'].'">'. $row['name'].'</option>'; } return $arrCat; }

Categories : PHP

SQL - CURSOR not fetching values properly
The problem is that you are using DECIMAL without telling it the precision and scale. How many decimals do you want?. You should always explicitly use the precision and scale. Try something like this: DECLARE @id INT DECLARE @val DECIMAL(16,4) DECLARE @percent DECIMAL(16,4)

Categories : SQL

Fetching data with different static values
This is very brittle code because you have external dependencies on Core within your Car class. If you want all your classes to have IdLang automatically then you should use inheritance to achieve it. Otherwise you could use Dependency Injection and just pass Core as a parameter through the Car constructor. Personally, I see no use in having the Core class at all. You can drop those two Properties IdLang and Company into Car and initialize them through the constructor.

Categories : C#

How can I pass a list of values as a parameter to a Visual Studio web performance test or load test plugin?
Sadly, plugin property values are indeed limited to bool, string and numeric types. This restriction is hard-coded within the Microsoft.VisualStudio.QualityTools.WebTestFramework assembly. There is no way to support other types (well, with one exception) or get any enhanced editor features such as in your Test Mix collection example. If you want a property to accept a list of strings, for example, the only option is to have a property of type string, and parse the string into a list by splitting on a delimiter. Disappointing, but true.

Categories : C#

Send email with fresh .apk to specified users in case of git push
That's the use of a git hook. Starting from git 1.8.2 there's a git pre-push hook you can use to execute some command just before doing the push. You can read how git hooks work here: git hooks Here's an example of script for a pre-push hook example of git pre-push hook

Categories : Android

GWT unit test case
If getModuleName returns null then your test runs just like any other JUnit test, i.e. not in a GWT context. Make getModuleName return the name of your module (the one you pass to the GWT Compiler, or the one you'll <inherit> in another GWT module) to switch to running as GWT.

Categories : Gwt

Test for Upper Case - T-Sql
Using collations eg: if ('a'='A' Collate Latin1_General_CI_AI) print'same 1' else print 'different 1' if ('a'='A' Collate Latin1_General_CS_AI) print'same 2' else print 'different 2' The CS in the collation name indicates Case Sensitive (and CI, Case Insensitive). The AI/AS relates to accent sensitivity. or in your example SUBSTRING(author,1,1) <> LOWER(SUBSTRING(author,1,1)) COLLATE Latin1_General_CS_AI

Categories : SQL

How to specify a test case that does not have an input
The FacesContext is a global variable. I.e. you could inject a mock into it. I assume using Mockito: @Test public testLogout() { //setup FacesContext context = Mockito.mock(FacesContext.class); ExternalContext externalContext = Mockito.mock(ExternalContext.class); FacesContext.setCurrentInstance(context); when(context.getExternalContext()).thenReturn(externalContext); //act bean.logout(); //verify verify(externalContext).invalidateSession(); } This is not the best approach, but because of bad designed JSF, you should use the global variables and implicit dependencies. The proper solution would include IoC container and dependency injection.

Categories : Java

Model test case
If I've understand you correctly, you should change your code to test "relationship test" do comm = Comm.find(6) assert_equal(comm == comm.commvib.comm, true) end I assume that Comm model has has_one :commvib association.

Categories : Ruby On Rails

How to i automate a test that targets values that change from one test to another?
Whatever the test you do, you should be very confident with the expected initial situation of your system under test when the test starts. In your case, if your test needs a specific item to be available, then this should be part of your "test setup" section. Let's say you have 100 tests that needs an item to be available. I can see 2 different strategies to solve your issue: At the beginning of your test suite, deploy a custom brand new web site with your 100 products available. Your tests will update/destroy those data but you don't case because next time you run the test, you will deploy a brand new set of items. At the end of each test case, you do a custom-action that will clean your system by adding the item back in the shop.

Categories : Testing

Fetching values from app.config on plugin click in VS 2012 C#
I don't know of any built-in API that allows you to access config files at design time in Visual Studio in order to use them in T4 templates. You will have to open and read the .config file yourself: Get a reference to your project via the Visual Studio Automation Interface (EnvDTE) Find the Project Item that is the desired .config file Parse the .config file with the Xml Api of your choice You can also skip steps 1+2 and parse the .config file from its path, but that won't be very reusable. If you don't want to deep-dive into that Automation model and stuff, have a look at tangible's free T4 editor. It comes with a T4 Template gallery. There is a T4 file ready to be included in yours that provides you with the appSettings and connectionStrings from any .config file in your solution.

Categories : C#

Fetching last good values based on the condition with SQL query?
If the different columns have different criteria for "good value", I would just have a query for each column in turn, and UNION them together e.g. SELECT TOP 1 'A' AS ColumnName, Timestamp AS [Time] FROM <table> WHERE A IS NOT NULL AND ISNUMERIC(A) = 1 AND A >= 0 ORDER BY Timestamp DESC UNION SELECT TOP 1 'B', Timestamp FROM <table> WHERE B IS NOT NULL AND ISNUMERIC(B) = 1 AND B BETWEEN 0 AND 360 ORDER BY Timestamp DESC UNION ... Update: From the comments below, I think I understand what is going on here. It sounds like each column has some conditions to check, and then also should be excluded if the final date satisfies the condition. I suggest an outer query around the UNION of column queries to remove the cases where the last value satisfies. Update 2 SELECT * FROM

Categories : SQL

How To Write Mockito test case
1.Define this client mockito in an xml, let's call it client-mock.xml <bean id="client" class="org.mockito.Mockito" factory-method="mock"> <constructor-arg value="your org.Client" /> //interface name </bean> You might have to add cglib to your classpath if Client is not an interface. 2.Seperate your client "real" from your-servlet-context.xml, so it would not be loaded in tests. import static org.mockito.Mockito.*; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:your-servlet-context.xml", "classpath:client-mock.xml" }) @WebAppConfiguration public class YourTests { @Autowired private Client client; @Test public void testGeUserByName() throws Exception { String firstName = "Wills"; String

Categories : Spring

How to set env variable from within junit test case?
If I read the documentation correctly, the configuration to use is: <environmentVariables> <SENDGRID_USERNAME>username</SENDGRID_USERNAME> <SENDGRID_PASSWORD>password</SENDGRID_PASSWORD> </environmentVariables> Could this be the issue? Source: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#environmentVariables

Categories : Maven

Robotium test case not Running at all
Can you be more specific on the errors that you are encounter? maybe put some examples? Your main activity of the application under test it is named MainActivity? Maybe you should change the constructor from public SampleQA(Class<MainActivity> activityClass) { super(activityClass); // TODO Auto-generated constructor stub } to public SampleQA() { super(MainActivity.class); }

Categories : Misc

What is an error-guessing test case?
Error guessing is documented here: http://en.wikipedia.org/wiki/Error_guessing It's a name for something that's very common -- guessing where errors might occur based on your previous experience. For example you have a routine that calculates whether a value inputted by a user from a terminal is a prime number: You'd test the cases where errors tend to occur: Empty input Values that are not integers (floating point, letters, etc) Values that are boundary cases 2, 3, 4 etc. I would assume that every tester/QA person would be asked questions like this during an interview. It gives you a chance to talk about what procedures you've used in the past during testing. I think the method goes like this: 1. Do formal testing 2. Use knowledge gained during formal testing about how the system

Categories : Testing

JUnit test case failure
If you read the Javadocs of JUnit Assert, assertEquals, you'll see that delta should indeed be positive: Asserts that two doubles or floats are equal to within a positive delta.

Categories : Java

Fetching values from the DropDownlist on PostBack inside Repeater Control in ASP.Net
Sounds like you are putting the !Page.IsPostBack around the wrong bit of code. You need to put this around your DataBind code. So; if (!Page.IsPostBack){ this.myRepeater.DataSource = [yourdatasource]; this.myRepeater.DataBind(); } This way your DropDownList controls are not rebound.

Categories : Asp Net

Making HTML page by fetching values from two Dictionaries in python
This should do the trick. html2 = ("""<tr border = 1px black> <th>%s</th> <td>%s</td> <td>%s</td>""" )% (key, value, ip_count_dict.get(key, 0))

Categories : Python

Approach towards writing test case with RSpec
Testing views is good because you know that your application is working full stack. Testing controllers is good because view testing is slow :) Writing tests helps you thinking about the problem first (writing the test) before writing the code that makes the test pass (that's writing the solution). So you realize you have been doing this wrong your whole life! The Big Picture of TDD is to give you confidence while writing code! You can refactor, move, edit and delete your code without fear.

Categories : Ruby On Rails

How to control test case run through an excel sheet?
I implemented similar design for selenium+testng suite. After reading the execution flags from excel, i create the testng.xml dynamically and run the same xml. TestNG provides features for xml to be created and executed dynamically. Not sure if you have anything similar in PyUnit. I hope this gives you some ideas.

Categories : Python

Test case execution order in pytest
In general you can configure the behavior of basically any part of pytest using its well-specified hooks. In your case, you want the "pytest_collection_modifyitems" hook, which lets you re-order collected tests in place. That said, it does seem like ordering your tests should be easier -- this is Python after all! So I wrote a plugin for ordering tests. Check out the docs or install it from pypi. Right now I recommend using @pytest.mark.first and @pytest.mark.second, or one of the @pytest.mark.order# markers, but I have some ideas about more useful APIs. Suggestions welcome :)

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.