w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Running pytest test cases from within the test script
Following comment of @Conrad.Dean. Seems putting tests into some pytest.py is a kind of useful convention. Below an example illustrating the role of if __name__ == '__main__': def myadd(first, second): return first + second def test_add(): assert myadd(1, 2) == 3 if __name__ == '__main__': print("Running test_add") test_add()

Categories : Python

Robotium: How to continue running test cases without restarting the app after each test?
If the functionalities between your test cases are dependent on each other, then instead of writing them in separate testcases, write different functions related to different functionality and call then in same testcase according to their order of execution. Because, after completion of each testcase, robotium will definitely close the activity and start a new activity for the other testcase.

Categories : Android

casperjs test script not exporting XML file properly
Just struggled with this for a while. The key, for me at least, was to remove the var casper = require('casper').create(...) altogether. Apparently, it's not required when running tests with "casperjs test myfile.js".

Categories : Xml

Running test cases from web interface
Not really sure what you are trying to do but what seems to be happening is the process that drives the tests is not started in interactive mode so it can not interact with the UI. In the error message they probably assume you are using a standard setup, maybe starting a test run from Microsoft Test Manager or after a build by a build agent, the test agent or build agent that starts the test run must be in interactive mode so that they can interact with the desktop, for example imitate mouse clicks.

Categories : C#

Running SoapUI test cases using testRunner
If you want to use soap ui in external code, try to directly create new test runner with specific project file: SoapUITestCaseRunner runner = new SoapUITestCaseRunner(); runner.setProjectFile( "src/dist/sample-soapui-project.xml" ); runner.run(); Or if you want to define test execution more precisely, you can use something like this: WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" ); TestSuite testSuite = project.getTestSuiteByName( "Test Suite" ); TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" ); // create empty properties and run synchronously TestRunner runner = testCase.run( new PropertiesMap(), false ); PS: don't forget to import soap ui classes, that you use in your code and put them to classpath. PPS: If you need just run

Categories : Groovy

Running multiple test cases in jbehave
You can write multiple stories by this: @Override protected List<String> storyPaths() { return new StoryFinder() .findPaths(codeLocationFromClass(embeddableClass).getFile(), asList("**/*.story"), null); } You also can specify which stories to run. For example this will run all purchasing stories: ...asList("**/purchasing-*.story"), null) Source: http://jbehave.org/reference/stable/developing-stories.html#configuring

Categories : Misc

JPA - Weaving not enabled while running test cases
You need to specify that static weaving is used in your persistence.xml properties. See http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving "Step 2: Configure persitence.xml" for details

Categories : Java

Skip a scenario when running my test cases through junit
I fixed the issue by modifying my junit class like, public class Myclass extends JUnitStories { public Myclass(){ configuredEmbedder().useMetaFilters(Arrays.asList("-skip")); } @Override public Configuration configuration(){ return new MostUsefulConfiguration()... } }

Categories : Java

Running two node servers from a single shell command using a shell script
Your command does not work because you are trying to have two processes running in the same shell. Instead, you should 'spawn' the node processes into different processes. Try this command: node project/rest.js & node static-server.js &

Categories : Node Js

Running a login shell using sudo inside a shell script on Mac OSX
Your shell is interpreting the $HOME variable in the heredoc, before the input reaches the su shell. You need to escape the $: bash-3.2$ sudo su -l root <<EOF > echo $HOME > echo $HOME > EOF /Users/kevin /var/root The real question is why does it work on your Linux box.

Categories : Osx

Schema Change Script : Validation and test cases
I use dbunit for testing database scripts. It's a very fine tool, but perhaps overly java centric. You can google for similar tools in other languages. Personally I use liquibase to manage all changes to my database schemas. It reduces much of the complexity of database migrations by putting the database in a known state. I don't have to test for conditions where a column may or may not exist, because, the entire schema is effectively under revision control. Database refactoring actions which are destructive to data, are always tricky to test. The real advantage of using a tool like liquibase is that it becomes trivial to setup production-like test systems.

Categories : SQL

Running a script from within a shell
the sage shell is a process running in the foreground and due to the sequential nature of your script, the sage shell has to finish running before the next line of the script is executed. It is after the sage shell exits that the easy_install line is run. The script is performing as written.

