test: updated custom command test to index python code

This commit is contained in:
mlangkabel
2019-02-04 17:44:41 +01:00
parent 82a3c06a9d
commit 0ce7d93cef
14 changed files with 94 additions and 44 deletions
@@ -1,38 +0,0 @@
* Run "1_setup.sh"
* Start up Sourcetrail
* Click "New Project"
* Enter a project name
* Set "./working_copy" as project location
* Click "Add Source Group"
* Select "Custom" -> "Custom Command Source Group"
* Click "Next"
* Add "python add.py %{PROJECT_FILE_PATH} %{DATABASE_FILE_PATH} %{DATABASE_VERSION} %{SOURCE_FILE_PATH}" to "Custom Command"
* Add "./src" to "Files & Directories to Index"
* Add "**excl.txt" to "Excluded Files & Directories"
* Add ".txt" to "Source File Extensions"
* Click "Next"
* Click "Create"
* Validate "All files" is the only option selectable
* Validate "source files to index" shows "3"
* Click "Start"
* Validate Project indexed without error
* Click "OK"
* Validate "out.txt" contains 3 lines:
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/a.txt
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/b.txt
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/c.txt
* Press "Refresh" button
* Validate "Updated files" is selected
* Validate "source files to index" shows "3" again
* Click "Cancel"
* Click "Edit Project"
* Change "Custom Command" to "pyt add.py"
* Click "Save"
* Validate "Warning appears that %{SOURCE_FILE_PATH} is not defined in command"
* Change "Custom Command" to "pyt add.py %{SOURCE_FILE_PATH}"
* Click "Save"
* Click "Refresh" button
* Click "Start"
* Validate "Log View appears showing errors that command execution failed".
* Close Sourcetrail
* Run "2_teardown.sh"
@@ -1,6 +0,0 @@
import sys
# import time
# time.sleep(1)
with open("out.txt", "a") as myfile:
myfile.write(sys.argv[1] + ' ' + sys.argv[2] + ' ' + sys.argv[3] + ' ' + sys.argv[4] + '\n')
@@ -0,0 +1,17 @@
#!/bin/bash
# get absolute path to parent directory of script
MY_PATH=`dirname "$0"`
if [[ "${MY_PATH}" != *\\* ]]
then
cd $MY_PATH
MY_PATH=`pwd`
fi
MY_PATH="${MY_PATH//\\//}"
WORKING_COPY_PATH=$MY_PATH/working_copy
echo "" >> $WORKING_COPY_PATH/src/bar.py
echo "Update Complete"
@@ -0,0 +1,64 @@
* Run "1_setup.sh"
* Download the SourcetrailPythonIndexer project from https://github.com/CoatiSoftware/SourcetrailPythonIndexer
* Extract the archive to "./working_copy/SourcetrailPythonIndexer"
* Fetch the SourcetrailDB release for your OS from https://github.com/CoatiSoftware/SourcetrailDB/releases
* Extract the archive to "./working_copy/SourcetrailPythonIndexer"
* Start up Sourcetrail
* Click "New Project"
* Enter a project name
* Set "./working_copy" as project location
* Click "Add Source Group"
* Select "Custom" -> "Custom Command Source Group"
* Click "Next"
* Add "python <path/to/working_copy>/SourcetrailPythonIndexer/run.py --source-file-path=%{SOURCE_FILE_PATH} --database-file-path=%{DATABASE_FILE_PATH}" to "Custom Command"
* Add "./src" to "Files & Directories to Index"
* Add "**main*" to "Excluded Files & Directories"
* Add ".py" to "Source File Extensions"
* Click "Next"
* Click "Create"
* Validate "All files" is the only option selectable
* Validate "source files to index" shows "2"
* Click "Start"
* Validate Project indexed without error
* Click "OK"
* Enter "print" in the search bar and press "Enter"
* Validate the search bar shows "foo.Foo.print"
* Validate the graph shows some nodes and edges
* Validate the code view shows some code with syntax highlighting
* Press "Refresh" button
* Validate "Updated files" is selected
* Validate "source files to index" shows "0"
* Click "Cancel"
* Click "Edit Project"
* Clear the "Excluded Files & Directories" list
* Click "Save"
* Validate a project-file-was-changed-notification appears
* Click "Reindex"
* Validate "Updated files" is selected
* Validate "source files to index" shows "3"
* Click "Updated files"
* Validate "source files to index" shows "1"
* Click Start
* Validate Project indexed without error
* Click "OK"
* Validate content of code and graph view changed and display calls from "main"
* Run "2_update.sh"
* Validate "Updated files" is selected
* Validate "source files to index" shows "1"
* Click Start
* Validate a dialog appears that states that the project cannot be partially cleared
* Click "Fill Re-Index"
* Validate Project indexed without error
* Click "OK"
* Click "Edit Project"
* In "Custom Command" replace "python" with "pyt"
* In "Custom Command" replace "%{SOURCE_FILE_PATH}" with "foo"
* Click "Save"
* Validate "Warning appears that %{SOURCE_FILE_PATH} is not defined in command"
* In "Custom Command" replace "foo" with "%{SOURCE_FILE_PATH}"
* Click "Save"
* Click "Refresh" button
* Click "Start"
* Validate "Log View appears showing errors that command execution failed".
* Close Sourcetrail
* Run "3_teardown.sh"
@@ -0,0 +1,3 @@
class Bar:
def __init__(self):
self.baz = 'Initial String'
@@ -0,0 +1,5 @@
import bar
class Foo(bar.Bar):
def print(self):
print(self.baz)
@@ -0,0 +1,5 @@
import foo
def main():
f = foo.Foo()
f.print()