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
@@ -0,0 +1,19 @@
#!/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//\\//}"
SRC_PATH=$MY_PATH/data
WORKING_COPY_PATH=$MY_PATH/working_copy
mkdir -p $WORKING_COPY_PATH
cp -a $SRC_PATH/. $WORKING_COPY_PATH
echo "Setup Complete"
@@ -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,16 @@
#!/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
rm -rf $WORKING_COPY_PATH
echo "Teardown 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()