Categories : Python

Windows Shell Script Issue - Response always invalid
You have faulty logic in :ValidateResponse. I only answered the question you asked. This will allow you to move on to the next problem. Keep at it! REM Ensure that a valid square was specified (A1-A3, B1-B3 & C1 - C3) IF /I %response%==A1 GOTO :ContinueValidating IF /I %response%==A2 GOTO :ContinueValidating IF /I %response%==A3 GOTO :ContinueValidating IF /I %response%==B1 GOTO :ContinueValidating IF /I %response%==B2 GOTO :ContinueValidating IF /I %response%==B3 GOTO :ContinueValidating IF /I %response%==C1 GOTO :ContinueValidating IF /I %response%==C2 GOTO :ContinueValidating IF /I %response%==C3 GOTO :ContinueValidating SET ValidMove=False GOTO :EOF :ContinueValidating Then you also need to change all of the lines below that like the one below to change " " to "" because the

Categories : Windows

Java not running shell script
Verify two things: If you have modified the perl script, make sure it has #!/bin/perl in the first line, same for your shell script, it must have #!/bin/sh or #!/bin/bash if you are specificaly using bash. Your moved files must have executable permissions, change them with something like .chmod 755 myFile.

Categories : Java

Running Scrapy from a Shell Script
Perhaps you actually need to run the script in ~/.virtualenvs/email-scraper/. Do cd ~/.virtualenvs/email-scraper/ before running it. When you're there run sh sitecode/runspiders.sh Or sudo sh sitecode/runspiders.sh #!/bin/bash cd /home/pi source ./bashrc ## source /usr/local/bin/virtualenvwrapper.sh ## You didn't run this. workon email-scraper cdvirtualenv cd ./sitecode/jobscraper scrapy crawl site1 Run as bash script.sh, not sudo sh script.sh.

Categories : Bash

Embedded Perl in Shell Script - Returning value to Parent
#!/bin/sh cnt=1 echo "In Bash (cnt: $cnt)" perl - $cnt <<'EOF' #!/usr/bin/perl -w my $cnt=shift; while ($cnt<100) { $cnt++; } print "In Perl (cnt: $cnt) "; exit $cnt; EOF cnt=$?; echo "In Bash (cnt: $cnt)"

Categories : Perl

Can you run two test cases simultaneously in a Test Suite in Microsoft Test Manager 2010?
Yes, you can with modified TestSettings file. http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx

Categories : Testing

Condor job - running shell script as executable
The cause, in our case, was the shell script using DOS line endings instead of Unix ones. The Linux kernel will happily try to feed the script not to /bin/sh (as you intend) but to /bin/sh . (Do you see that trailing carriage return character? Neither do I, but the Linux kernel does.) That file doesn't exist, so then, as a last resort, it will try to execute the script as a binary executable, which fails with the given error.

Categories : Linux

Running certain operation after every 2 hours in shell script
Sleep doesn't create much (almost no) CPU time so you don't have to worry about it the whole time it runs. Also, bash just waits for it (sleep) so bash doesn't really use much CPU power. To run sleep for 2 hours use the 2h argument. With busybox it's buxybox sleep 2h. If we are going to place it inside a loop we could do it this way: while busybox sleep 2h; do ... do some tasks or run checks done Or while ... do some tasks or run checks busybox sleep 2h do continue done That would prevent another task from executing if sleep is suddenly interrupted like when shutting down or when keyboard interrupt signal is sent. You might consider checking this post I made before as well: http://www.linuxquestions.org/questions/programming-9/optimizing-bash-process-4175431381/#pos

Categories : Android

Difference between different ways of running shell script
sh test.sh Tells the command to use sh to execute test.sh. ./test.sh Tells the command to execute the script. The interpreter needs to be defined in the first line with something like #!/bin/sh or #!/bin/bash. Note (thanks keltar) that in this case the file test.sh needs to have execution rights for the user performing this command. Otherwise it will not be executed. In both cases, all variables used will expire after the script is executed. . ./test.sh Sources the code. That is, it executes it and whatever executed, variables defined, etc, will persist in the session. For further information, you can check What is the difference between executing a bash script and sourcing a bash script? very good answer: The differences are: When you execute the script you are openi

