I've been looking around for a simple step-by-step tutorial on how to configure selenium tests to be run with Jenkins, but honestly I didn't find anything special.
I have a bash script by whom the test are run. The test are written in Python. I found out it's possible to run them, but I couldn't figure out to configure it properly.
I found that video https://www.youtube.com/watch?v=2lP_VUP0YF0 , but there's been skipped the configuration.
Would anyone give me some tips or even write a simple tutorial ?
Thanks a lot for all answers!
I have a bash script by whom the test are run
In its simplest form, that's what you need to put in your Jenkins job.
Create a job which can access all your code, probably via a git, svn or mercurial repository (or a shared drive)
and either have it execute your bash script via "Add step --> bash command", or
Put each step of your bash script as a bash step in your job.
You're not going to get a tutorial here. Better to try something here and then ask a specific question.
Related
I have cloned a git repository and am trying to run the code on PyCharm IDE. When I try to run it, my usual run option is not available and only run nosetests is available. I read that this is a module to help testing the code, but I don't see an import nosetests or anything like that which helps me to understand why my IDE automatically runs nosetests on this particular code.
Question: How can I run this like a normal code and why I'm seeing this run option instead.
I found multiple questions on how people accidentally changed their IDE setting in a way that all the codes are running using nosetest but not my question. I would appreciate if you can share a link that gives more details on this.
It seems that you do not have a Run Configuration in project that runs the code just tests. In PyCharm go to "Run" -> "Run..." (Shift + Alt + F10) and choose "Edit Configurations..." on the plus sign you can add a new configuration running python code "normally".
It is explained in detail on Jetbrains website:
https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html?keymap=primary_windows
From what I understand, you are not able to run the py code. You can achieve this easily on the terminal provided within Pycharm, using the commands provided in the project README.
Alternatively, if you want to run it using the GUI, you can edit the Run Configuration by clicking the dropdown near the Run icon at the top.
For further information please head out to https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html?keymap=primary_windows
1- i want someone to help with this part
https://automatetheboringstuff.com/appendixb/
about Running Python Scripts Outside of IDLE and sending command line args .
2- i converted my code to .exe by pyinstaller ; what's the difference between this and running it
as a script .
3-how scripts are done . i see experienced people says :"i made a script to do something for me " how is that done >?
*i'm a beginner so try to make answers simple as possible.
If you're wondering about command line arguments, look into the "argparse" library https://docs.python.org/3/library/argparse.html.
The difference in the .exe and the normal script is that that the .exe versions (conventionally) are able to be redistributed to other sytems that don't have python installed whilst still being able to run the script. If you're only making the script for yourself the only real benefit is that you dont have to enter your IDE (code editor) every time you want to run the code, however if it's still in development then you'd have to compile the code every time you made a modification if you're wanting to run the code as an executable, which is very impractical.
Your third part is very, very vague. Python can be very versatile and i recommend you continue looking at the automatetheboringstuff.com website if you're interested in making scripts that can complete repetitive activities (although i must strongly advise you against using scripts maliciously).
I am from electrical engineering and currently working on a project using UP-Board, I have attached LEDs, switch, Webcam, USB flash drive with it. I have created an executable script that I want to run at startup.
when I try to run the script in terminal using the code sudo /etc/init.d/testRun start it runs perfectly. Now when I write this command in terminal sudo update-rc.d testRun defaults to register the script to be run at startup it gives me the following error
insserv: warning: script 'testRun' missing LSB tags and overrides
Please guide me how to resolve this? I am from Electrical engineering background, so novice in this field of coding. Thanks a lot :)
The thing to remember is that you run the script as you but like chron startup does not, so you need to:
Ensure that the executable flags are set for all users and that it is in a directory that everybody has access to.
Use the absolute path for every thing, including the script.
Specify what to run it with, again with the absolute path.
I am stuck since 2 days trying to set up a small automatic deployment script.
The thing is: I have been using Git for some months now, but I always used it locally just by myself, just with the purpose of easily saving version of my code. All good until here.
Now I have to find a way to "publish" the code as soon as new functionalities are implemented and I think the code is stable enough.
Searching around I've discovered these 'hooks', which are scripts that are executed by Git in certain situations. Basically the idea is to have my master branch sync'd with my published code, so that everytime I merge a branch to the master and 'push', the files are automatically copied into '/my/published/folder'.
That said, I've found this tutorial that explains to do exactly what I want using a 'hooks' post-receive script, which is written in Ruby. Since at my studio I don't have and don't want to use Ruby at this time, I've found a Python version of the same script.
I tested and tested, but I couldn't make it work. I keep getting the same error:
remote: GIT_WORK_TREE is not recognized as as internal or external command,
Consider this is based on the tutorial I've shared above. Same prj name, same structure, etc.
I even installed Ruby on my personal laptop and tried the original script, but it still doesn't work...
I'm using Windows, and the Git env variable is set and accessible. But nevertheless it seems like it's not recognizing the GIT_WORK_TREE command. If I run it from the Git Bash it works just fine, but if I use the Windows Shell I get the same error message.
I suppose that when in my py script use the call() function, it runs the cmd using the Windows Shell. That's my guess, but I don't really know how to solve it. Google didn't help, as if no one ever had this problem before.
Maybe I'm just not seeing something obvious here, but I spent the whole day on this and I cannot get out of this bog!
Does anyone know how to solve it, or at least have an idea for a workaround?
Hope someone can help...
Thanks a lot!
The Ruby script you are talking about generates "bash" command:
GIT_WORK_TREE=/deploy/path git checkout -f ...
It means: define environment variable "GIT_WORK_TREE" with value "/deploy/path" and execute "git checkout -f ...".
As I understand it doesn't work for Windows command line.
Try to use something like:
set GIT_WORK_TREE=c:\temp\deploy && git checkout -f ...
I've had this problem as well - the best solution I've found is to pass the working tree across as one of the parameters
git --work-tree="/deploy/path" checkout -f ...
I have a set of python scripts which I run as a daemon services. These all work great, but when all the scripts are running and I use top -u <USER>, I see all my scripts running as python.
I would really like to know which script is running under which process id. So is there any way to execute a python script as a different process name?
I'm stuck here, and I'm not ever sure what terms to Google. :-)
Note: I'm using Ubuntu Linux. Not sure if the OS matters or not.
Try using setproctitle. It should work fine on Linux.
Don't have a linux system here to test this on appropriately, but if the above doesn't work, you should be able to use the same trick they use for things like gzip etc.
The script has to tell what to run it at the top like this:
#!/usr/local/bin/python
Use a softlink like this:
ln -s /usr/local/bin/python ~/bin/myutil
Then just change your script to
#!~/bin/myutil
and it should show up that way instead. You may need to use a hard link instead of a soft link.
Launching a python script using the python script itself (and file associations and/or shell magic) is not very portable, but you can use similar methods on nearly any OS.
The easiest way to get this is using she bang. The first line of your python script should be:
#!/usr/bin/python
or
#!/usr/bin/python3
depending upon whether you use python or python3
and then assign executable permissions to the script as follows:
chmod +x <scriptname>
and then run the script as
./scriptname
this will show up as scriptname in top.