Categories : Linux

Running shell script as root using apache/php
You look for tool called sudo: https://en.wikipedia.org/wiki/Sudo But most likely instead of going for sudo you should rethink your app architecture as once your httpd is compromised, attacker can easily get root rights.

Categories : PHP

running a command in shell script in parallel without using background
Jobs don't "just stop" because they're backgrounded, but you have to wait for them to finish to avoid exiting the script before they're done. Documentation

Categories : Shell

directory is not creating while running bash shell script in php
Check with which user's permissions it's run. You could echo the output of "whoami" (bash) command to know with wich user is used to run the script. If it's executed, for example, with the "www-data" user (ubuntu's [and maybe others] default httpd user), then it may not have the rights to create a directory in your user's home folder.

Categories : PHP

How to get output like SQLPLUS while Running SQL Query in shell script
Your variable contains the newlines, but the way you're displaying it removes them. Replace the echo statement with: echo "$RETVAL" The shell won't mess with the newlines then. You should pretty much always quote variables that can contain any form of whitespace that needs to be preserved.

Categories : Linux

running a script using WScript.Shell on a network location
You trim leading an trailing spaces from your argument list and then concatenate the result to the script path. Unless your argument list is an empty string this will create a non-existing filename. Example: arglist = "/foo" WScript.Echo "\hostaidprogFiles.vbs" & Trim(arglist) produces the following output: \hostaidprogFiles.vbs/foo To make your code work you need to add a space between script path and arguments: ... filename = "\hostaidprogFiles.vbs" CreateObject("WScript.Shell").Run filename & " " & Trim(arglist), 0, True

Categories : Vbscript

How can a background bash script exit the running shell?
What seems like is happening is that after set -m is run in the script, the next command that is run is forced to be in the foreground process group, which takes the original shell out of the foreground process group. Once that process exits, the shell running the script is now in the foreground process group, but once that shell exits, the original shell doesn't put itself back into the foreground process group because it ran the script in the background. So you now have an interactive shell that is in a background process group. You can see some weird behavior here if you put a sleep at the end of your script so that it doesn't exit immediately. When you run the script in the background you get the terminal prompt back, but now your interactive shell isn't in the foreground process g

Categories : Bash

Trouble with running a shell script via a Cronjob on an EC2 Instance
You can't specify a username in a user's crontab, only in /etc/crontab. You can't specify a directory in any form of crontab. To change directory, use cd. The environment is not the same. If you e.g. set PATH in .bashrc, these will not be automatically included, so it's safest to use full paths. As root (assuming you want to run this as root and not ec2-user or something), run crontab -e and add 15 * * * * cd /home/ec2-user && /full/path/to/s3_upload.sh TestBucket Make sure you can copy-paste the command in a root terminal and get it working, and read root's mail afterwards to see the command's output with possible error messages. If it still doesn't work, make sure you have these errors available.

Categories : Linux

MySQL commands running in shell script possess an error
edit your users ~/.my.cnf file and add [mysql] user=root password=7layer Secure the file: chmod 600 ~/.my.cnf then you might need to restart mysqld (/etc/init.d/mysqld restart), but are able to use : mysql <<EOF use $db; mysqld_safe --skip-grant-tables ###your sql queries### exit; EOF without a password update: This is not bound to your single script, it's bound to the user. If that's critical, setup a new user for the script that may access mysql without entering a password from command line. update: As you can see in your question, Shutting down MySQL.. your MySQL server is not running. Take a look into the logs why it's aborting. One of these should contain more information: /var/log/mysql.err /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql.err

Categories : Mysql

Rails & Heroku: Running a script through rails runner using local files
To run a local script on Heroku: irbify.rb script.rb | heroku run rails console --app=my_app irbify.rb is a silly tiny script I wrote to convert a script to a single eval statement. Regarding passing data: you can serialize it in some form and put it inside script. Hope it helps someone. UPDATE: this does not work well anything beyond trivial datasets.

Categories : Ruby On Rails

How can i automate my test cases using test Microsoft Test Manager?
What you're looking for are called coded UI tests. You start by creating an action recording of your manual test and then creating a coded UI test from that action recording. Do a google search for "coded UI" and you'll find lots of information.

Categories : Misc

How can I test using rails params outside controller rails
You will have to use RSpec's anonymous controller feature. require 'spec_helper' require File.expand_path("../../../../lib/common/common_log", __FILE__) describe CommonLog, type: :controller do controller do include CommonLog def index render nothing: true end end it "log_error" do params = {param1: :value1} get :index, params #Do the specs you want here end end What you are doing here is creating an anonymous controller which includes the module you want to spec. Since this module is meant to be included inside a rails controller it gives you exactly what you need: a context of controller to spec your module with.

Categories : Ruby On Rails

need to unit test a controller's ActionMethod that is returning a RedirectResult along with an anchor tag
If i understand your question correctly, you want to test the url returned from returning RedirectResult. You can simply do something like this: var result = (RedirectResult)aec.Result; And then result.Url.AbsoluteURI contains the string value that you can parse

Categories : Asp Net Mvc

Running capybara in a controller to test a few things but can only run it once
I can't say I understand why you are trying to do this... However here are a couple of things to try. From: https://github.com/jnicklas/capybara Transactions and database setup Some Capybara drivers need to run against an actual HTTP server. Capybara takes care of this and starts one for you in the same process as your test, but on another thread. Selenium is one of those drivers, whereas RackTest is not. Given that, when using Selenium, Capybara needs to start an actual HTTP server, you should try an alternative driver like RackTest. Capybara may not understand you need the HTTP server shutdown. Also, from that same section: It is also possible to force your ORM to use the same transaction for all threads. This may have thread safety implications and could ca

Categories : Ruby On Rails

Spring MVC test framework returning inconsistent results for async controller tests
You need to call asyncStarted MvcResult mvcResult = this.mockMvc.perform(get(this.basePath) .accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()) .andReturn(); Though this still gave inconsistent results at times for me

Categories : Java

Running Eclipse WindowTester Pro test from ant script
It's hard to judge what's missing in your setup, but there is an example project for running WindowTester tests from an Ant script here: http://code.google.com/p/windowtester/downloads/detail?name=WindowTester_AntExample_v1.0.zip If the example works for you, it should be easy to compare it to your project and find out the difference.

Categories : Ant

Benefits of having CodedUI test, over Automated Test Cases (via Action Recording)
The tests executed by MTM have manual verification checks of what is displayed on the screen. There will be test steps with words such as "Expect to see ..." or "The value ... should be shown ...". To execute the test properly with MTM each of these verification steps should be performed. There is no way with MTM to automate these checks. Converting to a Coded UI test does not directly add the checks, but Coded UI allows automated checks to be added into the test. Having converted an MTM test to a Coded UI test, the cross-hairs tool of Coded UI (also called the assertion tool and similar terms) can be used to add assertions that values on the screen contain the expected values. An additional reason for converting is that the full programming facilities of C# or VB can be used to add extr

Categories : Testing

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

How to show the shell script's output on the views in ruby on rails
You can use Streaming controller class PostsController def index # your python script render stream: true end end application.html.erb <html> <head><title> <%= provide :title, "Main" %></title></head> <body><%= yield %></body> </html> posts/index.html.erb <%= content_for :title, " your python results" %>

Categories : Ruby On Rails

Error running rspec test in rails
If you're using RSpec the end of the file must be suffixed with _spec.rb Example: my_base_spec.rb To Run: bundle exec rspec spec/my_base_spec.rb or simply bundle exec rspec

Categories : Ruby On Rails

Why Google test executes automatically unselected test cases?
Found the answer here... But I am very very unhappy that, google test is running like this. • ./foo_test --gtest_filter=*Null*:*Constructor* Runs any test whose full name contains either "Null" or "Constructor". Google people should look into this problem. Because there may be a case that 4-5 test cases may of nearly same name then it will a big problem if at all you are going for a filter. Like. TestCase |_Test1 |_Test11 |_Test122 |_Test1345 |_Test1346 If a person filters TestCase.Test1 then all the test cases will run because all the test cases use TestCase.Test1XXXX.

Categories : C++



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